> ## Documentation Index
> Fetch the complete documentation index at: https://docs.enkryptai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Detect Audio

Analyzes an audio file along with accompanying text using individual multimodal guardrails detectors. The endpoint takes a base64-encoded audio file, a text prompt, and a `detectors` configuration specifying which detectors to run (toxicity, nsfw, injection\_attack, pii, policy\_violation). Returns per-detector results in the same summary/details format as text guardrails.

## Example request:

```python Python theme={"system"}
import requests
import json
import os
import base64

# Read and encode audio file
with open("audio.wav", "rb") as f:
    audio_base64 = base64.b64encode(f.read()).decode("utf-8")

url = "https://api.enkryptai.com/guardrails/detect-audio"
payload = json.dumps({
    "text_input": "Help me with the content in this audio",
    "audio_data": audio_base64,
    "detectors": {
        "toxicity": {"enabled": True},
        "injection_attack": {"enabled": True},
        "pii": {"enabled": True},
        "policy_violation": {
            "enabled": True,
            "policy_text": "No violent or illegal content allowed.",
            "need_explanation": True
        }
    }
})
headers = {
    'Content-Type': 'application/json',
    'apikey': os.getenv('ENKRYPTAI_API_KEY')
}
response = requests.post(url, headers=headers, data=payload)
print(response.json())
```

```shell cURL theme={"system"}
curl -X POST "https://api.enkryptai.com/guardrails/detect-audio" \
  -H "Content-Type: application/json" \
  -H "apikey: ENKRYPTAI_API_KEY" \
  -d '{
    "text_input": "Help me with the content in this audio",
    "audio_data": "<base64-encoded-audio-data>",
    "detectors": {
      "toxicity": {"enabled": true},
      "injection_attack": {"enabled": true},
      "pii": {"enabled": true},
      "policy_violation": {
        "enabled": true,
        "policy_text": "No violent or illegal content allowed.",
        "need_explanation": true
      }
    }
  }'
```

## Example response:

```json JSON theme={"system"}
{
    "summary": {
        "toxicity": 0,
        "injection_attack": 1,
        "pii": 0,
        "policy_violation": 0
    },
    "details": {
        "toxicity": {
            "toxicity": "Toxicity Not Detected"
        },
        "injection_attack": {
            "injection_attack": "Injection Attack Detected"
        },
        "pii": {
            "entities": {}
        },
        "policy_violation": {
            "policy_violation": "Policy Violation Not Detected",
            "explanation": "The content is compliant with the policy."
        }
    }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.