Skip to content
getgeolens.com

Create Dataset Api Key

POST
/datasets/{dataset_id}/api-keys
curl --request POST \
--url https://example.com/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/api-keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "expires_at": "2026-04-15T12:00:00Z", "scope": "dataset_write" }'

Create a key that reaches only this dataset’s features.

A dataset_write key, the default, authenticates the dataset’s feature routes and OGC API Features items. A dataset_append key authenticates only POST /datasets/{dataset_id}/features/, so it can add features but not read, change or delete them. Either is treated as an invalid key everywhere else. The key acts as the caller, so the caller’s own access to the dataset still applies to every request it makes. Its feature writes go through even when the instance has dataset editing switched off. It must expire within 365 days. Requires write access to the dataset, the edit_metadata permission the feature writes need, and a signed-in session. A dataset that can’t take feature edits (no feature table or no geometry column) gets 422. A dataset holds at most 100 keys that aren’t revoked, expired ones included; minting past that gets 409 until one is revoked. The raw key is returned only in this response.

dataset_id
required
Dataset Id
string format: uuid
Media type application/json
DatasetApiKeyCreateRequest
object
name
required
Name

Human-readable label for the API key

string
>= 1 characters <= 255 characters
expires_at
required
Expires At

Expiry timestamp (RFC 3339, timezone-aware), in the future and at most 365 days away. Expired keys stop authenticating.

string format: date-time
scope
Scope

‘dataset_write’ reads and writes the dataset’s features. ‘dataset_append’ only creates features, one or a FeatureCollection per request, and can’t read, change or delete them.

string
default: dataset_write
Allowed values: dataset_write dataset_append

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
fingerprint
required
Fingerprint

Non-secret key identifier (prefix and last four characters)

string
name
required
Name
string
expires_at
Any of:
string format: date-time
scope
required
Scope

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)

string
dataset_id
Any of:
string format: uuid
created_at
required
Created At
string format: date-time

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 payload

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Unauthorized — missing or invalid credentials

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Forbidden — caller lacks write access

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Not found

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Conflict — resource state prevents the operation

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Validation error

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Too many requests — retry after the advertised interval

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}
Retry-After
integer

Seconds until the request may be retried

Internal server error

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}

Service unavailable — the database could not serve the request

Media type application/problem+json
ProblemDetail
object
type
Type
string
default: about:blank
title
required
Title
string
status
required
Status
integer
detail
required
Any of:
string

Example

{
"detail": "Dataset not found",
"status": 404,
"title": "Not Found",
"type": "about:blank"
}