Allocation API

Allocation API (Querying)

GET http://app.kubecost.com/query/allocation/query

The Allocation API is the preferred way to query for costs and resources allocated to Kubernetes workloads and optionally aggregated by Kubernetes concepts like namespace, controller, and label.

Path Parameters

Name
Type
Description

window*

string

Duration of time over which to query. Accepts multiple formats including units of time, relative time units, and unix timestamps. See this section on using the window parameter for more information.

format

string

File type when exporting query. Currently only supports json.

aggregate

string

Field by which to aggregate the results. Accepts: cluster, node, container, controller, controllerKind, namespace, pod, providerId, service, label:<name>, annotation:<name>, deployment, daemonset, statefulset, job, department, environment, owner, or product. Also accepts comma-separated lists for multi-aggregation, like namespace,label:app.

accumulate

boolean

If true, sum the entire range of time intervals into a single set. Default value is false. Does not accumulate idle costs, which must be configured separately.

idle

boolean

If true, include idle cost (i.e. the cost of the un-allocated assets) as its own allocation. Default is true.

idleByNode

boolean

If true, idle allocations are created on a per node basis. Otherwise, idle allocations are created on a per cluster basis.

limit

int

Refers to the number of line items per page. Currently, only supported together with accumulate=true to obtain a single list of line items.

filter

string

Filter your results by any category which you can aggregate by, can support multiple filterable items in the same category in a comma-separated list. For example, to filter results by clusters A and B, use filter=cluster:clusterA,clusterB See our Filter Parameters doc for a complete explanation of how to use filters and what categories are supported.

Allocation API (Total)

GET http://app.kubecost.com/query/allocation/totals

The Allocation API is the preferred way to query for costs and resources allocated to Kubernetes workloads. The /totals endpoint does not aggregate, and accepts only a window and an optional filter, returning a single total cost.

Path Parameters

Name
Type
Description

window*

string

Duration of time over which to query. Accepts multiple formats including units of time, relative time units, and unix timestamps. See this section on using the window parameter for more information.

format

string

File type when exporting query. Currently only supports json.

filter

string

Filter your results by any category which you can aggregate by, can support multiple filterable items in the same category in a comma-separated list. For example, to filter results by clusters A and B, use filter=cluster:clusterA,clusterB See our Filter Parameters doc for a complete explanation of how to use filters and what categories are supported.

Last updated