Skip to navigation

Roll API key

Mints a new API key and parks the current one as a previous key with its own grace window (default 48 hours). The previous key remains valid until its expires_at, so deployments can rotate credentials without downtime.

Security

The api_key must be supplied in the request body. Passing it as a query-string parameter returns 400 — query-string credentials leak into access logs, CDN logs, browser history, and Referer headers, which is unacceptable on a credential-minting endpoint.

Rate limiting

Rolls are rate-limited per user. If you roll too frequently the response is 429 with a Retry-After header and a retry_after_seconds field in the JSON body.

Request

This endpoint expects an object.
api_keystringRequired

Your current API key. Must be supplied in the request body. Passing it via query string returns 400 — query-string credentials leak into access logs, CDN logs, browser history, and Referer headers.

expires_in_hoursintegerOptional>=1Defaults to 48

Grace period (in hours) for the rolled-away key before it expires. Defaults to 48 hours and is clamped to a maximum of 48 hours.

Response

New API key minted; previous key parked with its grace window.

api_keystringOptional

The newly-minted API key. Store this — plaintext is not returned again.

recommended_rotation_datedatetimeOptional

Recommended rotation date for the new key — two months after the roll. It is a reminder, not an expiry: the key keeps working after this date until you roll it.

previous_api_key_expires_atdatetimeOptional

When the just-parked previous key will stop being accepted.

Errors

400
Bad Request Error
401
Unauthorized Error
429
Too Many Requests Error