> ## 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.

# Guardrail Scan Url

Scans a URL for security threats using a saved guardrail. Use `X-Enkrypt-Mode` to select between input and output detectors.

* `X-Enkrypt-Mode: prompt` — applies the guardrail's **input** detectors
* `X-Enkrypt-Mode: response` — applies the guardrail's **output** detectors

## Example request:

<CodeGroup>
  ```python Python theme={"system"}
  import requests
  import json
  import os

  url = "https://api.enkryptai.com/guardrails/guardrail/scan-url"

  payload = json.dumps({
      "url": "https://example.com"
  })

  headers = {
      'Content-Type': 'application/json',
      'apikey': os.getenv('ENKRYPTAI_API_KEY'),
      'X-Enkrypt-Guardrail': 'My Guardrail',
      'X-Enkrypt-Mode': 'prompt'
  }

  response = requests.post(url, headers=headers, data=payload)
  print(json.dumps(response.json(), indent=4))
  ```

  ```shell cURL theme={"system"}
  curl -X POST "https://api.enkryptai.com/guardrails/guardrail/scan-url" \
    -H "Content-Type: application/json" \
    -H "apikey: YOUR_API_KEY" \
    -H "X-Enkrypt-Guardrail: My Guardrail" \
    -H "X-Enkrypt-Mode: prompt" \
    -d '{ "url": "https://example.com" }'
  ```
</CodeGroup>

## Example response:

```json JSON theme={"system"}
{
    "summary": {
        "injection_attack": 1,
        "bias": 1,
        "policy_violation": 0
    },
    "details": {
        "url": "https://example.com",
        "metadata": {
            "title": "Example Domain",
            "language": "en"
        },
        "total_fragments": 2,
        "fragments_with_detections": 2,
        "detections": [
            {
                "unsafe_content": "Example Domain",
                "chunk_type": "title",
                "triggered_detectors": ["bias"],
                "detector_details": {
                    "injection_attack": {
                        "safe": "0.999417",
                        "attack": "0.000583",
                        "most_unsafe_content": "Example Domain",
                        "compliance_mapping": {}
                    },
                    "bias": {
                        "bias": {
                            "bias_detected": true,
                            "debiased_text": "Example Website"
                        }
                    }
                }
            }
        ]
    },
    "result_message": null
}
```
