Get Cost and Usage

📘

Pagination information

When there is additional information to show, the nextToken field will be included in the response.
The value should be used in the token parameter of the next call.


Data source - cloud, Kubernetes or both

Define the data scope of your query by using the filter costglobaltype.
*Mentioned below in the body param as well

ScopeSendReturns
Cloud Onlyfilters[costglobaltype]=cloudCloud charges. Kubernetes rows are filtered out.
K8s Onlyfilters[costglobaltype]=k8sKubernetes charges only.
Cloud + K8somit the filterBoth. This is the default.

Measures - cost, usage, rate and unit-economics KPIs

MeasureWhat to sendWhat to read
CostcostType=cost&costType=discount - the defaulttotal_cost
Usagefilters[quantitytype]=Hours to pin the unit (optional)total_usage_quantity
Rate - cost per unitisRateUsageBased: true + filters[quantitytype]total_cost ÷ total_usage_quantity
Rate - usage per usageisRateUsageBased: true + two quantitytype valuestotal_usage_quantity_secondary ÷ total_usage_quantity
Unit-economics KPIunitEconomics: {"type":"kpi","value":"<kpiId>"}total_cost - carries the KPI value
Pipeline metricunitEconomics: {"type":"metric","value":"<pipelineId>-<metricColumn>"}total_cost - carries the metric value


Unit economics on the POST form

unitEconomics names what to measure in place of cost, and the dimensions of the pipeline behind it become available to groupBy and to every filter family.

FieldTypeNotes
typestringmetric - a single pipeline metric;
kpi - a saved KPI;
kpi_preview- an inline formula, nothing saved.
valuestringFor metric, <pipelineId>-<metricColumn>, e.g. pipe_1d6ba6230251-m_3. For kpi, the KPI id.


Body Params
string
required

Start of the range.
Example: 2026-04-16

string
required

Must be on or after startDate. The span may not exceed 36 months.
Example: 2026-08-16

string
required

Granularity.
Values: day, week, month, quarter, year

string

Dimension(s) to group by (Two levels maximum).
Example: ["service", "usagedate"]

string

Charge classification, not a cost metric. One or more of cost, credit, discount, refund, tax

string

Data source scope. By default, it is cloud+K8s. Specify whether to see only K8s or cloud costs.
Example: costglobaltype: "cloud"

filters
object

Include-filters keyed by dimension. {"service":["Amazon Elastic Compute Cloud"]}.

excludeFilters
object

Exclude-filters, same shape as filters.

likeFilters
object

Substring (LIKE) filters.
Example: {service: "bedrock"}

excludeLikeFilters
object

Negated substring filters.

string

How the filter families combine - and (default) or or.
Example: conjunction: {customtags: "or"}

string

GCP only. 'usagedate' (default) or 'invoicemonth'.

string

Measure emissions or water instead of cost. One of 'totalCarbonEmissions', 'usageCarbonEmissions', 'manufacturingCarbonEmissions', 'cloudUsageElectricityConsumption', 'waterElectricity', 'waterCooling', 'waterTotal'. The chosen figure replaces total_cost.

boolean

Keep the quantitytype filter applied to the usage side, for rate-per-unit queries.

boolean

For GCP only. Read the hourly table and bucket in PST rather than UTC.

boolean

Return amortized cost.

boolean

Return net unblended cost.

boolean

Return net unblended cost.

boolean

Return distributed (shared-cost-allocated) cost.

boolean

Return public (list) cost.

boolean

Distribute the node-level unused cost among the pods. Only meaningful with a Kubernetes groupBy

string

Pagination token, use the nextToken from previous response

Headers
string
required
string
required
Response
200
Language
LoadingLoading…