Skip to content
getgeolens.com

Create Api Key

POST
/admin/api-keys/
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.

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
>= 1 characters <= 255 characters
Example generated
{
"user_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"name": "example"
}

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>
ValidationError
object
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": {}
}
]
}