Skip to Content
Open Retainer
Records

Aggregate matching records

POST
/v1/objects/{object}/aggregate

Requires the read scope.

Authorization

bearerAuth
headerAuthorizationBearer <token>

A workspace API key.

Path Parameters

object*string

Object API name.

Request Body

application/json
  1. body
search?string

Keywords within this object only, matched by Postgres full-text search over its label and searchable fields. Every word must match, as a whole word or the start of one ("Dan" finds "Dana"); accents are ignored.

Length1 <= length <= 500
filter?
aggregates?array<>
Itemsitems <= 50
Default[]
groupBy?string

A filterable select field: also compute the total and aggregates per option.

Response Body

Successful response.

application/json
  1. response
total*integer
Range-9007199254740991 <= value <= 9007199254740991
values*array<>
groups?array<>
Example Request
curl -X POST 'https://retainer.tamloot.cc/v1/objects/company/aggregate' \  -H 'Authorization: Bearer YOUR_WORKSPACE_API_KEY' \  -H 'Content-Type: application/json' \  -d '{  "aggregates": [    {      "field": "amount",      "op": "sum"    }  ]}'
Example Response
{  "total": -9007199254740991,  "values": [    {      "field": "string",      "op": "countEmpty",      "value": 0,      "mixedCurrencies": true    }  ],  "groups": [    {      "value": "string",      "total": -9007199254740991,      "values": [        {          "field": "string",          "op": "countEmpty",          "value": 0,          "mixedCurrencies": true        }      ]    }  ]}