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/usage-metering/create-or-update-usage-quotas.md. A documentation index is available at /llms.txt.
Language
Datadog site

Create or update usage quotas

ADVERTENCIANote: 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}

Descripción general

Creates or updates one or more usage quotas by scope. If a quota already exists for a supplied scope, it is updated. Otherwise, a quota is created only when usage_limit and enforced are provided. For the organization-wide quota, pending_usage_limit schedules a limit for the next usage period and can accompany an immediate limit or update an existing quota by itself. Scheduled changes follow include_descendants like the other fields. Requires the billing_edit permission.

This endpoint requires the billing_edit permission.

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

Argumentos

Parámetros de ruta

Nombre
Type
Descripción
quota_namespace [required]
string

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

Cadenas de consulta

Nombre
Type
Descripción
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 datacenter 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

Solicitud

Body Data (required)

The usage quotas to create or update.

Campo
Type
Descripción
data [required]
[object]

A bulk list of usage quota resources to create or update by scope.

Respuesta

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.

Campo
Type
Descripción
data [required]
[object]

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

Ejemplo de código

Create or update usage quotas
## 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