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

# naive keys

> Create, list, rotate, and revoke scoped API keys.

API keys are how CI and services authenticate. Each key carries an explicit scope list, so a deploy key need not be an admin key.

## Commands

| Command | Description |
| - | - |
| `naive keys create` | Mint a scoped key. The secret is shown once. |
| `naive keys list` | List keys — metadata only, never secrets. |
| `naive keys show <key-id>` | One key with its spend, last-day calls and pending approvals. |
| `naive keys update <key-id>` | Narrow a key: name, description, scopes, preset, expiry, budget. |
| `naive keys rotate <key-id>` | Mint a replacement secret for a key; `--grace` keeps the old one working for a while. |
| `naive keys revoke <key-id>` | Revoke a key immediately. |

## create

```bash theme={"system"}
naive keys create --name ci --scopes agents:write,sessions:write,billing:read
```

| Flag | Description |
| - | - |
| `--name` | Human-readable label (required). |
| `--scopes` | Comma-separated scope list (required). |

`--scopes` is validated client-side against the shared scope enum, so an unknown scope fails before the request is sent.

### Presets, expiry and budgets (CLI 1.2)

A key for an agent usually needs only the tools, a spend limit and an end date:

```bash theme={"system"}
naive keys create --name my-agent --preset tools --expires 90d --budget-usd 20
```

| Flag | Description |
| - | - |
| `--preset` | `full`, `tools`, `tools_resources` or `read`: a named scope set, in place of `--scopes`. |
| `--expires` | A duration (`90d`, `24h`), an ISO time, or `never`. |
| `--budget-usd` | The most this key may spend per period, in USD. Calls past it answer `402 budget_exceeded`. |
| `--budget-period` | `day` (default), `month` or `total`. |
| `--description` | A note shown in the developer console. |

With only `--name` and `--scopes`, `create` sends exactly the request CLI 1.1 sent. Keys carry no approval rules; what asks a person first is set on the identity ([`naive approvals rules`](https://vetta.sh/docs/cli/developer-platform#approvals)).

> [!WARNING]
>
> The `secret` in the `create` and `rotate` replies exists nowhere else. It is not stored in retrievable form and no route returns it again. Capture it now or mint another key.

## list

```bash theme={"system"}
naive keys list --limit 2
```

```json theme={"system"}
{
  "data": [
    {
      "id": "key_gwpjrs1egky00g6vw5gjczj6fs",
      "object": "api_key",
      "name": "ci",
      "prefix": "sk_test_pdme",
      "scopes": ["agents:write", "agents:read", "sessions:write", "billing:read"],
      "created_by": { "type": "key", "id": "key_66nnedy98yfx3ygzssfv99p7tf" },
      "last_used_at": null,
      "created_at": "2026-08-22T23:56:53.464Z"
    }
  ],
  "has_more": true,
  "next_cursor": "key_m3jjzgc4zsffsnqhvwwf28m9d1"
}
```

`prefix` is the 12-character display prefix — the same value `naive whoami` reports as `key_prefix`, and the only part of a secret that is ever readable. `last_used_at` is `null` for a key that has never authenticated a request, which makes unused keys easy to find:

```bash theme={"system"}
naive keys list --limit 100 | jq -r '.data[] | select(.last_used_at == null) | .id'
```

| Flag | Description |
| - | - |
| `--limit` | Page size. |
| `--after` | Cursor from a previous page's `next_cursor`. |

## show & update

```bash theme={"system"}
naive keys show key_gwpjrs1egky00g6vw5gjczj6fs
naive keys update key_gwpjrs1egky00g6vw5gjczj6fs --budget-usd 5 --budget-period month
```

`update` takes `--name`, `--description`, `--scopes`, `--preset`, `--expires`, `--budget-usd` and `--budget-period`. A key may only narrow itself (fewer scopes, earlier expiry, lower budget); widening needs a signed-in owner or admin.

## rotate & revoke

```bash theme={"system"}
naive keys rotate key_gwpjrs1egky00g6vw5gjczj6fs
naive keys revoke key_gwpjrs1egky00g6vw5gjczj6fs
```

Both take the key id as a positional argument. `rotate` also takes `--grace`:

```bash theme={"system"}
naive keys rotate key_gwpjrs1egky00g6vw5gjczj6fs --grace 1d
```

`--grace` (up to `7d`) keeps the old secret working for that long, so a deploy can switch over without a failed request. Without it, the old secret stops at once, as before.

`rotate` returns a new secret, once. `revoke` takes effect immediately — in-flight requests holding the old secret start failing with `401`. Both actions are recorded in the [audit log](https://vetta.sh/docs/cli/audit.md) as `api_key.rotated` and `api_key.revoked`.

> [!NOTE]
>
> Test-mode keys (`sk_test_…`) run against the no-real-money seam: sessions execute and the ledger moves, but no charge reaches a payment processor. Check `mode` in [`naive whoami`](https://vetta.sh/docs/cli/auth#whoami) if you are unsure which you hold.


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