For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ja/api/latest/cloud-cost-management/create-or-replace-a-budgets-custom-forecast.md. A documentation index is available at /llms.txt.
Language
Datadog site

Create or replace a budget's custom forecast

PUThttps://api.datadoghq.com/api/v2/cost/budget/custom-forecasthttps://api.us3.datadoghq.com/api/v2/cost/budget/custom-forecasthttps://api.us5.datadoghq.com/api/v2/cost/budget/custom-forecasthttps://api.datadoghq.eu/api/v2/cost/budget/custom-forecasthttps://api.ap1.datadoghq.com/api/v2/cost/budget/custom-forecasthttps://api.ap2.datadoghq.com/api/v2/cost/budget/custom-forecasthttps://api.uk1.datadoghq.com/api/v2/cost/budget/custom-forecasthttps://api.ddog-gov.com/api/v2/cost/budget/custom-forecasthttps://api.us2.ddog-gov.com/api/v2/cost/budget/custom-forecast

概要

Create or replace the custom forecast for an existing budget. Pass an empty entries list to delete the custom forecast for the budget.

リクエスト

Body Data (required)

フィールド
タイプ
説明
data [required]
object

Custom forecast resource wrapper in an upsert request.

応答

OK

Response object containing the custom forecast for a budget.

フィールド
タイプ
説明
data [required]
object

Custom forecast resource wrapper in a response.

コード例

Create or replace a budget's custom forecast
# 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/budget/custom-forecast" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "budget_uid": "00000000-0000-0000-0000-000000000001",
      "entries": [
        {
          "amount": 400,
          "month": 202501,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        },
        {
          "amount": 450,
          "month": 202502,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        }
      ]
    },
    "id": "",
    "type": "custom_forecast"
  }
}
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/budget/custom-forecast" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "budget_uid": "00000000-0000-0000-0000-000000000001",
      "entries": [
        {
          "amount": 400,
          "month": 202501,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        },
        {
          "amount": 450,
          "month": 202502,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        }
      ]
    },
    "id": "",
    "type": "custom_forecast"
  }
}
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/budget/custom-forecast" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "budget_uid": "00000000-0000-0000-0000-000000000001",
      "entries": [
        {
          "amount": 400,
          "month": 202501,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        },
        {
          "amount": 450,
          "month": 202502,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        }
      ]
    },
    "id": "",
    "type": "custom_forecast"
  }
}
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/budget/custom-forecast" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "budget_uid": "00000000-0000-0000-0000-000000000001",
      "entries": [
        {
          "amount": 400,
          "month": 202501,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        },
        {
          "amount": 450,
          "month": 202502,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        }
      ]
    },
    "id": "",
    "type": "custom_forecast"
  }
}
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/budget/custom-forecast" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "budget_uid": "00000000-0000-0000-0000-000000000001",
      "entries": [
        {
          "amount": 400,
          "month": 202501,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        },
        {
          "amount": 450,
          "month": 202502,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        }
      ]
    },
    "id": "",
    "type": "custom_forecast"
  }
}
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/budget/custom-forecast" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "budget_uid": "00000000-0000-0000-0000-000000000001",
      "entries": [
        {
          "amount": 400,
          "month": 202501,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        },
        {
          "amount": 450,
          "month": 202502,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        }
      ]
    },
    "id": "",
    "type": "custom_forecast"
  }
}
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/budget/custom-forecast" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "budget_uid": "00000000-0000-0000-0000-000000000001",
      "entries": [
        {
          "amount": 400,
          "month": 202501,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        },
        {
          "amount": 450,
          "month": 202502,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        }
      ]
    },
    "id": "",
    "type": "custom_forecast"
  }
}
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/budget/custom-forecast" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "budget_uid": "00000000-0000-0000-0000-000000000001",
      "entries": [
        {
          "amount": 400,
          "month": 202501,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        },
        {
          "amount": 450,
          "month": 202502,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        }
      ]
    },
    "id": "",
    "type": "custom_forecast"
  }
}
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/budget/custom-forecast" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "budget_uid": "00000000-0000-0000-0000-000000000001",
      "entries": [
        {
          "amount": 400,
          "month": 202501,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        },
        {
          "amount": 450,
          "month": 202502,
          "tag_filters": [
            {
              "tag_key": "service",
              "tag_value": "ec2"
            }
          ]
        }
      ]
    },
    "id": "",
    "type": "custom_forecast"
  }
}
EOF