Skip to navigation

Create an API key

View as Markdown

Creates an API key of the given type:

  • user-key — Owned by you. Not allowed if your team admin disabled API key creation.
  • scim-key — Owned by you, for SCIM provisioning in your team. Requires the permission to manage SCIM keys, the SCIM feature on your team’s plan, SCIM enabled for the team, and at least one configured SSO authentication method. Use the lifetime property to set how many days the key is valid.
  • service-account-key — Owned by the service account in the serviceAccountId property. Requires the permission to manage service accounts and the service accounts feature. The service account must belong to your team. If the service account is a Super Admin, you must be a Super Admin too.
  • service-account-scim-key — A SCIM key owned by the service account in the serviceAccountId property. Requires everything the service-account-key type requires, plus the permission to manage SCIM keys. The service account must also hold that permission, and the SCIM requirements for scim-key apply. The key is valid for 180 days.

Keys are created with the default API key scopes. On success, this returns an HTTP 201 Created response that includes the key’s full value. This is the only time the API returns the full value, so store it securely. An owner can have at most 30 API keys.

Authentication

x-api-keystring
API Key authentication via header

Request

This endpoint expects an object.
Create User API Key RequestobjectRequired
OR
Create SCIM API Key RequestobjectRequired
OR
Create Service Account API Key RequestobjectRequired
OR
Create Service Account SCIM API Key RequestobjectRequired

Response

Created. The response includes the API key's 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
429
Too Many Requests Error
500
Internal Server Error
503
Service Unavailable Error