> ## Documentation Index
> Fetch the complete documentation index at: https://docs.darkbloom.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# API key management — /v1/keys and /v1/auth/keys

> Create, inspect, rotate and revoke Darkbloom API keys. Management requires a Privy session; API keys cannot manage other keys.

Darkbloom API keys are created and managed through `/v1/keys`. The older `/v1/auth/keys` endpoints still work for one key per account. Both families require a Privy session JWT; an API key used on a management route returns `403 forbidden`.

> [!WARNING]
>
> API key creation requires browser-based Privy authentication. You cannot use an existing API key to mint or revoke other keys. This prevents a leaked key from creating new long-lived credentials.

## Create a key

The recommended path is the console at [console.darkbloom.dev](https://console.darkbloom.dev), on the API console page (`/api-console`).

### POST /v1/keys

```bash theme={null}
curl -X POST https://api.darkbloom.dev/v1/keys \
  -H "Authorization: Bearer <privy-access-token>" \
  -H "Content-Type: application/json" \
  -d '{"name": "ci", "limit_usd": 25, "limit_reset": "monthly", "rpm_limit": 60}'
```

The response is `{key, data}`: `key` is the plaintext secret, shown once. New secrets start with `sk-db-`.

Optional settings:

* `name` — display name.
* `limit_usd` and `limit_reset` (`none`, `daily`, `weekly`, `monthly`) — spend cap.
* `rpm_limit`, `itpm_limit`, `otpm_limit` — request and token limits.
* `allowed_models` — the only model IDs this key may use.
* `expires_at` — expiry time.
* `self_route_only` — restrict the key to the account's own machines.
* `disabled` — turn the key off without deleting it.

### POST /v1/auth/keys

The older mint takes no required body and returns `{api_key, account_id}`. It creates one key for the account.

## Inspect and change a key

| Action | Call |
| - | - |
| List | `GET /v1/keys` → `{object: "list", data: [...]}` |
| Inspect one | `GET /v1/keys/{id}` |
| Inspect the calling key | `GET /v1/key` (accepts the API key itself) |
| Change settings | `PATCH /v1/keys/{id}` with any subset of the settings above |
| Rotate the secret | `POST /v1/keys/{id}/rotate` → new `key` |
| Revoke | `DELETE /v1/keys/{id}` |

`GET /v1/keys` shows `usage_usd`, `limit_usd` and `remaining_usd` per key. A key's `label` masks the secret to its prefix, first four and last four characters.

## Revoke a key with the older endpoint

### DELETE /v1/auth/keys

**key** `string` *required*

The API key to revoke, e.g. `"sk-db-..."`.

The response is `{status: "revoked"}`. A revoked key stops authenticating after the coordinator's API-key cache refreshes; in-flight requests that already passed authentication can finish.

## Errors

**403 forbidden** `error`

An API key was used on a management route. Use the Privy session JWT.

**400 bad\_request** `error`

The revoke body does not contain a `key` string.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.