Create Api Key
const url = 'https://example.com/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","expires_at":"2026-04-15T12:00:00Z","scope":"full"}'};
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/admin/api-keys/ \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "user_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "expires_at": "2026-04-15T12:00:00Z", "scope": "full" }'Create an API key for a user (admin only).
The raw key is returned only in this response and cannot be retrieved again. Requires a signed-in session: a request that presents an API key gets 403.
Authorizations
Section titled “ Authorizations ”Request Bodyrequired
Section titled “ Request Bodyrequired ”object
ID of the user the new API key will belong to.
Human-readable label for the API key (e.g. ‘CI pipeline’, ‘QGIS desktop’).
Privilege scope. ‘full’ impersonates the owner completely. ‘read_only’ authenticates GET, HEAD and OPTIONS requests only; any other method is refused with 403. A service-account key minted for an application is the usual case for ‘read_only’.
Responses
Section titled “ Responses ”Successful Response
object
The API key secret (shown only once)
Non-secret key identifier (prefix and last four characters)
Privilege scope: ‘full’, ‘read_only’, ‘dataset_write’ (reads and writes the features of the dataset in dataset_id, and nothing else), or ‘dataset_append’ (only creates features in that dataset)
Example generated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "key": "example", "fingerprint": "example", "name": "example", "expires_at": "2026-04-15T12:00:00Z", "scope": "example", "dataset_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "created_at": "2026-04-15T12:00:00Z"}Bad request — invalid query parameters or payload
Unauthorized — missing or invalid credentials
Forbidden — caller lacks access to this resource
Not found
Conflict — resource state prevents the operation
Validation error
Too many requests — retry after the advertised interval
Headers
Section titled “ Headers ”Seconds until the request may be retried
Internal server error
Service unavailable — the database could not serve the request