Query

Query, aggregate, and filter the billing data stored inside your tenant programmatically.

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"
}
Language
Credentials
Header
Click Try It! to start a request and see the response here!