Skip to navigation

Rotate an API key

View as Markdown

Replaces the secret of an API key with a newly generated one. The old value stops working immediately; there is no grace period, so update every place that uses the key right after rotating it. The key keeps its id, label, and role, and signing in afterwards returns the new value. The new key is returned once, in apiKey. Store it: later reads only show a preview. Owner keys can rotate any owner key on the account. A member key can rotate only that member’s own key. Find a key’s id with Get the current account; the key making the request is marked current: true.

Authentication

AuthorizationBearer

Your Dial API key, sent as Authorization: Bearer sk_live_...

Path parameters

idstringRequired

Response

The key was rotated. apiKey holds the new value and is shown only here.

idstring
apiKeystring

The new key value. Returned only in this response; store it now.

previewstring
First characters of the new key, as later reads will show it.
createdAtdatetime
When the key was first created. Rotation does not change it.
rotatedAtdatetime
When this rotation happened.
labelstring or nullOptional

Errors

401
Unauthorized Error
403
Forbidden Error
404
Not Found Error