---
title: "Analyze a PDF or image for safety and compliance concerns"
method: POST
path: "/api/v1/safety/document"
tags: ["Safety"]
---

# Analyze a PDF or image for safety and compliance concerns

`POST /api/v1/safety/document`

## Request

- Base URL: `https://api.tuteliq.ai`
- URL: `https://api.tuteliq.ai/api/v1/safety/document`
- Auth: one of:
  - HTTP bearer
  - API key in header `x-api-key`

Upload a PDF (max 50MB, max 100 pages) or a single image (png, jpeg, webp) for multi-endpoint safety analysis. PDFs are read from the text layer per page; images are read by OCR and analysed as a one-page document. Choose which detectors run with the endpoints field. For a messaging screenshot, set split_by_sender=true to have the conversation split into messages with a side attributed to each, so the detector judges the last received message with the rest as history; this costs one additional vision call. Returns per-page results with an overall risk assessment, plus a SHA-256 hash of the uploaded file for chain-of-custody verification. Zero-retention: no document or image data is stored after processing.

## Response `200`

Default Response

- object
  - `file_id` string: Client-provided file identifier (echoed back)
  - `document_hash` string: SHA-256 hash of the uploaded PDF for chain-of-custody verification
  - `total_pages` number: Total pages in the document
  - `pages_analyzed` number: Pages with extractable text that were analyzed
  - `extraction_summary` object
    - `text_layer_pages` number: Pages where text was extracted from the PDF text layer (always 0 for image uploads)
    - `ocr_pages` number: Pages read by OCR — every page of an image upload, and PDF pages with no usable text layer
    - `failed_pages` number: Pages with insufficient text for analysis
    - `average_ocr_confidence` number: Average OCR confidence (0.0-1.0) across OCR pages
  - `page_results` object[]
    - `page_number` number
    - `text_preview` string: First 200 chars of page text
    - `extraction_method` 'text_layer' | 'ocr'
    - `ocr_confidence` number
    - `results` object[]
      - `endpoint` string
      - `detected` boolean
      - `severity` number
      - `confidence` number
      - `risk_score` number
      - `level` string
      - `categories` object[]
      - `evidence` object[]
      - `recommended_action` string
      - `rationale` string
    - `page_risk_score` number
    - `page_severity` string
  - `overall_risk_score` number: Highest risk score across all pages
  - `overall_severity` 'none' | 'low' | 'medium' | 'high' | 'critical'
  - `detected_endpoints` string[]: Endpoints that detected threats
  - `flagged_pages` object[]
    - `page_number` number
    - `risk_score` number
    - `severity` string
    - `detected_endpoints` string[]
  - `credits_used` number
  - `processing_time_ms` number
  - `language` string
  - `language_status` string
  - `support` object
  - `external_id` string
  - `incident_moderation_enabled` string: Per-call override of account incident logging: "true" forces persistence, "false" suppresses it. Omit for account default.
  - `customer_id` string
  - `metadata` object

---

[API](https://skmtc.dev/tuteliq/apis/tuteliq-api.md) · [All operations](https://skmtc.dev/tuteliq/apis/tuteliq-api/llms.txt) · [OpenAPI document](https://skmtc.dev/tuteliq/apis/tuteliq-api/revisions/8490332e0031?raw)
