Skip to main content
The AmbientMeta API accepts plain text only. If your source data lives in PDF, DOCX, RTF, or HTML files, you need to extract the text before calling /v1/sanitize.
Common pitfall: Sending raw file bytes (e.g., the binary contents of an RTF or PDF) directly as the text field will not work. The API will attempt to detect PII in the raw markup or binary data, producing unreliable results — missed entities, false positives on control sequences, or garbled output.

Why plain text?

AmbientMeta’s detection engine analyzes the structural layout of human-readable text — prose, key-value pairs, tables, and lists. Binary formats like PDF and DOCX contain rendering instructions, embedded fonts, and metadata that interfere with detection. RTF and HTML contain markup tags that break entity boundary detection. Always convert to plain text first, then sanitize.

Python

PDF

DOCX

RTF

HTML

Shell

Use common CLI tools to extract text, then pipe to the API with curl.

PDF (pdftotext)

DOCX (pandoc)

RTF (unrtf)

Node.js

PDF

DOCX

HTML

Tips

Preserve structure where possible. The API’s detection engine understands key-value pairs, tables, and lists. When extracting text, prefer tools that maintain line breaks and spacing (e.g., pdftotext -layout) over those that collapse everything into a single paragraph.
Large documents: The text field has a 100KB limit. For documents that exceed this, split the extracted text into chunks and sanitize each chunk separately. Each call returns its own session_id for rehydration.

Quick reference