Skip to content

Create an API key

POST
/keys
curl --request POST \
--url https://localhost:3000/api/v1/keys \
--header 'Authorization: <Authorization>' \
--header 'Content-Type: application/json' \
--data '{ "name": "Production Key", "scopes": [ "trigger:hit:*", "trigger:read:*" ] }'

Creates a new API key with the specified scopes. Trigger scopes include trigger:create:* (create triggers only, wildcard target only; implied by trigger:manage:*). The full key is shown only once.

Key details

Media typeapplication/json
object
name
required
string

Example

Production Key
scopes
required
Array<string>

Example

[
"trigger:hit:*",
"trigger:read:*"
]

Key created (contains the full key)

Media typeapplication/json
object
created_at
required
string format: date-time
id
required
string
key
required

Full key, only shown once

string
name
required
string
scopes
required
Array<string>

Example

{
"created_at": "2024-01-15T10:30:00Z",
"id": "sk_abc123",
"key": "sk_live_abc123xyz789def456...",
"name": "Production Key",
"scopes": [
"trigger:hit:*",
"trigger:read:*"
]
}

Invalid request or scopes

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Unauthorized

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}

Erreur interne

Media typeapplication/json
object
error
required
string
message
string

Example

{
"error": "invalid_request",
"message": "Invalid request body"
}