Rotate API Key

Beta
POST/v1/auth/api-keys/{id}/actions/rotate

Idempotent with Idempotency-Key header. Learn more

Rotates an API key by revoking the existing key and issuing a replacement with the same name, role, and expiration (unless overridden).

The secret key is returned once and cannot be retrieved later, so you should store it securely. We provide some recommendations on how you can manage your API keys.

idstring

API key ID to rotate.

include[]optional arrayenumValues:rolerole.permissions

Sub-objects to expand in the response. When omitted, sub-objects are returned as null.

expires_atoptional string (date-time)

Expiration timestamp override. If omitted, the previous key's expiration is used.

objectstringenumValues:created_api_key

Resource type identifier.

api_key_secretstring

Full secret value. Returned once and cannot be retrieved later. Learn more about managing your API keys.

api_key_infoobject

API key metadata.

idstring

API key ID.

objectstringenumValues:api_key

Resource type identifier.

namestring

Human-readable name for the API key.

redacted_valuestring

Redacted key value safe for display.

roleobjectExpandablenullable

Assigned role.

idstring

Role ID.

objectstringenumValues:role

Resource type identifier.

namestring

Display name.

typestringenumValues:adminuserscanner

Role type code.

The role's type is sometimes used to gate special behaviors in the frontend and to restrict some actions to only certain types of roles. For example, only roles with the type admin can create and manage API keys.

ownerobjectnullable

Owner of this resource.

Always returned as null in this endpoint.
permissionsarray of stringExpandablenullable

Permissions in {domain}:{action} format.

created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last updated timestamp.

created_atstring (date-time)

Creation timestamp.

updated_atstring (date-time)

Last updated timestamp.

last_used_atstring (date-time)nullable

Last used timestamp.

expires_atstring (date-time)nullable

Expiration timestamp.

revoked_atstring (date-time)nullable

Revocation timestamp.

Responses

201

Successful response for Rotate API Key