---
title: Evaluate an AI Guard request
description: Analyzes a conversation for security threats such as prompt injection, jailbreak attempts, and other AI-specific attacks.
breadcrumbs: Docs > API > Evaluate an AI Guard request
---

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

# Evaluate an AI Guard request

## 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 | POST https://api.datadoghq.com/api/v2/ai-guard/evaluate     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/ai-guard/evaluate |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/ai-guard/evaluate |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/ai-guard/evaluate      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/ai-guard/evaluate |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/ai-guard/evaluate |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/ai-guard/evaluate |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/ai-guard/evaluate      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/ai-guard/evaluate  |

### Overview

Analyzes a conversation for security threats such as prompt injection,
jailbreak attempts, and other AI-specific attacks. Returns an action
recommendation (`ALLOW`, `DENY`, or `ABORT`) along with the detected threat
tags and their confidence scores.
AI Guard must be activated for the organization, and the calling user or
application key requires the `ai_guard_evaluate` permission. The action is a
recommendation for the caller to enforce: ALLOW permits the interaction,
DENY blocks the interaction, and ABORT terminates the workflow.
This endpoint is rate limited to `700` requests per minute per organization.
Organization token limits can also result in a 429 response.
Malformed messages return a 400 response. Requests exceeding the raw-input
limit of 1,000,000 tokens return a 413 response; this limit applies to the
input context, not only the size of the HTTP request body.

This endpoint requires the `ai_guard_evaluate` permission.

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

### Request

#### Body Data (required)

The conversation to evaluate for security threats.

{% tabs %}
{% tab label="Model" %}
| Parent field         | Field                   | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| -------------------- | ----------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                      | data [*required*]       | object   | The JSON:API request envelope for an AI Guard evaluation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| data                 | attributes [*required*] | object   | The conversation to evaluate and its metadata.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| attributes           | messages [*required*]   | [object] | The messages of the conversation to evaluate, in order. Must contain at least one message.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| messages             | content                 | <oneOf>  | The content of a message, either a plain string or a list of OpenAI-style content parts.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| content              | Object 1                | string   | The message content as a plain string.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| content              | Object 2                | [object] | The message content as a list of content parts. The list must be non-empty for user, system, developer, and tool messages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| Object 2             | image_url               | object   | An image referenced by URL in a message content part.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| image_url            | url [*required*]        | string   | The image URL or a data URI with an `image/png`, `image/jpeg`, `image/gif`, or `image/webp` MIME type.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| Object 2             | text                    | string   | The text content, required and non-empty when `type` is `text` in a user, system, developer, or tool message.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| Object 2             | type [*required*]       | enum     | The type of the content part. Allowed enum values: `text`, `image_url`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| messages             | role [*required*]       | enum     | The role of the message author in the conversation. Allowed enum values: `user`, `assistant`, `system`, `developer`, `tool`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| messages             | tool_call_id            | string   | The identifier of the tool call this message responds to, present on tool result messages.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| messages             | tool_calls              | [object] | The tool calls emitted by the assistant, present on assistant messages that call tools.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| tool_calls           | function [*required*]   | object   | The function invoked by a tool call.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| function             | arguments [*required*]  | string   | The arguments of the function call, serialized as a JSON string.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| function             | name [*required*]       | string   | The name of the function to call.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| tool_calls           | id [*required*]         | string   | The identifier of the tool call.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| attributes           | meta                    | object   | Metadata about the evaluated conversation, used to select the policy and evaluator behavior.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| meta                 | coding_agent            | string   | The coding agent that produced the conversation. By default, a non-empty value selects the coding-agent evaluator profile, while an omitted or empty value selects the default profile. Known identifiers include `claude-code`, `codex`, `cursor`, and `github-copilot`; other identifiers are accepted. The coding-agent profile assumes the caller can ask the user to confirm Supply Chain Firewall warnings; the default profile assumes it cannot.                                                                                                                                                                                                                                                                                           |
| meta                 | confidence_threshold    | <oneOf>  | Request-only confidence threshold override. A number sets the threshold for every threat category; an object supplies a global threshold and optional per-category overrides. Omit this field to use the stored sensitivity policy. This field is not returned in evaluation responses.                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| confidence_threshold | Object 1                | double   | The global confidence threshold applied to every threat category.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| confidence_threshold | Object 2                | object   | Request-level confidence threshold override. `flagging_global` is the global threshold applied to every threat category. Any other property is a per-category override keyed by an AI Guard threat tag; per-category values take precedence over `flagging_global`, and categories without an entry fall back to it. When this object omits flagging_global, the fallback is `0.5`. Recognized category keys include policy-evasion, indirect-prompt-injection, system-and-capability-discovery, credential-access, sensitive-data-collection, privilege-escalation, malicious-execution, private-network-target, destructive-or-resource-abuse, tool-abuse, poisoning-or-persistence, and `data-exfiltration`. Unknown category keys are ignored. |
| Object 2             | flagging_global         | double   | The global confidence threshold applied to categories without a specific override.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| meta                 | env                     | string   | The environment the conversation belongs to.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| meta                 | is_sds_enabled_override | boolean  | Whether to run the Sensitive Data Scanner for this request, overriding the stored policy.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| meta                 | service                 | string   | The name of the service the conversation belongs to.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| meta                 | tool_policies           | object   | A non-empty map replaces stored tool policies for this request only, keyed by tool name. Any called tool not present resolves to EVALUATE. Only takes effect when tool policies are enabled for the organization.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| additionalProperties | <any-key>               | enum     | The policy action for a tool named by the property. Tool policies override the recommendation after evaluation; they do not skip evaluation. Any BLOCK takes precedence over PASS and EVALUATE. The Supply Chain Firewall is applied afterward and can still return DENY. Allowed enum values: `PASS`, `BLOCK`, `EVALUATE`.                                                                                                                                                                                                                                                                                                                                                                                                                        |
| data                 | type [*required*]       | enum     | The JSON:API resource type for AI Guard evaluation requests and responses. Its value is `evaluations` for the action endpoint `/api/v2/ai-guard/evaluate`. Allowed enum values: `evaluations`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
{% /tab %}

{% tab label="Example" %}
**Evaluate an AI Guard request returns "OK" response**

```json
{
  "data": {
    "type": "evaluations",
    "attributes": {
      "messages": [
        {
          "content": "Hello world!",
          "role": "user"
        }
      ],
      "meta": {
        "confidence_threshold": 0.8
      }
    }
  }
}
```

**Evaluate an AI Guard request with a numeric confidence threshold**

```json
{
  "data": {
    "type": "evaluations",
    "attributes": {
      "messages": [
        {
          "role": "user",
          "content": "Hello world!"
        }
      ],
      "meta": {
        "confidence_threshold": 0.8
      }
    }
  }
}
```

**Evaluate an AI Guard request with per-category confidence thresholds**

```json
{
  "data": {
    "type": "evaluations",
    "attributes": {
      "messages": [
        {
          "role": "user",
          "content": "Hello world!"
        }
      ],
      "meta": {
        "confidence_threshold": {
          "flagging_global": 0.6,
          "policy-evasion": 0.9,
          "indirect-prompt-injection": 0.4
        }
      }
    }
  }
}
```
{% /tab %}
{% /tabs %}

### Response

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

{% tabs %}
{% tab label="Model" %}
The response containing the evaluation result.

| Parent field           | Field                            | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ---------------------- | -------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                        | data [*required*]                | object   | The JSON:API evaluation resource.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| data                   | attributes [*required*]          | object   | The evaluation result with the recommended action and detected threat information.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| attributes             | action [*required*]              | enum     | The recommended action for the evaluated conversation. Allowed enum values: `ALLOW`, `DENY`, `ABORT`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| attributes             | extra_tags                       | [object] | The span tags that tracers should add to the `ai_guard` span. Each item contains a backend-defined key and value, and clients should not assume a fixed set of keys. Example keys include `ai_guard.evaluate_id` and `ai_guard.evaluation_context`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| extra_tags             | key [*required*]                 | string   | The span tag key.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| extra_tags             | value [*required*]               | string   | The span tag value.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| attributes             | global_prob                      | double   | The global threat probability, between `0` and `1`. Included only when computed.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| attributes             | is_blocking_enabled [*required*] | boolean  | Whether blocking is enabled for the organization.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| attributes             | reason [*required*]              | string   | The explanation for the recommended action, for logging rather than user-facing display.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| attributes             | redaction_replacements           | [object] | The redacted replacements computed for the request. Included only when redaction applies.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| redaction_replacements | path [*required*]                | string   | The path of the redacted content relative to the request attributes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| redaction_replacements | replacement [*required*]         | string   | The redacted replacement content.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| attributes             | scfw_findings                    | object   | The Supply Chain Firewall verdict for the version-pinned install packages found in the request. Evaluation requires Supply Chain Firewall to be enabled for the organization and the caller to have the `appsec_vm_read` permission. Without that permission, Supply Chain Firewall evaluation is skipped; the AI Guard evaluation request itself is not rejected. Findings are omitted when Supply Chain Firewall does not produce a result. The recommended action combines the package outcomes. Confirmation support is inferred from the evaluator profile, not from a separate confirmation-capability flag. By default, a non-empty `meta.coding_agent` selects the coding-agent profile, which assumes the caller can ask for confirmation and retains WARN in `recommended_action`. Omitting `meta.coding_agent` or setting it to an empty string selects the default profile, which assumes the caller cannot ask for confirmation and returns ALLOW instead of WARN in `recommended_action`. Package outcomes still retain WARN, and BLOCK is never changed to ALLOW by this rule. |
| scfw_findings          | packages                         | [object] | The packages the firewall evaluated, `ALLOW` ones included.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| packages               | ecosystem [*required*]           | string   | The package ecosystem the firewall evaluated, such as `PyPI`, `npm`, or `crates.io`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| packages               | matched_rules                    | [object] | Every rule the firewall matched on the package.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| matched_rules          | outcome [*required*]             | enum     | The Supply Chain Firewall outcome for a package, a matched rule, or the whole request. Allowed enum values: `ALLOW`, `WARN`, `BLOCK`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| matched_rules          | rule [*required*]                | string   | The rule text the firewall reported, or the policy type when no text was reported.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| packages               | name [*required*]                | string   | The name of the package.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| packages               | outcome [*required*]             | enum     | The Supply Chain Firewall outcome for a package, a matched rule, or the whole request. Allowed enum values: `ALLOW`, `WARN`, `BLOCK`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| packages               | version [*required*]             | string   | The version of the package.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| scfw_findings          | recommended_action [*required*]  | enum     | The Supply Chain Firewall outcome for a package, a matched rule, or the whole request. Allowed enum values: `ALLOW`, `WARN`, `BLOCK`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| attributes             | sds_findings                     | [object] | The sensitive data findings from the Sensitive Data Scanner. Included only when findings exist.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| sds_findings           | category [*required*]            | string   | The category of the sensitive data found.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| sds_findings           | location [*required*]            | object   | The location of a sensitive data match within the request.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| location               | end_index_exclusive [*required*] | int64    | The exclusive end index of the match within the located content.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| location               | path [*required*]                | string   | The path of the match relative to the request attributes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| location               | start_index [*required*]         | int64    | The start index of the match within the located content.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| sds_findings           | rule_display_name [*required*]   | string   | The display name of the SDS rule that matched.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| sds_findings           | rule_tag [*required*]            | string   | The tag of the SDS rule that matched.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| attributes             | tag_probs [*required*]           | object   | The detection confidence for each threat tag, between `0` and `1`. May be null when the evaluation does not produce per-category scores.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| additionalProperties   | <any-key>                        | double   | The detection confidence for the threat tag named by the property.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| attributes             | tags [*required*]                | [string] | The threat tags detected in the conversation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| data                   | id [*required*]                  | string   | The unique identifier of the evaluation.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| data                   | type [*required*]                | enum     | The JSON:API resource type for AI Guard evaluation requests and responses. Its value is `evaluations` for the action endpoint `/api/v2/ai-guard/evaluate`. Allowed enum values: `evaluations`.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "action": "ALLOW",
      "extra_tags": [
        {
          "key": "ai_guard.evaluate_id",
          "value": "a76a703c-324f-42ed-af33-9b17d65e28af"
        }
      ],
      "global_prob": 0.005218505859375,
      "is_blocking_enabled": false,
      "reason": "No rule match.",
      "redaction_replacements": [
        {
          "path": "messages[0].content",
          "replacement": "[REDACTED]"
        }
      ],
      "scfw_findings": {
        "packages": [
          {
            "ecosystem": "npm",
            "matched_rules": [
              {
                "outcome": "BLOCK",
                "rule": "Disallow install commands"
              }
            ],
            "name": "left-pad",
            "outcome": "BLOCK",
            "version": "1.3.0"
          }
        ],
        "recommended_action": "BLOCK"
      },
      "sds_findings": [
        {
          "category": "financial",
          "location": {
            "end_index_exclusive": 42,
            "path": "messages[0].content",
            "start_index": 12
          },
          "rule_display_name": "Credit Card Number",
          "rule_tag": "credit-card"
        }
      ],
      "tag_probs": {
        "<any-key>": 0.97
      },
      "tags": [
        []
      ]
    },
    "id": "a76a703c-324f-42ed-af33-9b17d65e28af",
    "type": "evaluations"
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

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

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="401" %}
Unauthorized

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="408" %}
Request Timeout

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="413" %}
Payload Too Large

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "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
# 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 POST "https://api.${DD_SITE}/api/v2/ai-guard/evaluate" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "evaluations",
    "attributes": {
      "messages": [
        {
          "content": "Hello world!",
          "role": "user"
        }
      ],
      "meta": {
        "confidence_threshold": 0.8
      }
    }
  }
}
EOF
```

```bash
# 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 POST "https://api.${DD_SITE}/api/v2/ai-guard/evaluate" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "evaluations",
    "attributes": {
      "messages": [
        {
          "role": "user",
          "content": "Hello world!"
        }
      ],
      "meta": {
        "confidence_threshold": 0.8
      }
    }
  }
}
EOF
```

```bash
# 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 POST "https://api.${DD_SITE}/api/v2/ai-guard/evaluate" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "type": "evaluations",
    "attributes": {
      "messages": [
        {
          "role": "user",
          "content": "Hello world!"
        }
      ],
      "meta": {
        "confidence_threshold": {
          "flagging_global": 0.6,
          "policy-evasion": 0.9,
          "indirect-prompt-injection": 0.4
        }
      }
    }
  }
}
EOF
```
{% /tab %}
{% /tabs %}
