Assets API
Assets API
GET
http://<your-kubecost-address>/model/assets
The Assets API retrieves backing cost data broken down by individual assets in your cluster but also provides various aggregations of this data.
Path Parameters
window*
string
Duration of time over which to query. Accepts multiple different formats of time (see this Using the window
parameter section for more info).
aggregate
string
Used to consolidate cost model data. Supported values are account
, cluster
, project
, providerid
, provider
, and type
. Passing an empty value for this parameter or none at all returns data by an individual asset. Supports multi-aggregation (aggregation of multiple categories) in a comma separated list, such as aggregate=account,project
.
accumulate
boolean
When set to false
, this endpoint returns daily time series data vs cumulative data. Default value is false
.
disableAdjustments
boolean
When set to true
, zeros out all adjustments from cloud provider reconciliation, which would otherwise change the totalCost
. Default value is false
.
format
string
When set to csv
, will download an accumulated version of the asset results in CSV format. By default, results will be in JSON format.
offset
int
Refers to the number of line items you are offsetting. Pairs with limit
. See the section on Using offset
and limit
parameters to parse payload results for more info.
limit
int
Refers to the number of line items per page. Pair with the offset
parameter to filter your payload to specific pages of line items. You should also set accumulate=true
to obtain a single list of line items, otherwise you will receive a group of line items per interval of time being sampled.
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 projects A and B, use filter=project:projectA,projectB
. See our Filter Parameters doc for a complete explanation of how to use filters and what categories are supported.
API examples
Retrieve assets cost data for the past week, aggregated by type, and as cumulative object data:
Retrieve all GCP costs, aggregated by asset type, in the past five days:
Querying with /topline
endpoint to view cost totals across query
/topline
endpoint to view cost totals across query/topline
is an optional API endpoint which can be added to your Assets query via .../model/assets/topline?window=...
to provide a condensed overview of your total cost metrics including all line items sampled. You will receive a single list which sums the values per all items queried (totalCost
), where numResults
displays the total number of items sampled.
Enable CPU and RAM cost breakdown
Prometheus queries for CPU and RAM mode breakdown are disabled by default. To receive these metrics, you must manually enable them.
This will enable fields ramBreakdown
, cpuBreakdown
, and breakdown
in the output of all future Assets queries.
Last updated