The Cloud Cost Management API allows you to set up, edit, and delete Cloud Cost Management accounts for AWS and Azure. You can query your cost data by using the Metrics endpoint and the cloud_cost data source. For more information, see the Cloud Cost Management documentation.
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* List Cloud Cost Management AWS CUR configs returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);apiInstance.listCostAWSCURConfigs().then((data: v2.AwsCURConfigsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update Cloud Cost Management AWS CUR config returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);constparams: v2.CloudCostManagementApiUpdateCostAWSCURConfigRequest={body:{data:{attributes:{isEnabled: true,},type:"aws_cur_config_patch_request",},},cloudAccountId:"100",};apiInstance.updateCostAWSCURConfig(params).then((data: v2.AwsCURConfigsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Create Cloud Cost Management AWS CUR config returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);constparams: v2.CloudCostManagementApiCreateCostAWSCURConfigRequest={body:{data:{attributes:{accountId:"123456789123",bucketName:"dd-cost-bucket",bucketRegion:"us-east-1",reportName:"dd-report-name",reportPrefix:"dd-report-prefix",},type:"aws_cur_config_post_request",},},};apiInstance.createCostAWSCURConfig(params).then((data: v2.AwsCURConfigResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Delete Cloud Cost Management AWS CUR config returns "No Content" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);constparams: v2.CloudCostManagementApiDeleteCostAWSCURConfigRequest={cloudAccountId:"100",};apiInstance.deleteCostAWSCURConfig(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* List Cloud Cost Management Azure configs returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);apiInstance.listCostAzureUCConfigs().then((data: v2.AzureUCConfigsResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Delete Cloud Cost Management Azure config returns "No Content" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);constparams: v2.CloudCostManagementApiDeleteCostAzureUCConfigRequest={cloudAccountId:"100",};apiInstance.deleteCostAzureUCConfig(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Cloud Cost Enabled returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);apiInstance.getCloudCostActivity().then((data: v2.CloudCostActivityResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* List Custom Costs files returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);apiInstance.listCustomCostsFiles().then((data: v2.CustomCostsFileListResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Upload Custom Costs File returns "Accepted" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);constparams: v2.CloudCostManagementApiUploadCustomCostsFileRequest={body:[{providerName:"my_provider",chargePeriodStart:"2023-05-06",chargePeriodEnd:"2023-06-06",chargeDescription:"my_description",billedCost: 250,billingCurrency:"USD",tags:{key:"value",},},],};apiInstance.uploadCustomCostsFile(params).then((data: v2.CustomCostsFileUploadResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
JSON API format of for a Custom Costs file with content.
attributes
object
Schema of a cost file's metadata.
billed_cost
double
Total cost in the cost file.
billing_currency
string
Currency used in the Custom Costs file.
charge_period
object
Usage charge period of a Custom Costs file.
end
double
End of the usage of the Custom Costs file.
start
double
Start of the usage of the Custom Costs file.
content
[object]
Detail of the line items from the Custom Costs file.
BilledCost
double
Total cost in the cost file.
BillingCurrency
string
Currency used in the Custom Costs file.
ChargeDescription
string
Description for the line item cost.
ChargePeriodEnd
string
End date of the usage charge.
ChargePeriodStart
string
Start date of the usage charge.
ProviderName
string
Name of the provider for the line item.
Tags
object
Additional tags for the line item.
<any-key>
string
name
string
Name of the Custom Costs file.
provider_names
[string]
Providers contained in the Custom Costs file.
status
string
Status of the Custom Costs file.
uploaded_at
double
Timestamp in millisecond of the upload time of the Custom Costs file.
uploaded_by
object
Metadata of the user that has uploaded the Custom Costs file.
email
string
The name of the Custom Costs file.
icon
string
The name of the Custom Costs file.
name
string
Name of the user.
id
string
ID of the Custom Costs metadata.
type
string
Type of the Custom Costs file metadata.
meta
object
Meta for the response from the Get Custom Costs endpoints.
version
string
Version of Custom Costs file
{"data":{"attributes":{"billed_cost":100.5,"billing_currency":"USD","charge_period":{"end":1706745600000,"start":1704067200000},"content":[{"BilledCost":100.5,"BillingCurrency":"USD","ChargeDescription":"Monthly usage charge for my service","ChargePeriodEnd":"2023-02-28","ChargePeriodStart":"2023-02-01","ProviderName":"string","Tags":{"<any-key>":"string"}}],"name":"my_file.json","provider_names":["my_provider"],"status":"active","uploaded_at":1704067200000,"uploaded_by":{"email":"email.test@datadohq.com","icon":"icon.png","name":"Test User"}},"id":"string","type":"string"},"meta":{"version":"string"}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Get Custom Costs file returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);constparams: v2.CloudCostManagementApiGetCustomCostsFileRequest={fileId:"file_id",};apiInstance.getCustomCostsFile(params).then((data: v2.CustomCostsFileGetResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Delete Custom Costs file returns "No Content" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.CloudCostManagementApi(configuration);constparams: v2.CloudCostManagementApiDeleteCustomCostsFileRequest={fileId:"file_id",};apiInstance.deleteCustomCostsFile(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));