Evaluate an AI Guard request
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.
Request
- Base URLhttps://api.datadoghq.com
- Auth
- API key in header DD-API-KEY and API key in header DD-APPLICATION-KEY
- or OAuth 2Authorization code/oauth2/v1/authorizeToken URL/oauth2/v1/tokenScopesai_guard_evaluate
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Example request
{
"data": {
"attributes": {
"messages": [
{
"content": "Hello world!",
"role": "user"
}
],
"meta": {
"confidence_threshold": 0.8
}
},
"type": "evaluations"
}
}Response
OK
Example response
{
"data": {
"attributes": {
"action": "ALLOW",
"global_prob": 0.005218505859375,
"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"
}
],
"tags": []
},
"id": "a76a703c-324f-42ed-af33-9b17d65e28af",
"type": "evaluations"
}
}Changes
Changes to this operation have not been checked yet.