For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/api/latest/cloud-cost-management/upload-custom-costs-file.md. A documentation index is available at /llms.txt.
Language
Datadog site

Upload Custom Costs file

PUThttps://api.datadoghq.com/api/v2/cost/custom_costshttps://api.us3.datadoghq.com/api/v2/cost/custom_costshttps://api.us5.datadoghq.com/api/v2/cost/custom_costshttps://api.datadoghq.eu/api/v2/cost/custom_costshttps://api.ap1.datadoghq.com/api/v2/cost/custom_costshttps://api.ap2.datadoghq.com/api/v2/cost/custom_costshttps://api.uk1.datadoghq.com/api/v2/cost/custom_costshttps://api.ddog-gov.com/api/v2/cost/custom_costshttps://api.us2.ddog-gov.com/api/v2/cost/custom_costs

Overview

Upload a Custom Costs file.

This endpoint requires the cloud_cost_management_write permission.

OAuth apps require the cloud_cost_management_write authorization scope to access this endpoint.

Request

Body Data (required)

Field
Type
Description
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.

Response

Accepted

Response for Uploaded Custom Costs files.

Field
Type
Description
data
object

JSON API format for a Custom Costs file.

meta
object

Meta for the response from the Upload Custom Costs endpoints.

Code Example

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v2/cost/custom_costs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
[
  {
    "BilledCost": 100.5,
    "BillingCurrency": "USD",
    "ChargeDescription": "Monthly usage charge for my service",
    "ChargePeriodEnd": "2023-02-28",
    "ChargePeriodStart": "2023-02-01"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v2/cost/custom_costs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
[
  {
    "BilledCost": 100.5,
    "BillingCurrency": "USD",
    "ChargeDescription": "Monthly usage charge for my service",
    "ChargePeriodEnd": "2023-02-28",
    "ChargePeriodStart": "2023-02-01"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v2/cost/custom_costs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
[
  {
    "BilledCost": 100.5,
    "BillingCurrency": "USD",
    "ChargeDescription": "Monthly usage charge for my service",
    "ChargePeriodEnd": "2023-02-28",
    "ChargePeriodStart": "2023-02-01"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v2/cost/custom_costs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
[
  {
    "BilledCost": 100.5,
    "BillingCurrency": "USD",
    "ChargeDescription": "Monthly usage charge for my service",
    "ChargePeriodEnd": "2023-02-28",
    "ChargePeriodStart": "2023-02-01"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v2/cost/custom_costs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
[
  {
    "BilledCost": 100.5,
    "BillingCurrency": "USD",
    "ChargeDescription": "Monthly usage charge for my service",
    "ChargePeriodEnd": "2023-02-28",
    "ChargePeriodStart": "2023-02-01"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v2/cost/custom_costs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
[
  {
    "BilledCost": 100.5,
    "BillingCurrency": "USD",
    "ChargeDescription": "Monthly usage charge for my service",
    "ChargePeriodEnd": "2023-02-28",
    "ChargePeriodStart": "2023-02-01"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v2/cost/custom_costs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
[
  {
    "BilledCost": 100.5,
    "BillingCurrency": "USD",
    "ChargeDescription": "Monthly usage charge for my service",
    "ChargePeriodEnd": "2023-02-28",
    "ChargePeriodStart": "2023-02-01"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v2/cost/custom_costs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
[
  {
    "BilledCost": 100.5,
    "BillingCurrency": "USD",
    "ChargeDescription": "Monthly usage charge for my service",
    "ChargePeriodEnd": "2023-02-28",
    "ChargePeriodStart": "2023-02-01"
  }
]
EOF
# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X PUT "https://api.${DD_SITE}/api/v2/cost/custom_costs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
[
  {
    "BilledCost": 100.5,
    "BillingCurrency": "USD",
    "ChargeDescription": "Monthly usage charge for my service",
    "ChargePeriodEnd": "2023-02-28",
    "ChargePeriodStart": "2023-02-01"
  }
]
EOF