Scripto docs
View as Markdown

DELETE /api/keys/[id]

Revoke a CLI API key you own. A key owned by someone else, or an unknown id, returns 404 — no existence leak.

This backs the web Settings → API keys → revoke action.

Revokes a CLI API key, but only if it belongs to the authenticated user. A key owned by someone else (or a non-existent id) returns 404, so the existence of another user’s keys is never revealed. Ownership is enforced twice — an explicit referenceId check, then Better Auth’s own server-side check.

Endpoint

DELETE https://scripto.codika.io/api/keys/{id}

Auth

Session (web).

Response (200)

{ "success": true, "data": { "id": "key_…", "revoked": true } }

Errors

HTTPcodeCause
400invalid-argumentMissing key id.
401unauthenticatedNot signed in.
404not-foundNo such key, or you don’t own it.
500internalBackend error.

Revocation is immediate; the revoked key fails its next request with unauthenticated.

Next