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.
Legacy: This page documents the legacy Policy Scan PDF API. Use the new Guardrail Scan PDF instead, which supports separate input/output detectors via X-Enkrypt-Mode.
Scans a PDF file for security threats using a specific policy. The detector analyzes the provided base64-encoded PDF and returns details about any detected threats on a per-page basis, according to the selected policy.
Example request:
import requests
import json
import os
import base64
# Read and encode PDF file
with open("document.pdf", "rb") as f:
file_base64 = base64.b64encode(f.read()).decode("utf-8")
url = "https://api.enkryptai.com/guardrails/policy/scan-pdf"
payload = json.dumps({
"file": file_base64
})
headers = {
'Content-Type': 'application/json',
'apikey': os.getenv('ENKRYPTAI_API_KEY'),
'X-Enkrypt-Policy': 'my-policy'
}
response = requests.post(url, headers=headers, data=payload)
print(response.json())
Example response:
{
"summary": {
"policy_violation": 0,
"injection_attack": 0
},
"details": {
"total_pages": 1,
"pages_with_detections": 0,
"detections": []
}
}