Skip to content

Create a new API key

POST
/api/v1/admin/api-keys
curl --request POST \
--url https://example.com/api/v1/admin/api-keys \
--header 'Content-Type: application/json' \
--header 'X-Label-Hub-Key: <X-Label-Hub-Key>' \
--data '{ "allowed_printer_ids": [ "example" ], "expires_at": "2026-04-15T12:00:00Z", "name": "example", "notes": "example", "rate_limit_per_minute": 60, "scopes": [ "example" ] }'

Creates a new API key. The plaintext field in the response is the full key — it is shown ONCE and never stored. Copy it before closing this response. Subsequent GETs return only the prefix.

Media typeapplication/json
ApiKeyCreate
object
allowed_printer_ids
Allowed Printer Ids
Array<string>
expires_at
Expires At
Any of:
string format: date-time
name
required
Name
string
notes
Notes
Any of:
string
rate_limit_per_minute
Rate Limit Per Minute
integer
default: 60 >= 1 <= 10000
scopes
required
Scopes
Array<string>

Successful Response

Media typeapplication/json
ApiKeyCreateResponse

Returned ONCE on creation — includes plaintext. Never return again.

object
key_id
required
Key Id
string format: uuid
name
required
Name
string
plaintext
required
Plaintext
string
prefix
required
Prefix
string
scopes
required
Scopes
Array<string>

Example generated

{
"key_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"name": "example",
"plaintext": "example",
"prefix": "example",
"scopes": [
"example"
]
}

Validation Error

Media typeapplication/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationError
object
ctx
Context
object
input
Input
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string

Example generated

{
"detail": [
{
"ctx": {},
"input": "example",
"loc": [
"example"
],
"msg": "example",
"type": "example"
}
]
}