---
title: Replace an AI Gateway data capture override
description: Replace an override using its revision and the current configuration_revision.
breadcrumbs: Docs > API > Replace an AI Gateway data capture override
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Replace an AI Gateway data capture override

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in Preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help.md).
{% /alert %}

| Datadog site      | API endpoint                                                         |
| ----------------- | -------------------------------------------------------------------- |
| app.datadoghq.com | PUT https://api.datadoghq.com/api/v2/data-capture/overrides/{id}     |
| us3.datadoghq.com | PUT https://api.us3.datadoghq.com/api/v2/data-capture/overrides/{id} |
| us5.datadoghq.com | PUT https://api.us5.datadoghq.com/api/v2/data-capture/overrides/{id} |
| app.datadoghq.eu  | PUT https://api.datadoghq.eu/api/v2/data-capture/overrides/{id}      |
| ap1.datadoghq.com | PUT https://api.ap1.datadoghq.com/api/v2/data-capture/overrides/{id} |
| ap2.datadoghq.com | PUT https://api.ap2.datadoghq.com/api/v2/data-capture/overrides/{id} |
| uk1.datadoghq.com | PUT https://api.uk1.datadoghq.com/api/v2/data-capture/overrides/{id} |
| app.ddog-gov.com  | PUT https://api.ddog-gov.com/api/v2/data-capture/overrides/{id}      |
| us2.ddog-gov.com  | PUT https://api.us2.ddog-gov.com/api/v2/data-capture/overrides/{id}  |

### Overview

Replace an override using its `revision` and the current `configuration_revision`. Changes to capture overrides don't affect routing rules. Returns HTTP 409 when `configuration_revision` or the override `revision` is stale, including a concurrent change during replacement. Missing revisions or required full-capture confirmation returns HTTP 400. Requires `ai_gateway_config_write` and View and Edit access to this override. Hidden overrides return HTTP 404; visible overrides without Edit return HTTP 403. Authorization failures return HTTP 503. The returned UUID and revision acknowledge the saved configuration even if the caller can no longer list it. Restriction policies are saved separately.

This endpoint requires the `ai_gateway_config_write` permission.

OAuth apps require the `ai_gateway_config_write` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#ai-gateway) to access this endpoint.

### Arguments

#### Path Parameters

| Field           | Type   | Description               |
| --------------- | ------ | ------------------------- |
| id [*required*] | string | Data capture override ID. |

### Request

#### Body Data (required)

{% tabs %}
{% tab label="Model" %}
| Parent field         | Field                               | Type     | Description                                                                                                                                                                                                                                                                                                                    |
| -------------------- | ----------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|                      | data [*required*]                   | object   | Existing override identifier, replacement settings, and revisions required for the update.                                                                                                                                                                                                                                     |
| data                 | attributes [*required*]             | object   | Replacement settings and revisions for updating the override.                                                                                                                                                                                                                                                                  |
| attributes           | configuration_revision [*required*] | string   | Opaque revision of the organization default and all overrides, including hidden overrides. Writes require the revision returned by a current read or preview.                                                                                                                                                                  |
| attributes           | confirm_full_capture                | boolean  | Set to `true` to confirm a change that can enable full capture, including a deletion that causes a `full_capture` override or the organization default to apply.                                                                                                                                                               |
| attributes           | metadata_capture                    | [string] | Optional items Metadata-only capture adds for matching requests: structure and counts, never conversation text. Applies only under `metadata_only`. Omit it on replacement to keep the stored items.                                                                                                                           |
| attributes           | mode [*required*]                   | enum     | Capture mode for matching traffic. Allowed enum values: `metadata_only`, `full_capture`.                                                                                                                                                                                                                                       |
| attributes           | name [*required*]                   | string   | Display name of the override. Names need not be unique; identify overrides by `id`.                                                                                                                                                                                                                                            |
| attributes           | operation                           | enum     | Proposed operation for preview. Write endpoints infer it from the HTTP method. Allowed enum values: `create`, `replace`, `delete`.                                                                                                                                                                                             |
| attributes           | revision [*required*]               | int64    | Current override revision, required for replacement or deletion.                                                                                                                                                                                                                                                               |
| attributes           | scope                               | object   | Omit on replacement to preserve the saved scope, including hidden provider and model references. An explicitly supplied scope replaces it.                                                                                                                                                                                     |
| scope                | tags                                | object   | Exact-match request tags with lowercase keys. The reserved `model` tag is the canonical model ID, and the reserved `provider` tag is the configured connection slug. The server sets both. Custom tags come from `x-dd-tag` headers. Keys and values must not have leading or trailing white space. Values are case-sensitive. |
| additionalProperties | <any-key>                           | string   |                                                                                                                                                                                                                                                                                                                                |
| scope                | team_id                             | uuid     | UUID of a Datadog team. Matches the authorized team selected by the `x-ai-gateway-team` request header. Requests without this header do not match team-scoped overrides. Open-membership teams cannot scope overrides.                                                                                                         |
| scope                | user_id                             | uuid     | Authenticated Datadog user UUID in this organization.                                                                                                                                                                                                                                                                          |
| data                 | id [*required*]                     | uuid     | UUID of the override to replace. Must match the `id` path parameter.                                                                                                                                                                                                                                                           |
| data                 | type [*required*]                   | enum     | Data capture overrides resource type. Allowed enum values: `data-capture-overrides`. Default: `data-capture-overrides`.                                                                                                                                                                                                        |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "configuration_revision": "capture-revision-1",
      "confirm_full_capture": false,
      "metadata_capture": [
        "tool_usage",
        "tool_output_size",
        "tool_names"
      ],
      "mode": "metadata_only",
      "name": "Research",
      "operation": "create",
      "revision": 1,
      "scope": {
        "tags": {
          "<any-key>": "string"
        },
        "team_id": "string",
        "user_id": "string"
      }
    },
    "id": "11111111-1111-4111-8111-111111111111",
    "type": "data-capture-overrides"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
Response containing a data capture override after creation or replacement.

| Parent field         | Field                         | Type     | Description                                                                                                                                                                                                                                                                                                                    |
| -------------------- | ----------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|                      | data [*required*]             | object   | Saved data capture override with its identifier, mode, scope, and revision.                                                                                                                                                                                                                                                    |
| data                 | attributes [*required*]       | object   | Saved name, capture mode, request filters, and revision of the override.                                                                                                                                                                                                                                                       |
| attributes           | metadata_capture              | [string] | Items Metadata-only capture adds for matching requests. Empty when none are selected.                                                                                                                                                                                                                                          |
| attributes           | mode [*required*]             | enum     | Capture mode for matching traffic. Allowed enum values: `metadata_only`, `full_capture`.                                                                                                                                                                                                                                       |
| attributes           | name [*required*]             | string   | Display name of the override. Names need not be unique; identify overrides by `id`.                                                                                                                                                                                                                                            |
| attributes           | revision [*required*]         | int64    | Current override revision, required for replacement or deletion.                                                                                                                                                                                                                                                               |
| attributes           | scope [*required*]            | object   | Visible request filters. Provider and model tags are withheld when the caller cannot view them. An empty object or empty tags can represent a fully restricted scope; scope_restricted identifies redaction.                                                                                                                   |
| scope                | tags                          | object   | Exact-match request tags with lowercase keys. The reserved `model` tag is the canonical model ID, and the reserved `provider` tag is the configured connection slug. The server sets both. Custom tags come from `x-dd-tag` headers. Keys and values must not have leading or trailing white space. Values are case-sensitive. |
| additionalProperties | <any-key>                     | string   |                                                                                                                                                                                                                                                                                                                                |
| scope                | team_id                       | uuid     | UUID of a Datadog team. Matches the authorized team selected by the `x-ai-gateway-team` request header. Requests without this header do not match team-scoped overrides. Open-membership teams cannot scope overrides.                                                                                                         |
| scope                | user_id                       | uuid     | Authenticated Datadog user UUID in this organization.                                                                                                                                                                                                                                                                          |
| attributes           | scope_restricted [*required*] | boolean  | Whether provider or model scope metadata was withheld. Omit unchanged scope on replacement to preserve it.                                                                                                                                                                                                                     |
| data                 | id [*required*]               | uuid     | UUID of the saved override, used to retrieve it from the configuration or change it.                                                                                                                                                                                                                                           |
| data                 | type [*required*]             | enum     | Data capture overrides resource type. Allowed enum values: `data-capture-overrides`. Default: `data-capture-overrides`.                                                                                                                                                                                                        |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "metadata_capture": [
        "tool_usage",
        "tool_output_size",
        "tool_names"
      ],
      "mode": "metadata_only",
      "name": "Research",
      "revision": 1,
      "scope": {
        "tags": {
          "<any-key>": "string"
        },
        "team_id": "string",
        "user_id": "string"
      },
      "scope_restricted": false
    },
    "id": "11111111-1111-4111-8111-111111111111",
    "type": "data-capture-overrides"
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="409" %}
Conflict

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Path parameters
export id="CHANGE_ME"

# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, 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/data-capture/overrides/${id}" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "configuration_revision": "capture-revision-1",
      "metadata_capture": [
        "tool_usage",
        "tool_output_size",
        "tool_names"
      ],
      "mode": "metadata_only",
      "name": "Research",
      "operation": "create",
      "revision": 1,
      "scope": {
        "tags": {
          "env": "prod"
        }
      }
    },
    "id": "11111111-1111-4111-8111-111111111111",
    "type": "data-capture-overrides"
  }
}
EOF
```
{% /tab %}
{% /tabs %}
