Skip to content

Create (or replace) an API key

PUT
/v1/user/{user}/apikey/{name}
curl --request PUT \
--url https://example.com/v1/user/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/apikey/example \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "label": "example", "expiry": "2026-04-15T12:00:00Z" }'

Mints a new API key under the given name and returns the plaintext once. A user may manage their own keys; acting on another user requires user:credential:write on their owner scope.

user
required
string format: uuid

Target user UUID (use your own, from GET /v1/me, to manage your keys).

name
required
string

Credential id for the key; reusing a name overwrites that key.

Media typeapplication/json
object
label
string
expiry

Optional expiry; omit for a non-expiring key.

string format: date-time
Examplegenerated
{
"label": "example",
"expiry": "2026-04-15T12:00:00Z"
}

Key minted; plaintext returned once

Media typeapplication/json

The plaintext api_key is returned only here, exactly once.

object
success
required
boolean
credential_id
required

Echoes the {name} path segment.

string
api_key
required
string
label
string
expiry
string format: date-time
Examplegenerated
{
"success": true,
"credential_id": "example",
"api_key": "example",
"label": "example",
"expiry": "2026-04-15T12:00:00Z"
}

Error response

Media typeapplication/problem+json

RFC 7807 Problem Details

object
type

Problem type slug URI

string
title
string
status
integer
detail
string
key
additional properties
any
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example"
}