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

Cargar un archivo de costes personalizados

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

Descripción general

Carga un archivo de costes personalizados.

This endpoint requires the cloud_cost_management_write permission.

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

Solicitud

Body Data (required)

Campo
Type
Descripción
BilledCost
double

Solicitud de carga de un archivo de costes personalizados.

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.

Respuesta

Accepted

Response for Uploaded Custom Costs files.

Campo
Type
Descripción
data
object

JSON API format for a Custom Costs file.

meta
object

Meta for the response from the Upload Custom Costs endpoints.

Ejemplo de código

Upload Custom Costs File returns "Accepted" response
# 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
[
  {
    "ProviderName": "my_provider",
    "ChargePeriodStart": "2023-05-06",
    "ChargePeriodEnd": "2023-06-06",
    "ChargeDescription": "my_description",
    "BilledCost": 250,
    "BillingCurrency": "USD",
    "Tags": {
      "key": "value"
    }
  }
]
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
[
  {
    "ProviderName": "my_provider",
    "ChargePeriodStart": "2023-05-06",
    "ChargePeriodEnd": "2023-06-06",
    "ChargeDescription": "my_description",
    "BilledCost": 250,
    "BillingCurrency": "USD",
    "Tags": {
      "key": "value"
    }
  }
]
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
[
  {
    "ProviderName": "my_provider",
    "ChargePeriodStart": "2023-05-06",
    "ChargePeriodEnd": "2023-06-06",
    "ChargeDescription": "my_description",
    "BilledCost": 250,
    "BillingCurrency": "USD",
    "Tags": {
      "key": "value"
    }
  }
]
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
[
  {
    "ProviderName": "my_provider",
    "ChargePeriodStart": "2023-05-06",
    "ChargePeriodEnd": "2023-06-06",
    "ChargeDescription": "my_description",
    "BilledCost": 250,
    "BillingCurrency": "USD",
    "Tags": {
      "key": "value"
    }
  }
]
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
[
  {
    "ProviderName": "my_provider",
    "ChargePeriodStart": "2023-05-06",
    "ChargePeriodEnd": "2023-06-06",
    "ChargeDescription": "my_description",
    "BilledCost": 250,
    "BillingCurrency": "USD",
    "Tags": {
      "key": "value"
    }
  }
]
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
[
  {
    "ProviderName": "my_provider",
    "ChargePeriodStart": "2023-05-06",
    "ChargePeriodEnd": "2023-06-06",
    "ChargeDescription": "my_description",
    "BilledCost": 250,
    "BillingCurrency": "USD",
    "Tags": {
      "key": "value"
    }
  }
]
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
[
  {
    "ProviderName": "my_provider",
    "ChargePeriodStart": "2023-05-06",
    "ChargePeriodEnd": "2023-06-06",
    "ChargeDescription": "my_description",
    "BilledCost": 250,
    "BillingCurrency": "USD",
    "Tags": {
      "key": "value"
    }
  }
]
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
[
  {
    "ProviderName": "my_provider",
    "ChargePeriodStart": "2023-05-06",
    "ChargePeriodEnd": "2023-06-06",
    "ChargeDescription": "my_description",
    "BilledCost": 250,
    "BillingCurrency": "USD",
    "Tags": {
      "key": "value"
    }
  }
]
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
[
  {
    "ProviderName": "my_provider",
    "ChargePeriodStart": "2023-05-06",
    "ChargePeriodEnd": "2023-06-06",
    "ChargeDescription": "my_description",
    "BilledCost": 250,
    "BillingCurrency": "USD",
    "Tags": {
      "key": "value"
    }
  }
]
EOF