# rotate

URL: /business/nouns/watch/rotate · Id: `verb:Watch.rotate` · Call: `await $.Watch.rotate({ … })` (SDK) or the `do` tool at `https://api.sb/mcp`. Inputs says what to pass, Outputs what returns, When it waits who approves.

> Rotate issues a new signing secret for a Watch and signs with both secrets until the old one expires.

Rotate issues a new signing secret for a [Watch](/business/nouns/watch) and signs with both secrets until the old one expires.

## Inputs
| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `watch` | [Watch](/business/nouns/watch) | Yes | The Watch whose secret changes. |
| `overlap` | `string` | No | How long the old secret keeps signing, as an ISO 8601 duration; defaults to `PT24H`. |

## Outputs
| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `watch` | [Watch](/business/nouns/watch) | Yes | The Watch, signing with both secrets. |
| `secret` | `string` | Yes | The new signing secret, shown once. |

## Effects
- Emits [`Watch.rotated`](/business/events/Watch.rotated).
- Adds a second signature to every delivery until the overlap ends.
- Retires the old secret when the overlap ends.

## Refuses when
| Check | Error | Fix | Then call |
| --- | --- | --- | --- |
| The key is valid, but its scopes do not allow this operation. | [`forbidden`](/code/api/errors/forbidden) | Use a key whose scopes cover the operation, or ask an owner of the namespace to grant them. | [Watch.rotate](/business/nouns/watch/rotate) |

## When it waits
| Gate | Default |
| --- | --- |
| Decision class | Low: two-way, nothing at stake |
| [Delay window](/systems/trust-and-governance/controls/one-way-windows) | None: it runs once review passes. |
| Limit | The call [Limit](/business/nouns/limit) of the [Permission](/business/nouns/permission) it runs under. |
| Over the Limit | It waits `pending` for an [Approval](/business/nouns/approval) from the [Founder](/agents/founding/founder). Approved, it runs; refused, it ends `refused` with [`limit-exceeded`](/code/api/errors/limit-exceeded); unanswered by its deadline, it ends `canceled`. |

## Example

**Ask**

```text
Rotate the latest watch.
```

**API**

```bash
curl -X POST https://api.sb/kilnbakery.com/watches/watch_1/rotate \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY"
```

```json
{
  "api": "https://api.sb/kilnbakery.com",
  "watch": {
    "$id": "https://api.sb/kilnbakery.com/watches/watch_1",
    "$type": "Watch",
    "selector": "Example selector",
    "url": "https://kilnbakery.com"
  },
  "secret": "Example secret",
  "action": {
    "$id": "https://api.sb/kilnbakery.com/actions/action_1",
    "operation": "Watch.rotate",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/kilnbakery.com/actions/action_1"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const { watch, secret } = await $.Watch.rotate({ watch: 'watch_1' })
```

**CLI**

```bash
npx startup-builder do Watch.rotate --json '{"watch":"watch_1"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Watch.rotate({ watch: 'watch_1' })"
  }
}
```