# API keys API

> The API keys of a workspace and their scopes. With curl and TypeScript examples.

## `GET /v1/api-keys`

List the unrevoked API keys of the workspace, newest first

Operation `listApiKeys`. Scopes: `keys:manage`.

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer (1 to 100, default 20) | no | Page size, 1 to 100. |
| `cursor` | query | string | no | Opaque `next_cursor` of the previous page, for the same list and filters. Omit for the first page. |

**Responses**

| Status | Meaning | Content type |
| --- | --- | --- |
| `200` | One page of keys, without secrets. | `application/json` |
| `400` | `validation_failed` (bad `limit` or filter) or `invalid_cursor`. | `application/problem+json` |
| `401` | `unauthenticated`: no credentials, or credentials that prove nothing. | `application/problem+json` |
| `403` | `human_action_required`: only a person in the portal does this; the problem names the page and the steps (`human_action`). Do not retry. `insufficient_scope`: the credential lacks a scope this route needs (see `missing_scopes`). `permission_denied`: the current workspace role does not allow the action. `mfa_required`: a portal session that must still verify or set up MFA (see `mfa_reason`). `workspace_suspended`: Taggor suspended the workspace; every credential acting in it is refused until it is lifted. | `application/problem+json` |
| `405` | `method_not_allowed`: the path exists, but not for this method; `Allow` lists the methods it answers. | `application/problem+json` |
| `429` | `rate_limited`: the limit of the route class (`rate_limit.limit_class`: read, write, publish, heavy, approval, diff, metrics, destructive or ip) was reached. Wait `Retry-After` seconds. `rate_limiter_unavailable` (503) is answered for `heavy` routes and destructive calls when the limiter itself fails, and for a valid OAuth token with no grant when the consent-link limiter fails (never a 401, so an MCP client does not log in again). | `application/problem+json` |
| `500` | `internal_error` (nothing about the failure; quote `request_id`) or `configuration_error`. | `application/problem+json` |
| `503` | `database_unavailable`: the API could not reach its database (timeout, dropped connection). Wait `Retry-After` seconds and send the same request again: repeating is safe with the same `Idempotency-Key`; without it a POST may already have been applied. | `application/problem+json` |

```sh title="curl"
curl "https://api.taggor.dev/v1/api-keys" \
  -H "Authorization: Bearer $TAGGOR_API_KEY"
```

```ts title="TypeScript"
const response = await fetch("https://api.taggor.dev/v1/api-keys", {
  headers: { authorization: `Bearer ${process.env.TAGGOR_API_KEY}` },
});
if (!response.ok) throw new Error(await response.text());
const result: unknown = await response.json();
console.log(result);
```

```json title="Example response"
{
  "data": [
    {
      "id": "key_0123456789abcdefghjkmnpqrs",
      "name": "CI deploy",
      "scopes": [
        "components:read",
        "versions:publish"
      ],
      "display_prefix": "tgr_live_7Gq2LmZ0",
      "created_by": {
        "id": "usr_0123456789abcdefghjkmnpqrs",
        "kind": "user",
        "name": "Ana"
      },
      "created_at": "2026-10-31T12:00:00.000Z",
      "last_used_at": null,
      "revoked_at": null
    }
  ],
  "next_cursor": null,
  "has_more": false
}
```

## `GET /v1/api-keys/{api_key_id}`

Read one unrevoked API key of the workspace, without its secret

Operation `getApiKey`. Scopes: `keys:manage`.

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `api_key_id` | path | string | yes | Public api_key id. |

**Responses**

| Status | Meaning | Content type |
| --- | --- | --- |
| `200` | The key, without its secret. | `application/json` |
| `400` | `validation_failed`: a bad path parameter or body field. | `application/problem+json` |
| `401` | `unauthenticated`: no credentials, or credentials that prove nothing. | `application/problem+json` |
| `403` | `human_action_required`: only a person in the portal does this; the problem names the page and the steps (`human_action`). Do not retry. `insufficient_scope`: the credential lacks a scope this route needs (see `missing_scopes`). `permission_denied`: the current workspace role does not allow the action. `mfa_required`: a portal session that must still verify or set up MFA (see `mfa_reason`). `workspace_suspended`: Taggor suspended the workspace; every credential acting in it is refused until it is lifted. | `application/problem+json` |
| `404` | `not_found`: no unrevoked key with this id in the caller's workspace. | `application/problem+json` |
| `405` | `method_not_allowed`: the path exists, but not for this method; `Allow` lists the methods it answers. | `application/problem+json` |
| `429` | `rate_limited`: the limit of the route class (`rate_limit.limit_class`: read, write, publish, heavy, approval, diff, metrics, destructive or ip) was reached. Wait `Retry-After` seconds. `rate_limiter_unavailable` (503) is answered for `heavy` routes and destructive calls when the limiter itself fails, and for a valid OAuth token with no grant when the consent-link limiter fails (never a 401, so an MCP client does not log in again). | `application/problem+json` |
| `500` | `internal_error` (nothing about the failure; quote `request_id`) or `configuration_error`. | `application/problem+json` |
| `503` | `database_unavailable`: the API could not reach its database (timeout, dropped connection). Wait `Retry-After` seconds and send the same request again: repeating is safe with the same `Idempotency-Key`; without it a POST may already have been applied. | `application/problem+json` |

```sh title="curl"
curl "https://api.taggor.dev/v1/api-keys/key_0123456789abcdefghjkmnpqrs" \
  -H "Authorization: Bearer $TAGGOR_API_KEY"
```

```ts title="TypeScript"
const response = await fetch("https://api.taggor.dev/v1/api-keys/key_0123456789abcdefghjkmnpqrs", {
  headers: { authorization: `Bearer ${process.env.TAGGOR_API_KEY}` },
});
if (!response.ok) throw new Error(await response.text());
const result: unknown = await response.json();
console.log(result);
```

```json title="Example response"
{
  "id": "key_0123456789abcdefghjkmnpqrs",
  "name": "CI deploy",
  "scopes": [
    "components:read",
    "versions:publish"
  ],
  "display_prefix": "tgr_live_7Gq2LmZ0",
  "created_by": {
    "id": "usr_0123456789abcdefghjkmnpqrs",
    "kind": "user",
    "name": "Ana"
  },
  "created_at": "2026-10-31T12:00:00.000Z",
  "last_used_at": null,
  "revoked_at": null
}
```

## `DELETE /v1/api-keys/{api_key_id}`

Revoke an API key of the workspace: the next request with it gets 401

Operation `revokeApiKey`. Scopes: `keys:manage`.

**Parameters**

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `api_key_id` | path | string | yes | Public api_key id. |

**Responses**

| Status | Meaning | Content type |
| --- | --- | --- |
| `200` | The revoked key; it no longer authenticates anything. | `application/json` |
| `400` | `validation_failed`: a bad path parameter or body field. | `application/problem+json` |
| `401` | `unauthenticated`: no credentials, or credentials that prove nothing. | `application/problem+json` |
| `402` | `workspace_payment_required`: the workspace needs a paid plan and has none, so it accepts no change; reading and exporting still work. A person pays in the portal, under Settings, Plan and billing. | `application/problem+json` |
| `403` | `human_action_required`: only a person in the portal does this; the problem names the page and the steps (`human_action`). Do not retry. `insufficient_scope`: the credential lacks a scope this route needs (see `missing_scopes`). `permission_denied`: the current workspace role does not allow the action. `mfa_required`: a portal session that must still verify or set up MFA (see `mfa_reason`). `cross_site_request`: authenticated by the session cookie, but not from the portal (another `Origin`, or not `Content-Type: application/json`). `workspace_suspended`: Taggor suspended the workspace; every credential acting in it is refused until it is lifted. | `application/problem+json` |
| `404` | `not_found`: no unrevoked key with this id in the caller's workspace. | `application/problem+json` |
| `405` | `method_not_allowed`: the path exists, but not for this method; `Allow` lists the methods it answers. | `application/problem+json` |
| `409` | `api_key_in_use`: the request is authenticated by the very key it revokes; revoke it from the portal or with another key. | `application/problem+json` |
| `429` | `rate_limited`: the limit of the route class (`rate_limit.limit_class`: read, write, publish, heavy, approval, diff, metrics, destructive or ip) was reached. Wait `Retry-After` seconds. `rate_limiter_unavailable` (503) is answered for `heavy` routes and destructive calls when the limiter itself fails, and for a valid OAuth token with no grant when the consent-link limiter fails (never a 401, so an MCP client does not log in again). | `application/problem+json` |
| `500` | `internal_error` (nothing about the failure; quote `request_id`) or `configuration_error`. | `application/problem+json` |
| `503` | `database_unavailable`: the API could not reach its database (timeout, dropped connection). Wait `Retry-After` seconds and send the same request again: repeating is safe with the same `Idempotency-Key`; without it a POST may already have been applied. | `application/problem+json` |

```sh title="curl"
curl -X DELETE "https://api.taggor.dev/v1/api-keys/key_0123456789abcdefghjkmnpqrs" \
  -H "Authorization: Bearer $TAGGOR_API_KEY"
```

```ts title="TypeScript"
const response = await fetch("https://api.taggor.dev/v1/api-keys/key_0123456789abcdefghjkmnpqrs", {
  method: "DELETE",
  headers: { authorization: `Bearer ${process.env.TAGGOR_API_KEY}` },
});
if (!response.ok) throw new Error(await response.text());
const result: unknown = await response.json();
console.log(result);
```

```json title="Example response"
{
  "id": "key_0123456789abcdefghjkmnpqrs",
  "name": "CI deploy",
  "scopes": [
    "components:read",
    "versions:publish"
  ],
  "display_prefix": "tgr_live_7Gq2LmZ0",
  "created_by": {
    "id": "usr_0123456789abcdefghjkmnpqrs",
    "kind": "user",
    "name": "Ana"
  },
  "created_at": "2026-10-31T12:00:00.000Z",
  "last_used_at": "2026-10-31T12:30:00.000Z",
  "revoked_at": "2026-10-31T13:00:00.000Z"
}
```
