For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/ja/api/latest/usage-metering/create-or-update-usage-quotas.md. A documentation index is available at /llms.txt.
Language
Datadog site

使用量クォータの作成または更新

警告Note: This endpoint is in Preview and is subject to change. If you have any feedback, contact Datadog support.
POSThttps://api.datadoghq.com/api/v2/usage/quotas/{quota_namespace}https://api.us3.datadoghq.com/api/v2/usage/quotas/{quota_namespace}https://api.us5.datadoghq.com/api/v2/usage/quotas/{quota_namespace}https://api.datadoghq.eu/api/v2/usage/quotas/{quota_namespace}https://api.ap1.datadoghq.com/api/v2/usage/quotas/{quota_namespace}https://api.ap2.datadoghq.com/api/v2/usage/quotas/{quota_namespace}https://api.uk1.datadoghq.com/api/v2/usage/quotas/{quota_namespace}https://api.ddog-gov.com/api/v2/usage/quotas/{quota_namespace}https://api.us2.ddog-gov.com/api/v2/usage/quotas/{quota_namespace}

概要

スコープ別に 1 つ以上の使用量クォータを作成または更新します。指定されたスコープのクォータがすでに存在する場合は更新され、存在しない場合は新しいクォータが作成されます。「user_access_manage」、「billing_edit」、および「org_management」権限が必要です。

This endpoint requires the billing_edit permission.

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

引数

パスパラメーター

名前
タイプ
説明
quota_namespace [required]
string

The product-specific namespace whose usage quotas are being managed.

クエリ文字列

名前
タイプ
説明
include_descendants
boolean

Whether to write every item in the request to the caller's organization and all of its descendant organizations, instead of only the caller's organization. Only descendants in the same data center are supported. For a user-handle scope, the quota is applied only to the caller's organization and to descendant organizations where that user handle exists; the item fails only if the handle exists in none of them.

Default: false
create_only
boolean

Create one quota without updating an existing quota. Requires exactly one item that specifies usage_limit and enforced, omits pending_usage_limit, and sets include_descendants=false. The quota belongs to the caller's organization. An existing quota returns 409 without being modified.

Default: false

リクエスト

Body Data (required)

作成または更新する使用量クォータ。

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

単一のリソースではなく、使用量クォータリソースの配列を含む JSON:API 一括リクエスト。

応答

OK. The response includes each item's result; see each item's error attribute for any that failed to write.

Response containing the result of a bulk usage quota create-or-update request. Returned with a 200 status regardless of whether individual items succeeded or failed; check each item's error attribute to determine its outcome.

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

The results of writing each usage quota in a bulk create-or-update request, in the same order as the request.

コード例

使用量クォータの作成または更新
## Create or update quotas for the caller's organization.

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "scope": {
          "user_handle": "jane@example.com"
        },
        "usage_limit": 100000
      },
      "type": "quotas"
    },
    {
      "attributes": {
        "enforced": false,
        "scope": {
          "user_handle": "*"
        },
        "usage_limit": 250000
      },
      "type": "quotas"
    }
  ]
}
EOF

## Set a limit and schedule a reduction

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "pending_usage_limit": 100000,
        "usage_limit": 600000
      },
      "type": "quotas"
    }
  ]
}
EOF
## Create or update quotas for the caller's organization.

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "scope": {
          "user_handle": "jane@example.com"
        },
        "usage_limit": 100000
      },
      "type": "quotas"
    },
    {
      "attributes": {
        "enforced": false,
        "scope": {
          "user_handle": "*"
        },
        "usage_limit": 250000
      },
      "type": "quotas"
    }
  ]
}
EOF

## Set a limit and schedule a reduction

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "pending_usage_limit": 100000,
        "usage_limit": 600000
      },
      "type": "quotas"
    }
  ]
}
EOF
## Create or update quotas for the caller's organization.

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "scope": {
          "user_handle": "jane@example.com"
        },
        "usage_limit": 100000
      },
      "type": "quotas"
    },
    {
      "attributes": {
        "enforced": false,
        "scope": {
          "user_handle": "*"
        },
        "usage_limit": 250000
      },
      "type": "quotas"
    }
  ]
}
EOF

## Set a limit and schedule a reduction

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "pending_usage_limit": 100000,
        "usage_limit": 600000
      },
      "type": "quotas"
    }
  ]
}
EOF
## Create or update quotas for the caller's organization.

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "scope": {
          "user_handle": "jane@example.com"
        },
        "usage_limit": 100000
      },
      "type": "quotas"
    },
    {
      "attributes": {
        "enforced": false,
        "scope": {
          "user_handle": "*"
        },
        "usage_limit": 250000
      },
      "type": "quotas"
    }
  ]
}
EOF

## Set a limit and schedule a reduction

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "pending_usage_limit": 100000,
        "usage_limit": 600000
      },
      "type": "quotas"
    }
  ]
}
EOF
## Create or update quotas for the caller's organization.

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "scope": {
          "user_handle": "jane@example.com"
        },
        "usage_limit": 100000
      },
      "type": "quotas"
    },
    {
      "attributes": {
        "enforced": false,
        "scope": {
          "user_handle": "*"
        },
        "usage_limit": 250000
      },
      "type": "quotas"
    }
  ]
}
EOF

## Set a limit and schedule a reduction

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "pending_usage_limit": 100000,
        "usage_limit": 600000
      },
      "type": "quotas"
    }
  ]
}
EOF
## Create or update quotas for the caller's organization.

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "scope": {
          "user_handle": "jane@example.com"
        },
        "usage_limit": 100000
      },
      "type": "quotas"
    },
    {
      "attributes": {
        "enforced": false,
        "scope": {
          "user_handle": "*"
        },
        "usage_limit": 250000
      },
      "type": "quotas"
    }
  ]
}
EOF

## Set a limit and schedule a reduction

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "pending_usage_limit": 100000,
        "usage_limit": 600000
      },
      "type": "quotas"
    }
  ]
}
EOF
## Create or update quotas for the caller's organization.

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "scope": {
          "user_handle": "jane@example.com"
        },
        "usage_limit": 100000
      },
      "type": "quotas"
    },
    {
      "attributes": {
        "enforced": false,
        "scope": {
          "user_handle": "*"
        },
        "usage_limit": 250000
      },
      "type": "quotas"
    }
  ]
}
EOF

## Set a limit and schedule a reduction

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "pending_usage_limit": 100000,
        "usage_limit": 600000
      },
      "type": "quotas"
    }
  ]
}
EOF
## Create or update quotas for the caller's organization.

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "scope": {
          "user_handle": "jane@example.com"
        },
        "usage_limit": 100000
      },
      "type": "quotas"
    },
    {
      "attributes": {
        "enforced": false,
        "scope": {
          "user_handle": "*"
        },
        "usage_limit": 250000
      },
      "type": "quotas"
    }
  ]
}
EOF

## Set a limit and schedule a reduction

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "pending_usage_limit": 100000,
        "usage_limit": 600000
      },
      "type": "quotas"
    }
  ]
}
EOF
## Create or update quotas for the caller's organization.

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "scope": {
          "user_handle": "jane@example.com"
        },
        "usage_limit": 100000
      },
      "type": "quotas"
    },
    {
      "attributes": {
        "enforced": false,
        "scope": {
          "user_handle": "*"
        },
        "usage_limit": 250000
      },
      "type": "quotas"
    }
  ]
}
EOF

## Set a limit and schedule a reduction

# Path parameters
export quota_namespace="ai_credits"

# 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 POST "https://api.${DD_SITE}/api/v2/usage/quotas/${quota_namespace}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": [
    {
      "attributes": {
        "enforced": true,
        "pending_usage_limit": 100000,
        "usage_limit": 600000
      },
      "type": "quotas"
    }
  ]
}
EOF