Skip to content
Endless Documentation
Reports

Query a usage report

POST
/reports/query

Query a usage report.

Authorization

headerAuthorizationBearer <esk_live_…>

A workspace API key created in workspace settings. It acts as the member who created it, narrowed to its abilities, projects and credit limit. Each operation names the ability it needs.

Scope: reports:read

Header Parameters

Endless-Api-Version?string

Pin the caller to an API major (1). Omit to accept the current version. A major this deployment cannot serve is refused with 400 unsupported_api_version.

Request Body

application/json
  1. body
organization_ids*array<>

The workspaces the report covers, by id. The caller must be a member of every one.

Items1 <= items <= 100
metrics*array<>

The first metric orders a ranking and a breakdown.

Items1 <= items
group_by?string
Default"none"
Value in"none""day""week""month""user""workspace""team""feature""model""variant""output_type""status""provider""source""credit_type""channel""tool"
period*|||
timezone?string

Day, week and month buckets and the period edges use this zone.

Default"UTC"
filters?
Default{}
limit?integer

Rows in a ranking or a breakdown.

Range1 <= value <= 100
Default10

Response Body

OK

application/json
  1. response
audience*|array<>

Whose usage the report counted: each workspace by id, name and slug. user_ids: null = every member of that workspace; a list = only those people.

period*
result*|||
Example Request
curl -X POST 'https://api.endless.app/reports/query' \  -H 'Content-Type: application/json' \  -d '{  "organization_ids": [    "string"  ],  "metrics": [    "credits_spent"  ],  "period": {    "kind": "last_days",    "days": 1  }}'
Example Response
{  "audience": "all",  "period": {    "from": "2019-08-24T14:15:22Z",    "to": "2019-08-24T14:15:22Z",    "timezone": "string",    "earlier_cycle": true  },  "result": {    "shape": "kpi",    "values": {      "property1": 0,      "property2": 0    }  }}