Skip to main content
POST
/
api
/
keys
Create API key
curl --request POST \
  --url http://localhost:8000/api/keys \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "My New Key",
  "scopes": [
    "read"
  ]
}
'
{
  "id": "key_ghi789",
  "name": "My New Key",
  "key": "mk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6",
  "scopes": [
    "read"
  ],
  "created_at": "2025-01-17T15:00:00Z"
}

Authorizations

Authorization
string
header
required

Use your API key as a Bearer token. Example: Authorization: Bearer mk_live_...

Body

application/json

Request body for creating a new API key.

name
string
required

A descriptive name for the API key.

Example:

"My New Key"

scopes
enum<string>[]
required

Permissions to grant to the key. read allows data access; write allows modifications.

Available options:
read,
write
Example:
["read"]

Response

The newly created API key. The full key value is only shown once.

A newly created API key. The full key value is only returned once.

id
string

Unique key identifier.

Example:

"key_ghi789"

name
string

Human-readable name for the key.

Example:

"My New Key"

key
string

The full API key value. Store this securely -- it will not be shown again.

Example:

"mk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"

scopes
enum<string>[]

Permissions granted to this key.

Available options:
read,
write
created_at
string<date-time>

When the key was created.