Skip to content

Create an API key

POST
/keys
curl --request POST \
--url https://example.com/api/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "default" }'

Creates a new API key. The full plaintext key is returned only once in the response.

Media type application/json
object
name

Friendly name for the key

string
default: default
Example
my-ci-key

Newly created key (plaintext returned only once)

Media type application/json
object
id
required
string format: uuid
key
required

Full plaintext API key (only returned on creation)

string
Example
ah_k_abc123def456
prefix
required
string
Example
ah_k_abc1
name
required
string
Example
my-ci-key

Not authenticated

Media type application/json
object
error
required

Human-readable error message

string
code

Stable machine-readable error code for client branching

string
fieldErrors

First validation message per field path

object
key
additional properties
string
issues

Structured validation issues (Zod)

Array<object>
object
path
required
string
message
required
string
retryAfter

Seconds until rate limit resets (429 responses)

number
reconnect

True if re-linking GitHub may fix the issue

boolean

Server error

Media type application/json
object
error
required

Human-readable error message

string
code

Stable machine-readable error code for client branching

string
fieldErrors

First validation message per field path

object
key
additional properties
string
issues

Structured validation issues (Zod)

Array<object>
object
path
required
string
message
required
string
retryAfter

Seconds until rate limit resets (429 responses)

number