# List API keys (https://orgasm.dev/docs/api/account/listApiKeys)

# List API keys

- **Method:** `GET`
- **Path:** `/v1/api-keys`
- **Operation ID:** `listApiKeys`
- **Tags:** account

Lists your company's API keys, newest first, with only their prefix and last four characters, who made each, and when a rolled key stops working.

## Effective servers

- `https://orgasm.dev`

  `sk_test_` keys reach the sandbox. `sk_live_` keys are refused until live analysis is available.
- `http://localhost:3000`

  The docs site running locally (`npm run dev`), which serves the sandbox.
- `http://localhost:4010`

  The standalone sandbox (`npm run mock`), which also serves the WebSocket channel.

## Authentication

- **secretKey**: HTTP bearer (`sk_test_… or sk_live_…`)

  A secret key, sent as `Authorization: Bearer sk_test_…`. Keep it on your server. Test keys reach the sandbox; live keys reach live analysis. In the sandbox any key that starts with `sk_test_` works.

## Query parameters

- **`limit`**: `integer`, default: `20`, minimum: `1`, maximum: `100`

  How many items to return.
- **`cursor`**: `string`

  The `nextCursor` of the previous page.

## Responses

### 200 A page of keys. Secrets are not included.

**Headers:**

- **`Request-Id`**

  Identifies the request; include it when you contact support.

  `string`, pattern: `^req_[0-9a-z]{20}$`
- **`RateLimit-Limit`**

  Requests allowed in the current window.

  `integer`
- **`RateLimit-Remaining`**

  Requests left in the current window.

  `integer`
- **`RateLimit-Reset`**

  Seconds until the window resets.

  `integer`

**Content type:** `application/json`

schema: `ApiKeyList`

A page of API keys.

- **`data` (required)**: `array`

  **Items:**

  schema: `ApiKey`

  A key of your company's.
  - **`createdAt` (required)**: `string`, format: `date-time`
  - **`createdBy` (required)**: `string | null`

    The email of the member who made it in the console, or `null` for a key made through this API.
  - **`expiresAt` (required)**: `string | null`, format: `date-time`

    When a rolled key stops working; `null` for a key that does not expire.
  - **`id` (required)**: `string`, pattern: `^key_[0-9a-z]{20}$`
  - **`lastUsedAt` (required)**: `string | null`, format: `date-time`
  - **`mode` (required)**: `string`, possible values: `"test", "live"`
  - **`name` (required)**: `string`
  - **`object` (required)**: `string`, const: `"api_key"`
  - **`redacted` (required)**: `string`

    The key's prefix and last four characters.
  - **`secret` (required)**: `string | null`

    The whole key, only in the response that created or rolled it.
  - **`type` (required)**: `string`, possible values: `"secret", "billing"`

    `secret`: everything in this API. `billing`: reads `getCredits`, `getUsage` and `listCharges` and nothing else, in live mode only.
- **`hasMore` (required)**: `boolean`
- **`nextCursor` (required)**: `string | null`
- **`object` (required)**: `string`, const: `"list"`

**Example: oneKey**

One key

Returned by listApiKeys.

```json
{
  "object": "list",
  "data": [
    {
      "id": "key_9d2f5g8h1j4k7l0z3x6c",
      "object": "api_key",
      "name": "Staging server",
      "mode": "test",
      "type": "secret",
      "redacted": "sk_test_…7qk2",
      "secret": null,
      "createdBy": "dev@studio.example",
      "createdAt": "2026-10-16T14:00:00Z",
      "lastUsedAt": "2026-10-16T14:05:12Z",
      "expiresAt": null
    }
  ],
  "hasMore": false,
  "nextCursor": null
}
```

### 401 The key is missing, malformed or revoked.

**Headers:**

- **`Request-Id`**

  Identifies the request; include it when you contact support.

  `string`, pattern: `^req_[0-9a-z]{20}$`
- **`RateLimit-Limit`**

  Requests allowed in the current window.

  `integer`
- **`RateLimit-Remaining`**

  Requests left in the current window.

  `integer`
- **`RateLimit-Reset`**

  Seconds until the window resets.

  `integer`

**Content type:** `application/problem+json`

schema: `Problem`

An error, as RFC 9457 problem details. `type` links to the explanation of `code` in the docs.

- **`code` (required)**: `string`, possible values: `"invalid_request", "consent_required", "capability_required", "sandbox_only", "authentication_required", "invalid_api_key", "live_mode_unavailable", "credits_exhausted", "permission_denied", "not_found", "idempotency_key_reused", "session_ended", "sandbox_no_media", "upload_already_received", "payload_too_large", "rate_limited", "capacity_unavailable", "internal_error"`

  A stable, machine-readable error code.
- **`status` (required)**: `integer`

  The HTTP status code.
- **`title` (required)**: `string`

  A short summary of the error.
- **`type` (required)**: `string`, format: `uri`

  A link to the docs for this error.
- **`detail`**: `string`

  What went wrong in this request, and what to do.
- **`errors`**: `array`

  Each contract violation, when the body or a parameter did not match the contract.

  **Items:**
  - **`location` (required)**: `string`, possible values: `"path", "query", "header", "cookie", "body"`
  - **`message` (required)**: `string`
  - **`path` (required)**: `string`

    JSON pointer to the value at fault.
- **`instance`**: `string`

  The request path.
- **`param`**: `string | null`

  The request field at fault, as a dotted path, when there is one.
- **`requestId`**: `string`

**Example:**

```json
{
  "type": "https://orgasm.dev/docs/guides/errors#invalid_api_key",
  "title": "The API key is not valid",
  "status": 401,
  "code": "invalid_api_key",
  "detail": "Send a secret key as `Authorization: Bearer sk_test_…`. In the sandbox any key that starts with sk_test_ works.",
  "requestId": "req_3k6m9q2t5w8z1c4f7h0j"
}
```

### 403 The key cannot do this, or live mode is not available yet.

**Headers:**

- **`Request-Id`**

  Identifies the request; include it when you contact support.

  `string`, pattern: `^req_[0-9a-z]{20}$`
- **`RateLimit-Limit`**

  Requests allowed in the current window.

  `integer`
- **`RateLimit-Remaining`**

  Requests left in the current window.

  `integer`
- **`RateLimit-Reset`**

  Seconds until the window resets.

  `integer`

**Content type:** `application/problem+json`

*Schema `Problem` is shown above.*

**Example:**

```json
{
  "type": "https://orgasm.dev/docs/guides/errors#live_mode_unavailable",
  "title": "Live analysis is not available yet",
  "status": 403,
  "code": "live_mode_unavailable",
  "detail": "Live keys are not accepted yet. Use a key that starts with sk_test_ to reach the sandbox.",
  "requestId": "req_3k6m9q2t5w8z1c4f7h0j"
}
```

### 429 Too many requests; wait \`Retry-After\` seconds.

**Headers:**

- **`Request-Id`**

  Identifies the request; include it when you contact support.

  `string`, pattern: `^req_[0-9a-z]{20}$`
- **`RateLimit-Limit`**

  Requests allowed in the current window.

  `integer`
- **`RateLimit-Remaining`**

  Requests left in the current window.

  `integer`
- **`RateLimit-Reset`**

  Seconds until the window resets.

  `integer`
- **`Retry-After`**

  Seconds to wait before retrying.

  `integer`

**Content type:** `application/problem+json`

*Schema `Problem` is shown above.*

**Example:**

```json
{
  "type": "https://orgasm.dev/docs/guides/errors#rate_limited",
  "title": "Too many requests",
  "status": 429,
  "code": "rate_limited",
  "detail": "Retry after 2 seconds.",
  "requestId": "req_3k6m9q2t5w8z1c4f7h0j"
}
```

## Schemas

- `Problem` — shown above.

### ErrorCode

**Type:** `string`, possible values: `"invalid_request", "consent_required", "capability_required", "sandbox_only", "authentication_required", "invalid_api_key", "live_mode_unavailable", "credits_exhausted", "permission_denied", "not_found", "idempotency_key_reused", "session_ended", "sandbox_no_media", "upload_already_received", "payload_too_large", "rate_limited", "capacity_unavailable", "internal_error"`

A stable, machine-readable error code.

### ApiKeyType

**Type:** `string`, possible values: `"secret", "billing"`

`secret`: everything in this API. `billing`: reads `getCredits`, `getUsage` and `listCharges` and nothing else, in live mode only.

- `ApiKey` — shown above.
- `ApiKeyList` — shown above.
