Skip to main content
POST
/
guardrails
/
policy
/
detect-audio
Detect Audio Using Policy
curl --request POST \
  --url https://api.enkryptai.com/guardrails/policy/detect-audio \
  --header 'Content-Type: application/json' \
  --header 'X-Enkrypt-Policy: <x-enkrypt-policy>' \
  --header 'apikey: <api-key>' \
  --data '
{
  "text_input": "Help me with the content in this audio",
  "audio_data": "<base64-encoded-audio-data>"
}
'
{
  "summary": {
    "toxicity": 0,
    "nsfw": 0,
    "pii": 1,
    "injection_attack": 0,
    "policy_violation": 0
  },
  "details": {
    "toxicity": {
      "toxicity": "Toxicity Not Detected"
    },
    "nsfw": {
      "nsfw": "NSFW Not Detected"
    },
    "pii": {
      "entities": {
        "person": {
          "John Doe": "<person_0>"
        }
      }
    },
    "injection_attack": {
      "injection_attack": "Injection Attack Not Detected"
    },
    "policy_violation": {
      "policy_violation": "Policy Violation Not Detected"
    }
  }
}
Archived: This endpoint is legacy. Use the new Guardrail Detect Audio endpoint instead, which supports separate input/output detectors via X-Enkrypt-Mode.

Authorizations

apikey
string
header
required

Headers

X-Enkrypt-Policy
string
required

The policy name

Example:

"Test Guardrails Policy"

Body

application/json

Request body for policy-based audio detection. Detectors are defined by the policy; no inline detectors config is needed.

text_input
string
required

The text prompt to accompany the audio for analysis.

Example:

"Help me with the content in this audio"

audio_data
string
required

Base64-encoded audio file content.

Example:

"<base64-encoded-audio-data>"

Response

200 - application/json

Multimodal audio detection results.

summary
object
required

Per-detector integer flags (1 = detected, 0 = not detected).

Example:
{
"toxicity": 0,
"nsfw": 0,
"pii": 1,
"injection_attack": 0,
"policy_violation": 0
}
details
object
required

Per-detector detail objects containing human-readable results and any extra fields (e.g. entities for PII, explanation for policy_violation).

Example:
{
"toxicity": { "toxicity": "Toxicity Not Detected" },
"nsfw": { "nsfw": "NSFW Not Detected" },
"pii": {
"entities": { "person": { "John Doe": "<person_0>" } }
},
"injection_attack": {
"injection_attack": "Injection Attack Not Detected"
},
"policy_violation": {
"policy_violation": "Policy Violation Not Detected"
}
}