Create Api Key
POST
/admin/api-keys/
const url = 'https://example.com/api/admin/api-keys/';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"user_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","name":"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/admin/api-keys/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "user_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example" }'Create an API key for a user (admin only).
The raw key is returned only in this response and cannot be retrieved again.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ” Media type application/json
AdminApiKeyCreateRequest
object
user_id
required
User Id
ID of the user the new API key will belong to.
string format: uuid
name
required
Name
Human-readable label for the API key (e.g. ‘CI pipeline’, ‘QGIS desktop’).
string
Example generated
{ "user_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example"}Responses
Section titled “ Responses ”Successful Response
Media type application/json
ApiKeyCreateResponse
object
id
required
Id
string format: uuid
key
required
Key
The API key secret (shown only once)
string
name
required
Name
string
created_at
required
Created At
string format: date-time
Example generated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "key": "example", "name": "example", "created_at": "2026-04-15T12:00:00Z"}Validation Error
Media type application/json
HTTPValidationError
object
detail
Detail
Array<object>
ValidationErrorobject
loc
required
Location
Array
msg
required
Message
string
type
required
Error Type
string
input
Input
ctx
Context
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}