Get estimated cost across multi-org and single root-org accounts.
Estimated cost data is only available for the current month and previous month
and is delayed by up to 72 hours from when it was incurred.
To access historical costs prior to this, use the /historical_cost endpoint.
This endpoint requires
all
of the following permissions:
usage_read
billing_read
OAuth apps require the usage_read, billing_read authorization scope to access this endpoint.
Arguments
Query Strings
Name
Type
Description
view
string
String to specify whether cost is broken down at a parent-org level or at the sub-org level. Available views are summary and sub-org. Defaults to summary.
start_month
string
Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for cost beginning this month. Either start_month or start_date should be specified, but not both. (start_month cannot go beyond two months in the past). Provide an end_month to view month-over-month cost.
end_month
string
Datetime in ISO-8601 format, UTC, precise to month: [YYYY-MM] for cost ending this month.
start_date
string
Datetime in ISO-8601 format, UTC, precise to day: [YYYY-MM-DD] for cost beginning this day. Either start_month or start_date should be specified, but not both. (start_date cannot go beyond two months in the past). Provide an end_date to view day-over-day cumulative cost.
end_date
string
Datetime in ISO-8601 format, UTC, precise to day: [YYYY-MM-DD] for cost ending this day.
cost_aggregation
enum
Controls how costs are aggregated when using start_date. The cumulative option returns month-to-date running totals. Allowed enum values: cumulative
include_connected_accounts
boolean
Boolean to specify whether to include accounts connected to the current account as partner customers in the Datadog partner network program. Defaults to false.
"""
Get estimated cost across your account returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.usage_metering_apiimportUsageMeteringApiconfiguration=Configuration()withApiClient(configuration)asapi_client:api_instance=UsageMeteringApi(api_client)response=api_instance.get_estimated_cost_by_org()print(response)
# Get estimated cost across your account returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::UsageMeteringAPI.newpapi_instance.get_estimated_cost_by_org()
// Get estimated cost across your account returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewUsageMeteringApi(apiClient)resp,r,err:=api.GetEstimatedCostByOrg(ctx,*datadogV2.NewGetEstimatedCostByOrgOptionalParameters())iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `UsageMeteringApi.GetEstimatedCostByOrg`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `UsageMeteringApi.GetEstimatedCostByOrg`:\n%s\n",responseContent)}
// Get estimated cost across your account returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.UsageMeteringApi;importcom.datadog.api.client.v2.model.CostByOrgResponse;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();UsageMeteringApiapiInstance=newUsageMeteringApi(defaultClient);try{CostByOrgResponseresult=apiInstance.getEstimatedCostByOrg();System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling UsageMeteringApi#getEstimatedCostByOrg");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
// Get estimated cost across your account returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_usage_metering::GetEstimatedCostByOrgOptionalParams;usedatadog_api_client::datadogV2::api_usage_metering::UsageMeteringAPI;#[tokio::main]asyncfnmain(){letconfiguration=datadog::Configuration::new();letapi=UsageMeteringAPI::with_config(configuration);letresp=api.get_estimated_cost_by_org(GetEstimatedCostByOrgOptionalParams::default()).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get estimated cost across your account returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.UsageMeteringApi(configuration);apiInstance.getEstimatedCostByOrg().then((data: v2.CostByOrgResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));