Docs/API reference/POST /api/v1/keys
POST/api/v1/keys
Programmatically create a new API key. The raw value is returned exactly once in the response — store it immediately.
Request
A management key is required: create it in the dashboard with Allow key management (keys:write) checked. Other keys get 403 forbidden. Pass a human-readable name (1–50 characters) in the body. Keys created through the API never get keys:write, so a management key cannot copy itself. An account can have up to 20 active keys; beyond that you get 409 too_many_keys.
HTTP
POST https://api.varmir.com/api/v1/keys
Authorization: Bearer <MANAGEMENT_KEY>
Content-Type: application/json
{ "name": "Production server" }Response
The raw_key field is the only place you can read the full token. Subsequent GETs only return the prefix.
{
"id": "key_8f3a2c",
"name": "Production server",
"prefix": "mstk_lfQZYRA",
"scopes": [],
"raw_key": "mstk_lfQZYRAkdXMZ_UyF-n--Tu7eFS6JuayD",
"created_at": "2026-06-12T14:00:00Z"
}