# pin

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

> Pin moves a Tenant’s keys to another API version, or to `latest`, once a call with its test key passes there.

Pin moves a [Tenant](/business/nouns/tenant)’s keys to another API version, or to `latest`, once a call with its test key passes there.

## Inputs
| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `tenant` | [Tenant](/business/nouns/tenant) | Yes | The Tenant whose keys move. |
| `apiVersion` | `string` | Yes | The version to answer at, such as `v2`, or `latest` to track the newest. |

## Outputs
| Output | Type | Required | Description |
| --- | --- | --- | --- |
| `tenant` | [Tenant](/business/nouns/tenant) | Yes | The Tenant, answering at its new version. |

## Effects
- Emits [`Tenant.pinned`](/business/events/Tenant.pinned).
- Two-way: it runs at once, in the `try`, `send` and `do` modes.
- Refuses until a call with the Tenant’s test key succeeds at the target version.
- Leaves each Watch at the version current when it was created.

## 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. | [Tenant.pin](/business/nouns/tenant/pin) |
| Until a call with the Tenant’s test key succeeds at the target version | [`refused`](/code/api/errors/refused) | Clear what the check names, then call it again. | [Tenant.pin](/business/nouns/tenant/pin) |

## 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
Pin the latest tenant.
```

**API**

```bash
curl -X POST https://api.sb/patentpad.com/tenants/tenant_1/pin \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"apiVersion":"v2"}'
```

```json
{
  "api": "https://api.sb/patentpad.com",
  "tenant": {
    "$id": "https://api.sb/patentpad.com/tenants/tenant_1",
    "$type": "Tenant",
    "placement": "path",
    "apiVersion": "v2"
  },
  "action": {
    "$id": "https://api.sb/patentpad.com/actions/action_1",
    "operation": "Tenant.pin",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/patentpad.com/actions/action_1"
  }
}
```

**SDK**

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

const tenant = await $.Tenant.pin({ tenant: 'tenant_1', apiVersion: 'v2' })
```

**CLI**

```bash
npx startup-builder do Tenant.pin --json '{"tenant":"tenant_1","apiVersion":"v2"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Tenant.pin({ tenant: 'tenant_1', apiVersion: 'v2' })"
  }
}
```