Create a new API key
POST
/api/v1/admin/api-keys
const url = 'https://example.com/api/v1/admin/api-keys';const options = { method: 'POST', headers: {'X-Label-Hub-Key': '<X-Label-Hub-Key>', 'Content-Type': 'application/json'}, body: '{"allowed_printer_ids":["example"],"expires_at":"2026-04-15T12:00:00Z","name":"example","notes":"example","rate_limit_per_minute":60,"scopes":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Abschnitt betitelt „Authorizations“Request Bodyrequired
Abschnitt betitelt „Request Bodyrequired“Media typeapplication/json
Responses
Abschnitt betitelt „Responses“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>
ValidationErrorobject
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" } ]}