View as Markdown

Rolling and expiry

Replace a key on a schedule, or straight away, without dropping requests.

Rolling a key

Rolling issues a new key with the same name, type and scopes, and keeps the old key working for 24 hours.

  1. In the dashboard open Developers › API keys and choose Roll on the key.
  2. Copy the new key. It is shown once.
  3. Deploy the new key.
  4. The old key stops by itself after 24 hours. You can end the overlap early by revoking it.

The endpoint behind the button is POST /api/v1/api-keys/{id}/roll. It returns the new secret and old_key_expires_at, and takes an optional overlap_hours from 0 to 24 (0 stops the old key at once). Like all key management it needs a signed-in session: an API key answers 403.

A key can be rolled once. Rolling it again answers 409 already_rolled: roll its replacement instead. A revoked or expired key cannot be rolled; create a new one.

The new key gets a fresh 90-day lifetime, or never expires if the old one never did.

Default expiry

A new key expires after 90 days unless you choose 30 days, 1 year, a custom date or never. The default is applied on the server. A publishable key never expires unless you give it a date, because it is embedded in public pages.

Seven days before a key expires we email your owners and admins and send the api_key.expiring event. Roll the key when you receive it.

Leaked keys

On this page