Skip to navigation

Rotate an API key

View as Markdown

Generates a new secret for the API key in the id property. The key keeps its ID, name, and owner. Rotation clears the key’s revoked state and resets its expiresAt property.

You can rotate:

  • user-key — Your own keys. Not allowed if your team admin disabled API key creation.
  • scim-key — Your team’s SCIM keys, if you can manage SCIM keys.
  • service-account-key — Keys of service accounts in your team, if you can manage service accounts. A Super Admin service account’s keys require a Super Admin.
  • service-account-scim-key — SCIM keys of service accounts in your team. Requires the service account requirements above and the permission to manage SCIM keys.

The existing secret keeps working for 6 hours after rotation, so you can roll out the new key. To make the existing secret stop working immediately, set revokeExisting to true. You must set it to true to rotate a revoked key.

On success, this returns an HTTP 201 Created response that includes the new full key value. This is the only time the API returns it, so store it securely.

Authentication

x-api-keystring
API Key authentication via header

Request

This endpoint expects an object.
idstringRequiredformat: "^[a-zA-Z0-9]+$"
The ID of the API key to rotate.
revokeExistingbooleanOptionalDefaults to false

If true, the existing secret stops working immediately instead of after 6 hours. You must set this to true to rotate a revoked key.

Response

Created. The response includes the rotated API key's new full value, which you cannot retrieve again.
idstring
The API key's ID.
namestring
The API key's name.
typeenum
The API key's type.
Allowed values:
versionenum

The API key’s version. Both SCIM key types use scim.

Allowed values:
ownerobject

A user. By default, only the id property is returned. If you set populateUsers to true, the name, username, email, and profilePic properties are also returned. These properties are null if the user cannot be found.

createdByobject or null

The user who created the key. For user-key and scim-key keys, this is the same as owner. For the service account key types, this is the admin who created the key. This value is null if the system did not record who created it.

enabledboolean
If true, the key is enabled.
revokedboolean
If true, the key is revoked. The API returns an expired key as revoked.
revocationobject or null

Why the key was revoked. This value is null unless revoked is true.

createdAtdatetime
The date and time at which the key was created.
accessedAtdatetime or null

The date and time at which the key was last used. This value is null if the key has never been used.

expiresAtdatetime or null

The date and time after which the key expires. This value is null if the key does not expire.

keystring
The full API key. The API only returns this value in the create and rotate responses. You cannot retrieve it again.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error