Prerequisites
- An API key with
adminorganization access, or the dashboard — see Create an API key - A website id, if you are creating website-scoped keys — see the Quickstart
Scoping strategy
A key’saccess takes one of two shapes:
The
owner role is never grantable to a key. Apply least privilege, especially for agents:
- A content agent for one client site:
websitesscope withcontent_editor. - A site-building agent:
websitesscope withfull_editoron that website. - Fleet automation (creating websites, managing members and keys):
organizationscope withadmin.
1
Create a scoped key
POST /v1/apiKeys requires expiresAt — pass an ISO datetime, or null for no expiry.Create a website-scoped key
Response
401.2
Update name and expiry
PATCH /v1/apiKeys/{apiKeyId} changes metadata without touching the secret:Shorten the expiry
expiresAt returns 409.3
Change a key's access
Sending Every
access to PATCH /v1/apiKeys/{apiKeyId} replaces the key’s grants atomically — there is no partial merge. Widen a client key to a second website, or tighten an organization key down to specific websites:Rescope to two websites
websiteId must belong to the key’s organization, or the call fails with 400. The secret is unchanged, so running integrations keep working under the new scope.4
Rotate the secret
POST /v1/apiKeys/{apiKeyId}/rotate issues a new secret for the same key id and access. The old secret stops authenticating the moment the call returns.Rotate
apiKey metadata with a fresh one-time plaintextKey. Inactive keys cannot rotate (409).5
Revoke a key
POST /v1/apiKeys/{apiKeyId}/revoke disables the key permanently and idempotently:Revoke
revokedAt set. Revocation is the correct end state for offboarded agents — revoked keys stay listed for audit history.6
Audit keys per website
GET /v1/apiKeys?organizationId=... lists every key in the organization with its access. To answer “which keys can touch this client’s website”, pass websiteId instead:List keys scoped to a website
You should see
{ "items": [ { "id": "...", "name": "acme-content-agent", "access": { "kind": "websites", "websiteIds": ["V1StGXR8_Z5jdHi6B-myT"], "role": "content_editor" }, ... } ], "nextCursor": null }. This lists keys with a direct grant on the website; organization-wide keys appear only in the organization listing. Pass exactly one of organizationId or websiteId.Key rotation runbook
For a suspected leak, rotate in place — the leaked secret dies instantly:POST /v1/apiKeys/{apiKeyId}/rotateand capture the newplaintextKey.- Update the secret in your secret manager and redeploy consumers.
- Expect
401s from consumers between steps 1 and 2; they confirm the old secret is dead.
- Create a new key with identical
accessand a dated name. - Roll consumers to the new secret and verify traffic with the old key has stopped.
- Revoke the old key.
Troubleshooting
Next steps
- Authentication for the bearer scheme and key format
- Agent-safe publishing — scoped keys as the agent permission boundary
- Security for key hashing and tenant isolation