Query

Analytics

Ternary's Analytics API puts you in control of your data and lets you make queries against the billing dataset you have ingested to Ternary. This endpoint is the primary endpoint for doing so.

Minimally, you must select a measure such as Billed Cost, and a time period. You will then see values of your measure over that time period according to the granularity you select. Then, by selecting one or more dimensions, the measure will be summed and grouped by the unique dimensional values, still over the time period. Finally, you may filter the results, including only rows with certain dimensions and their values matching your specified filter.

To view a list of available measures and dimensions for filtering, use the Fetch Metadata endpoint first, then use the string values in the response as the values inside this request.

Here's an example query payload for Billed Cost per day in the time range of April 30, 2025 until May 30, 2025, grouped by Service Category.

{
  "data_source": "FOCUS_BILLING",
  "dimensions": [
    "FOCUS_SPEC_FIELD/ServiceCategory"
  ],
  "measures": [
    "FOCUS_SPEC_FIELD/BilledCost"
  ],
  "start_time": "2025-04-30T00:00:00.000Z",
  "end_time": "2025-05-30T23:59:59.999Z"
}
Query Params
string
required

A unique identifier for an organization

Body Params

Payload to specify requested data

string

Response currency for supported measures.

string

Data source

dimensions
array of strings

Data attributes for grouping and filtering

dimensions
string

End time period to include data

boolean

Data exportable

integer

Limit data counts

measures
array of strings

Data measures to be aggregated

measures
string

Pagination token provided in previous response.

integer

Data offset

order_by
array of objects

Data ordering by field and direction

order_by
post_agg_filters
array of objects

Post aggregation

post_agg_filters
pre_agg_filters
array of objects

against base table expression

pre_agg_filters
string
enum

Determines the granularity of produced report data

Allowed:
string

Response format

string

Start time period to include data

Responses

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json