For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/stefon.simmons/docs-astro-web-10435/fr/api/latest/usage-metering/get-historical-cost-across-your-account.md. A documentation index is available at /llms.txt.
Language
Datadog site

Récupérer le coût historique de votre compte

GEThttps://api.datadoghq.com/api/v2/usage/historical_costhttps://api.us3.datadoghq.com/api/v2/usage/historical_costhttps://api.us5.datadoghq.com/api/v2/usage/historical_costhttps://api.datadoghq.eu/api/v2/usage/historical_costhttps://api.ap1.datadoghq.com/api/v2/usage/historical_costhttps://api.ap2.datadoghq.com/api/v2/usage/historical_costhttps://api.uk1.datadoghq.com/api/v2/usage/historical_costhttps://api.ddog-gov.com/api/v2/usage/historical_costhttps://api.us2.ddog-gov.com/api/v2/usage/historical_cost

Présentation

Récupérer les coûts historiques dans les comptes multi-org et les comptes racine uniques. Les données de coûts pour un mois donné sont disponibles au plus tard le 16 du mois suivant.

Cet endpoint est uniquement accessible aux organisations de niveau parent.

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

Chaînes de requête

Name
Type
Description
start_month [required]
string

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

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.

end_month
string

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

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.

Default: false

Réponse

OK

Chargeback Summary response.

Champ
Type
Description
data
[object]

Response containing Chargeback Summary.

Exemple de code

Récupérer le coût historique de votre compte
# Required query arguments
export start_month="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v2/usage/historical_cost?start_month=${start_month}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v2/usage/historical_cost?start_month=${start_month}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v2/usage/historical_cost?start_month=${start_month}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v2/usage/historical_cost?start_month=${start_month}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v2/usage/historical_cost?start_month=${start_month}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v2/usage/historical_cost?start_month=${start_month}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v2/usage/historical_cost?start_month=${start_month}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v2/usage/historical_cost?start_month=${start_month}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
# Required query arguments
export start_month="CHANGE_ME"

# 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 GET "https://api.${DD_SITE}/api/v2/usage/historical_cost?start_month=${start_month}" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"