VocalDocscontracts 1.65.0

Revoke an API key

POST /v1/api-keys/{key_id}/revoke

PropertyValue
Operationrevoke_api_key
GroupAPI keys
Scopeapi_keys:write
Route classcontrol
IdempotencyIdempotency-Key accepted: a retry with the same key replays the first answer
AuditAudited identity.api_key.revoke (mutation)
Released in1.19.0
Phase 0 hostServed (the hosted api pins 1.65.0)

Revokes an API key of the caller's Organization. Every api instance refuses the key within 5 seconds (target), because the verified-key cache lives at most 3 seconds, and the key stays readable with status: revoked and revoked_at for the audit trail. Revoking a key that is already revoked or expired changes nothing and answers it as it stands. Session only (api.md section 2): the api refuses the route to every API key; Phase 0 accepts a Member ID token, so a Member signed in to the cockpit with api_keys:write makes the write.

Request

Set VOCAL_API to the base URL of your API and VOCAL_API_KEY to an API key with the api_keys:write scope (Authentication and keys). Replace each placeholder, such as agt_... or <name>, with your own value.

curl -X POST "$VOCAL_API/v1/api-keys/key_.../revoke" \
  -H "Authorization: Bearer $VOCAL_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"

Parameters

NameInTypeRequiredDescription
key_idpathApiKeyIdyesThe id of an API key: key_ and the row's UUIDv7 in 26 Crockford base32 characters. Opaque and safe to log.
idempotency-keyheaderstringnoA client-chosen key, kept 24 hours per Organization, environment and route. A replay returns the stored response.

Responses

StatusContent typeShapeError codes
200application/jsonApiKey
400application/jsonErrorEnvelopeinvalid_request
401application/jsonErrorEnvelopeunauthenticated
403application/jsonErrorEnvelopeforbidden, org_suspended
404application/jsonErrorEnvelopenot_found
409application/jsonErrorEnvelopeidempotency_in_progress, idempotency_key_reused
429application/jsonErrorEnveloperate_limited
500application/jsonErrorEnvelopeinternal_error

Fields of the 200 answer

The shape is ApiKey.

FieldTypeRequiredDescription
created_atTimestampyes
created_byActorRef or nullnoWho made the key (1.52.0): {type: member, id} for a key created through POST /v1/api-keys, {type: operator, id} for one the seed or an operator command made when the api records it, and null when it does not. Absent from an api before 1.52.0. A removed Member keeps its id here; the keys it made stay.
environmentEnvironmentyes
expires_atTimestamp or nullyes
idApiKeyIdyes
last_used_atTimestamp or nullyes
namestringyes
object"api_key"yes
prefixstringyesThe non-secret start of the key, vk_<env>_<lookup>; the full key is vk_<env>_<lookup>_<secret>.
revoked_atTimestamp or nullyes
scopesarray of ApiKeyScopeyes
statusApiKeyStatusyes