Skip to main content
POST
Create a new API key.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Body to create an API key. Unknown fields return a 400. Send either expires_in_days or the deprecated expires_at, not both.

name
string
required

User-assigned label for the API key. Must be unique per user per organization. Must start with a letter (A-Z or a-z). After that, letters, digits, spaces, hyphens, and underscores are allowed. Leading and trailing whitespace is stripped by the server before saving.

Required string length: 1 - 128
Pattern: ^[A-Za-z][A-Za-z0-9_ -]*$
expires_in_days
integer

Number of days from creation after which the API key expires. Optional — defaults to 3650 (about 10 years) when omitted. Must be between 1 and 36500 (100 years); null is rejected. Use this instead of the deprecated expires_at. (The schema declares no default on purpose: generated clients would pre-fill it and then send it next to expires_at, which is rejected.)

Required range: 1 <= x <= 36500
Example:

365

expires_at
string<date-time>
deprecated

Deprecated in 26.28; removal no earlier than 26.32. Use expires_in_days instead. Until removal, this must be a future timestamp and cannot exceed 100 years from now. If neither field is provided, the key expires 10 years after creation. Cannot be combined with expires_in_days.

Response

API key created successfully. The token field contains the full composite key_id.secret — this is the only time the secret is available.

Response object for standard API responses.

api_version
enum<string>
default:3.0

API version.

Available options:
2.0,
3.0
kind
enum<string>
default:NORMAL

Type of response, indicating a normal response.

Available options:
NORMAL
data
object

Response body for API key creation. Includes the full composite token which is shown only once.