VideohatiDocs
API referenceAPI keys

Rotate an API key

Rotate an API key

POST/v1/projects/{projectId}/keys/{keyId}/rotate

This operation supports dashboard session-cookie authentication. Call it only from trusted server code; browsers must not manufacture or expose the session cookie.

Creates a replacement key with the same name and scopes and revokes the old key in the same transaction. Session-cookie auth only. Rate limit: 60 requests per 60 s per session.

Error codes: unauthorized (401), not_found (404), already_revoked (409), key_generation_failed (500).

Authentication

  • sessionCookie — Dashboard session cookie set by POST /v1/auth/login. Video and playback endpoints additionally require the projectId query parameter under cookie auth.

Parameters

NameInTypeRequiredDescription
projectIdpathstring (Ulid)Yes
keyIdpathstring (Ulid)Yes

Request body

This operation takes no request body.

Responses

StatusMeaning
201Replacement key. Store keyRaw now; it is never shown again.
401No valid credential was presented.
404The resource does not exist or is not visible to this caller.
409The request conflicts with the resource's current state. The per-operation description lists the exact error.code values.
429Rate limit exceeded.
500The server failed to complete the request.