Gallery Platform API
Reference

Aggregate objects

Counts, sums or averages one declared type's records, grouped by up to three declared properties and narrowed by the type's own list filters. The rows are the ones the type's list returns to this caller, so drafts it cannot see, other galleries and anything access rules hide are never counted. A key needs the scopes of the type's named list: `artworks:read` and `artists:read` for `artwork`, `locations:read` for `location`, `contacts:read` for `party`, `artists:read` for `artist`, `shows:read` for `booth`, `artworks:update` and `contacts:read` for `hold`; without them the answer is 403. Refusals answer 400 with `details.reason`: `withheld` for a withheld property, `restricted` for a property the caller's role cannot read, `hidden_from_key` for a field a read-only key's reads hide, `not_numeric` for a sum or average over a non-numeric property, `currency_required` for a money sum not grouped by its currency, `unknown_type`, `not_readable` for a type with no list read, `unknown_property`, `not_groupable`, `unknown_filter`, `invalid_filter`, `duplicate`, and `group_restricted` for a party property outside `kind`, `contact_type`, `lead_status` and `do_not_email`, since a party's text values are never group keys, for an artist property other than `visibility`, for a booth property other than `show_id`, `hall` and `sector`, and for a hold property other than `artwork_id`, `party_id`, `ends_on` and `released_reason`. A scan reads a bounded number of rows; `capped` says when a cap cut the answer.

POST
/gallery/objects/aggregate

Counts, sums or averages one declared type's records, grouped by up to three declared properties and narrowed by the type's own list filters. The rows are the ones the type's list returns to this caller, so drafts it cannot see, other galleries and anything access rules hide are never counted. A key needs the scopes of the type's named list: artworks:read and artists:read for artwork, locations:read for location, contacts:read for party, artists:read for artist, shows:read for booth, artworks:update and contacts:read for hold; without them the answer is 403. Refusals answer 400 with details.reason: withheld for a withheld property, restricted for a property the caller's role cannot read, hidden_from_key for a field a read-only key's reads hide, not_numeric for a sum or average over a non-numeric property, currency_required for a money sum not grouped by its currency, unknown_type, not_readable for a type with no list read, unknown_property, not_groupable, unknown_filter, invalid_filter, duplicate, and group_restricted for a party property outside kind, contact_type, lead_status and do_not_email, since a party's text values are never group keys, for an artist property other than visibility, for a booth property other than show_id, hall and sector, and for a hold property other than artwork_id, party_id, ends_on and released_reason. A scan reads a bounded number of rows; capped says when a cap cut the answer.

Authorization

AuthorizationBearer <token>

A gallery API key, sent as Authorization: Bearer gpk_… (or the x-api-key header).

In: header

Scope: artworks:read

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

application/problem+json

{  "type": "artwork",  "group_by": [    "string"  ],  "measures": [    "string"  ],  "groups": [    {      "key": {        "property1": null,        "property2": null      },      "values": {        "property1": 0,        "property2": 0      }    }  ],  "matched": -9007199254740991,  "method": "count",  "scanned": -9007199254740991,  "caps": {    "rows": -9007199254740991,    "groups": -9007199254740991  },  "capped": {    "rows": true,    "groups": true  }}