# Keys

> API keys (dashboard only): shown once, rolled, revoked

Source: https://tickets.roostertail.com/docs/reference/keys

Every operation below is also in [the OpenAPI document](https://tickets.roostertail.com/v1/openapi.yaml). One that names an MCP tool can be called through [the MCP server](https://tickets.roostertail.com/docs/mcp.md); one that names none cannot.

## List API keys

`GET /v1/keys`

Operation id `listKeys`.

API keys, filtered by mode or by revoked. A key's secret is never in this list: only its id, name, scope and the last characters (`hint`).

**Who may call it.** A signed-in dashboard member whose role has `keys.manage` (owner, admin).

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `limit` | query | integer | How many to return, 1 to 100 (default 20). |
| `starting_after` | query | string | An id from the page before: the page after it. |
| `ending_before` | query | string | An id from the page after: the page before it. A list read from the database offers it as the list comes and filtered by event alone, in the default order, and answers parameter_invalid to any other… |
| `mode` | query | "test" \| "live" |  |
| `revoked` | query | "true" \| "false" |  |

**Answers 200.** A page of keys (never their secrets).

**Fields**

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "list" |  |
| `data` * | array of ApiKey | This page, newest first. |
| `has_more` * | boolean | True when there is another page: pass the last id as starting_after. |
| `url` * | "/v1/keys" | The path this list came from (/v1/keys). |

\* required

## Make an API key

`POST /v1/keys`

Operation id `createKey`.

Makes an API key for a mode (`test` or `live`) and a scope: `full`, `read` or `checkin`. The secret is in the answer once and can never be read again. Keys are made in the dashboard session, not by another key.

**Who may call it.** A signed-in dashboard member whose role has `keys.manage` (owner, admin).

**Request body** (`CreateApiKeyInput`)

| Field | Type | Description |
| --- | --- | --- |
| `name` * | string |  |
| `scope` | KeyScope |  |
| `mode` * | "test" \| "live" | The key's mode. A live key can be made, but every live call answers live_mode_not_open until live opens. |

\* required

```json
{
  "name": "Door scanners",
  "scope": "checkin",
  "mode": "test"
}
```

**Answers 201.** The key and its secret, shown once.

**Fields** (`ApiKeyWithSecret`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "api_key" |  |
| `id` * | string | An id starting with key_. |
| `mode` * | Mode | test or live, decided by the key (rt_test_… or rt_live_…). Test and live data never mix. |
| `name` * | string | Your label for the key. |
| `scope` * | KeyScope | full: everything the API does; read: every GET, except that what opens the door or a holder's page is null (qr_token, the private urls), the QR image is refused, and the text of a code is null; checkin: the door endpoin… |
| `hint` * | string | The start and last four characters, for recognising it: rt_test_…a1B2. |
| `created_at` * | string (date-time) | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `created_by` * | string \| null | An id starting with mem_. |
| `created_by_name` * | string \| null | Who made it, kept once they have left the org. Null while they are on the team (their name is in GET /v1/members). |
| `last_used_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `expires_at` * | string \| null | Set when the key was rolled: it keeps working until then. |
| `revoked_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `sells_from_one_address` | true | Given only when true: an owner or admin said this key's server really does sell from one address (a box office, a partner's own site). On a live key, holds that name no address are then not counted as one network. A hol… |
| `secret` * | string | The secret key: rt_test_… or rt_live_…. Shown once. |

\* required

## The key making this call

`GET /v1/keys/current`

Operation id `getCurrentKey`. MCP tool `get_current_key`. SDK `tickets.keys.current`.

The key making this call: its id, mode, scope and hint. Any scope may ask. A cheap way for an agent to learn which mode and scope it has before it writes.

**Who may call it.** An API key with scope `full`, `read`, `checkin`. Any other scope answers `insufficient_scope`.

**Answers 200.** The calling key: its id, mode, scope and hint (never its secret or hash). Any scope may ask.

**Fields** (`ApiKey`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "api_key" |  |
| `id` * | string | An id starting with key_. |
| `mode` * | Mode | test or live, decided by the key (rt_test_… or rt_live_…). Test and live data never mix. |
| `name` * | string | Your label for the key. |
| `scope` * | KeyScope | full: everything the API does; read: every GET, except that what opens the door or a holder's page is null (qr_token, the private urls), the QR image is refused, and the text of a code is null; checkin: the door endpoin… |
| `hint` * | string | The start and last four characters, for recognising it: rt_test_…a1B2. |
| `created_at` * | string (date-time) | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `created_by` * | string \| null | An id starting with mem_. |
| `created_by_name` * | string \| null | Who made it, kept once they have left the org. Null while they are on the team (their name is in GET /v1/members). |
| `last_used_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `expires_at` * | string \| null | Set when the key was rolled: it keeps working until then. |
| `revoked_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `sells_from_one_address` | true | Given only when true: an owner or admin said this key's server really does sell from one address (a box office, a partner's own site). On a live key, holds that name no address are then not counted as one network. A hol… |

\* required

## Retrieve a key

`GET /v1/keys/{id}`

Operation id `getKey`.

One key's id, name, mode, scope, hint and when it was last used. Never its secret, which was shown once when it was made.

**Who may call it.** A signed-in dashboard member whose role has `keys.manage` (owner, admin).

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `id` * | path | string | An id starting with key_. |

**Answers 200.** The key.

**Fields** (`ApiKey`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "api_key" |  |
| `id` * | string | An id starting with key_. |
| `mode` * | Mode | test or live, decided by the key (rt_test_… or rt_live_…). Test and live data never mix. |
| `name` * | string | Your label for the key. |
| `scope` * | KeyScope | full: everything the API does; read: every GET, except that what opens the door or a holder's page is null (qr_token, the private urls), the QR image is refused, and the text of a code is null; checkin: the door endpoin… |
| `hint` * | string | The start and last four characters, for recognising it: rt_test_…a1B2. |
| `created_at` * | string (date-time) | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `created_by` * | string \| null | An id starting with mem_. |
| `created_by_name` * | string \| null | Who made it, kept once they have left the org. Null while they are on the team (their name is in GET /v1/members). |
| `last_used_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `expires_at` * | string \| null | Set when the key was rolled: it keeps working until then. |
| `revoked_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `sells_from_one_address` | true | Given only when true: an owner or admin said this key's server really does sell from one address (a box office, a partner's own site). On a live key, holds that name no address are then not counted as one network. A hol… |

\* required

## Rename a key

`PATCH /v1/keys/{id}`

Operation id `updateKey`.

Renames a key, for example after you move it to another service. Nothing else about a key changes: roll it for a new secret.

**Who may call it.** A signed-in dashboard member whose role has `keys.manage` (owner, admin).

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `id` * | path | string | An id starting with key_. |

**Request body** (`UpdateApiKeyInput`)

| Field | Type | Description |
| --- | --- | --- |
| `name` | string |  |
| `sells_from_one_address` | boolean | On a live key, a hold that names no buyer's address counts as one network, at most half of what is left. True only for a server that really sells from one place. Anything in front of the public should send the buyer's a… |

```json
{
  "name": "Renamed"
}
```

**Answers 200.** Renamed.

**Fields** (`ApiKey`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "api_key" |  |
| `id` * | string | An id starting with key_. |
| `mode` * | Mode | test or live, decided by the key (rt_test_… or rt_live_…). Test and live data never mix. |
| `name` * | string | Your label for the key. |
| `scope` * | KeyScope | full: everything the API does; read: every GET, except that what opens the door or a holder's page is null (qr_token, the private urls), the QR image is refused, and the text of a code is null; checkin: the door endpoin… |
| `hint` * | string | The start and last four characters, for recognising it: rt_test_…a1B2. |
| `created_at` * | string (date-time) | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `created_by` * | string \| null | An id starting with mem_. |
| `created_by_name` * | string \| null | Who made it, kept once they have left the org. Null while they are on the team (their name is in GET /v1/members). |
| `last_used_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `expires_at` * | string \| null | Set when the key was rolled: it keeps working until then. |
| `revoked_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `sells_from_one_address` | true | Given only when true: an owner or admin said this key's server really does sell from one address (a box office, a partner's own site). On a live key, holds that name no address are then not counted as one network. A hol… |

\* required

## Roll a key's secret

`POST /v1/keys/{id}/roll`

Operation id `rollKey`.

Makes a new secret for a key and keeps the old one working until `expires_in_hours` (0 stops it at once). Use it to rotate a secret without downtime.

**Who may call it.** A signed-in dashboard member whose role has `keys.manage` (owner, admin).

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `id` * | path | string | An id starting with key_. |

**Request body** (`RollApiKeyInput`)

| Field | Type | Description |
| --- | --- | --- |
| `expires_in_hours` | integer | How long the old secret keeps working: 0 stops it now; at most 168 (7 days). |

```json
{
  "expires_in_hours": 0
}
```

**Answers 200.** A new key with its secret; the old one works until expires_at.

**Fields** (`ApiKeyWithSecret`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "api_key" |  |
| `id` * | string | An id starting with key_. |
| `mode` * | Mode | test or live, decided by the key (rt_test_… or rt_live_…). Test and live data never mix. |
| `name` * | string | Your label for the key. |
| `scope` * | KeyScope | full: everything the API does; read: every GET, except that what opens the door or a holder's page is null (qr_token, the private urls), the QR image is refused, and the text of a code is null; checkin: the door endpoin… |
| `hint` * | string | The start and last four characters, for recognising it: rt_test_…a1B2. |
| `created_at` * | string (date-time) | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `created_by` * | string \| null | An id starting with mem_. |
| `created_by_name` * | string \| null | Who made it, kept once they have left the org. Null while they are on the team (their name is in GET /v1/members). |
| `last_used_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `expires_at` * | string \| null | Set when the key was rolled: it keeps working until then. |
| `revoked_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `sells_from_one_address` | true | Given only when true: an owner or admin said this key's server really does sell from one address (a box office, a partner's own site). On a live key, holds that name no address are then not counted as one network. A hol… |
| `secret` * | string | The secret key: rt_test_… or rt_live_…. Shown once. |

\* required

**Errors of its own.** [`invalid_state_transition`](https://tickets.roostertail.com/docs/errors.md#invalid_state_transition). The errors every operation can answer are on [the errors page](https://tickets.roostertail.com/docs/errors.md).

## Revoke a key now

`POST /v1/keys/{id}/revoke`

Operation id `revokeKey`.

Stops a key working now. Anything still using it starts answering `api_key_revoked`. This cannot be undone: make a new key.

**Who may call it.** A signed-in dashboard member whose role has `keys.manage` (owner, admin).

| Parameter | In | Type | Description |
| --- | --- | --- | --- |
| `id` * | path | string | An id starting with key_. |

**Answers 200.** Revoked.

**Fields** (`ApiKey`)

| Field | Type | Description |
| --- | --- | --- |
| `object` * | "api_key" |  |
| `id` * | string | An id starting with key_. |
| `mode` * | Mode | test or live, decided by the key (rt_test_… or rt_live_…). Test and live data never mix. |
| `name` * | string | Your label for the key. |
| `scope` * | KeyScope | full: everything the API does; read: every GET, except that what opens the door or a holder's page is null (qr_token, the private urls), the QR image is refused, and the text of a code is null; checkin: the door endpoin… |
| `hint` * | string | The start and last four characters, for recognising it: rt_test_…a1B2. |
| `created_at` * | string (date-time) | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `created_by` * | string \| null | An id starting with mem_. |
| `created_by_name` * | string \| null | Who made it, kept once they have left the org. Null while they are on the team (their name is in GET /v1/members). |
| `last_used_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `expires_at` * | string \| null | Set when the key was rolled: it keeps working until then. |
| `revoked_at` * | string \| null | An instant in ISO 8601 with its zone, e.g. 2027-07-17T20:00:00Z. Answers are always UTC. |
| `sells_from_one_address` | true | Given only when true: an owner or admin said this key's server really does sell from one address (a box office, a partner's own site). On a live key, holds that name no address are then not counted as one network. A hol… |

\* required
