Skip to main content
POST
Create an API key

Authorizations

Authorization
string
header
required

Session token from signing in, sent as Authorization: Bearer <token>.

Path Parameters

workspace_id
string
required

The workspace id (a UUID).

Body

application/json
name
string
required

Key name, 1 to 255 characters; unique within the workspace.

expires_at
string<date-time> | null

When the key stops working. Omit for no expiry.

spendLimit
null | object

Spending limit for the key. Omit for no limit.

Response

The new key, including its secret.

An API key.

created_at
string<date-time>
required
created_by_user_id
string
required

The user who created the key.

id
string
required

The key's id (a UUID).

is_active
boolean
required

Whether the key can be used.

key_prefix
string
required

The first characters of the key, for recognizing it.

workspace_id
string
required

The workspace the key belongs to.

deleted_at
string<date-time> | null
expires_at
string<date-time> | null

When the key stops working, if it expires.

key
string | null

The full secret key, beginning with sk-. It is returned only in the response that creates the key and cannot be retrieved again; store it securely.

last_used_at
string<date-time> | null

When the key was last used, if ever.

name
string | null

The key's name.

spend_limit
null | object

The spending limit, if one is set.

usage
null | object

Spend so far, where reported.