Skip to main content
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

create

--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:
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).
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

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:

show & update

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

Both take the key id as a positional argument. rotate also takes --grace:
--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 as api_key.rotated and api_key.revoked.
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 if you are unsure which you hold.