Required permission
Organisation > Admin > Billing > Read
Query parameters
teamId
stringThe ID of the team to filter by. Not accepted from a token that can only read one team — a team billed in its own right, or a team token reading an org's billing — since those responses already cover that team and no other, and start at the project level without it.projectId
stringThe ID of the project to filter by.resourceType
stringThe resource type to filter by (e.g. service, job, harness, addon, volume).one ofjob, service, harness, addon, volumeremoveLegacyFields
booleanFor a billing entity temporarily receiving the legacy billing API contract, return the current contract instead. Use the current query parameters with this option.cursor
The cursor returned from the previous page of results — a Unix timestamp: the last emitted hour for `granularity=hour`, the last emitted bucket otherwise. Pass it back as returned rather than constructing one.perPage
integerThe number of results to display per request. Maximum of 100, or 12 when `granularity=month` — a monthly page covers far more billing hours than the other granularities. Defaults to 12 for `granularity=month`, 50 otherwise.startTime
integerThe Unix timestamp to start from (inclusive).endTime
integerThe Unix timestamp to end at (exclusive). Requires startTime.granularity
stringThe size of each returned entry. `hour` (default) returns raw billing hours. `day` and `month` roll hours into UTC calendar buckets and page over those buckets with `perPage` + `cursor`, walking back to the start of the account's usage history when no `startTime` is given. `total` sums the whole window into one entry, so it reads every hour at once and requires both `startTime` and `endTime`, no more than 366 days apart.one oftotal, hour, day, month
Response body
- {object}Response object.
data
{object} requiredResult data.granularity
stringThe granularity each entry represents.one oftotal, hour, day, monthwindow
{object}The span the entries on this page cover, on bucket boundaries — not the full range paging will reach. Entries carry only their start, so this is what states where the newest one ends; the newest bucket is usually still in progress, so `end` is normally in the future. Returned for the bucketed granularities, and omitted by a page past the end of the usage history, which covers no buckets.start
numberThe oldest returned bucket's start, inclusive, as a Unix timestamp.end
numberThe newest returned bucket's end, exclusive, as a Unix timestamp.scope
{object}Present when the response is narrowed to the caller's own entity.entityType
stringThe entity the response is limited to.one ofteamentityId
stringIdentifier of that entity.usage
[array]An array of usage entries, newest first.- {object}
timestamp
numberThe Unix timestamp of the entry. For bucketed granularities this is the start of the bucket.currency
stringThe currency code.total
numberTotal spend for this entry, across every category it reports. Summed before rounding, so it can differ from adding the categories below by a sub-cent amount. When a team, project or resourceType filter is active — or for a team-scoped caller — the customer-level categories are absent, so this is the spend in that scope rather than what the period cost the customer.paas
{object}The PaaS usage for this entry.price
{object}total
numberThe total PaaS price, rounded to 2 decimal places.cpu
numberThe CPU usage price.memory
numberThe memory usage price.storage
numberThe storage usage price.gpu
numberThe GPU usage price.usage
{object}vcpuHours
numbervCPU hours consumed.memoryGiBHours
numberMemory GiB-hours consumed.storageGiBHours
numberStorage GiB-hours consumed.gpuSpotHours
numberSpot GPU hours consumed.gpuOnDemandHours
numberOn-demand GPU hours consumed.build
{object}The share of the usage attributable to builds.vcpuHours
numbermemoryGiBHours
numberrun
{object}The share of the usage attributable to running workloads.vcpuHours
numbermemoryGiBHours
numberbyoc
{object}Customer-level BYOC usage. Omitted when a team, project or resourceType filter is active, or for a team-scoped caller.price
{object}The customer-level BYOC price total. Always reflects the full customer total, regardless of drill-down filters.total
numberThe total BYOC price, rounded to 2 decimal places.vcpu
numberThe vCPU usage price.memory
numberThe memory usage price.gpuMemory
numberThe GPU memory usage price.cluster
numberThe cluster usage price.usage
{object}Customer-level BYOC usage hours.vcpuHours
numbervCPU hours consumed.memoryGiBHours
numberMemory GiB-hours consumed.clusterHours
numberCluster hours consumed.gpuMemoryGiBHours
numberGPU memory GiB-hours consumed.egressIp
{object}Egress IP spend. Customer-level, so omitted when a team, project or resourceType filter is active, or for a team-scoped caller.price
{object}total
numberThe total price, rounded to 2 decimal places.usage
{object}hours
numberHours consumed.loadBalancer
{object}Load balancer spend. Customer-level, so omitted when a team, project or resourceType filter is active, or for a team-scoped caller.price
{object}total
numberThe total price, rounded to 2 decimal places.usage
{object}hours
numberHours consumed.pagination
{object} requiredData about the endpoint pagination.hasNextPage
boolean requiredIs there another page of results available?cursor
stringThe cursor to access the next page of results.count
number requiredThe number of results returned by this request.unit
stringWhat this page counts.one ofteams, projects, resources, hours, days, months, total
GET /v1/billing/usage
GET /v1/teams/{teamId}/billing/usage
Example response
200 OK
JSON
{
"data": {
"usage": [
{
"currency": "usd",
"total": 69.22,
"paas": {
"price": {
"total": 69.22
}
}
}
]
},
"pagination": {
"hasNextPage": false,
"count": 1,
"unit": "days"
}
}