Skip to content
getgeolens.com

Aggregate Endpoint

POST
/datasets/{dataset_id}/aggregate/
curl --request POST \
--url https://example.com/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/aggregate/ \
--header 'Content-Type: application/json' \
--data '{ "filter": {}, "bbox": [ 1 ], "op": "count" }'

Compute one exact aggregate over a dataset’s rows, for a widget.

Anonymous callers can read public, published datasets; X-Embed-Token authorizes datasets in the token’s scope. Other datasets return 404.

With bbox, a view the planner expects to hold more than 500,000 rows is refused with 422 and the code too_wide rather than approximated. A bbox that contains the whole dataset is answered as the whole layer. Refusals carry a code in detail: too_wide, invalid_column, invalid_filter, no_geometry, query_timeout, query_data_error, result_too_large, and with 429 query_busy (this caller already has two aggregates running) or query_at_capacity.

Clients should keep at most two requests in flight per caller and retry a 429 after 200-400 ms with jitter.

dataset_id
required
Dataset Id
string format: uuid
X-Embed-Token
Any of:
string

Optional embed token. Datasets in the token’s scope are authorized even without user credentials (embed viewers).

Media type application/json
One of: discriminator: op
CountRequest
object
filter
Any of:
object
key
additional properties
any
bbox
Any of:
Array<number>
>= 4 items <= 4 items
op
required
Op
string
Allowed value: count

Successful Response

Media type application/json
One of: discriminator: op
CountResponse
object
approximate
Approximate

Always false: a view too wide to count exactly is refused.

boolean
cached
required
Cached
boolean
op
required
Op
string
Allowed value: count
result
required
CountResult
object
count
required
Count
integer

Example

{
"approximate": false,
"op": "count"
}

Bad request — invalid query parameters or 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"
}

Unauthenticated — a credential was supplied and could not be resolved (expired, revoked, or malformed). Sending no credential at all is not an error on these operations; they answer anonymously with the public subset. Neither is sending an unresolvable credential alongside a valid X-Embed-Token that authorizes the request on its own. That request is served and the unrelated credential is ignored.

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 access to this resource

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"
}

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"
}