v1

latestOpenAPI 3.0.02026-07-141,4077,1665.2 MB
Usage Metering

Get Monthly Cost Attribution

Get monthly cost attribution by tag across multi-org and single root-org accounts. Cost Attribution data for a given month becomes available no later than the 19th of the following month. This API endpoint is paginated. To make sure you receive all records, check if the value of next_record_id is set in the response. If it is, make another request and pass next_record_id as a parameter. Pseudo code example:

response := GetMonthlyCostAttribution(start_month, end_month)
cursor := response.metadata.pagination.next_record_id
WHILE cursor != null BEGIN
  sleep(5 seconds)  # Avoid running into rate limit
  response := GetMonthlyCostAttribution(start_month, end_month, next_record_id=cursor)
  cursor := response.metadata.pagination.next_record_id
END

This endpoint is only accessible for parent-level organizations. This endpoint is not available in the Government (US1-FED) site.

get/api/v2/cost_by_tag/monthly_cost_attribution

Query parameters

start_monthstring date-time required

Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for cost beginning in this month.

end_monthstring date-time

Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for cost ending this month.

fieldsstring required

Comma-separated list specifying cost types (e.g., <billing_dimension>_on_demand_cost, <billing_dimension>_committed_cost, <billing_dimension>_total_cost) and the proportions (<billing_dimension>_percentage_in_org, <billing_dimension>_percentage_in_account). Use * to retrieve all fields. Example: infra_host_on_demand_cost,infra_host_percentage_in_account To obtain the complete list of active billing dimensions that can be used to replace <billing_dimension> in the field names, make a request to the Get active billing dimensions API.

sort_direction'desc' | 'asc'

The direction to sort by.

The direction to sort by: [desc, asc].

sort_namestring

The billing dimension to sort by. Always sorted by total cost. Example: infra_host.

tag_breakdown_keysstring

Comma separated list of tag keys used to group cost. If no value is provided the cost will not be broken down by tags. To see which tags are available, look for the value of tag_config_source in the API response.

next_record_idstring

List following results with a next_record_id provided in the previous query.

include_descendantsboolean

Include child org cost in the response. Defaults to true.

Response

OK