How AI Agents Can Redact PDFs: API Guide + MCP (2026)
An AI agent can redact PII from a PDF in three API calls: upload the file, poll the job, download the permanently redacted output. The Redact PDF AI API is built for exactly this: automatic PII detection (names, emails, IBANs, addresses — 100+ languages, scanned files included), idempotent retries for autonomous loops, and rasterized output with nothing recoverable underneath. You can verify it works right now, without a key or signup:
# Keyless demo — a real redaction of a synthetic-PII sample
curl https://www.redact-pdf.ai/v1/demo
# → detected PII categories + a link to the redacted PDF
Why agents need a redaction step
Agents increasingly handle documents end-to-end: pull an attachment, extract data, file it, forward it. The moment a workflow shares a document onward — to another tool, another model, another person — unredacted PII becomes a liability. Text-scrubbing proxies exist for prompts, but they don't solve the document problem: the agent needs a redacted PDF file back, visually intact, with the sensitive content permanently removed.
That's a different job than masking strings. It needs OCR (scans and images), layout-preserving redaction, and irreversible output — if the "redacted" file still contains a hidden text layer, the agent just laundered a data leak into a workflow.
The agent-ready integration pattern
The full flow is three calls (plus an optional cleanup):
# 1. Upload — returns a job_id immediately (async)
curl -X POST 'https://www.redact-pdf.ai/v1/jobs' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'X-Idempotency-Key: agent-run-42' \
-F 'files=@contract.pdf;type=application/pdf' \
-F 'pii_categories=["Person","Email","PhoneNumber","IBAN"]'
# 2. Poll until status == "redacted"
curl 'https://www.redact-pdf.ai/v1/jobs/{job_id}' -H 'X-API-Key: YOUR_API_KEY'
# 3. Download the redacted PDF
curl -L 'https://www.redact-pdf.ai/v1/documents/{doc_id}/output' \
-H 'X-API-Key: YOUR_API_KEY' -o contract-redacted.pdf
Four properties matter specifically for autonomous use:
- Idempotency — pass
X-Idempotency-Keyand a retried request can't create a duplicate job or double-spend credits. Agents retry; the API should be safe when they do. - Ephemeral retention by default — originals are deleted after processing. The agent's upload doesn't become a second copy of the sensitive data sitting in someone's storage.
- Irreversible output — pages are rasterized, so there is no hidden text layer. The agent can pass the result downstream without re-checking it.
- Machine-readable docs — llms.txt, Markdown docs, and an OpenAPI spec. An agent (or the developer's coding assistant) can read the whole integration surface without parsing HTML.
Large files have a direct-to-blob path (POST /v1/jobs/init → PUT to a signed URL → commit) so gigabyte-scale uploads never stream through the API. Everything is documented in the developer docs.
What about MCP?
The Model Context Protocol is becoming the standard way to hand tools to Claude, ChatGPT, and other agents. Today's MCP redaction landscape is mostly text scrubbers — servers that mask PII in prompts and tool outputs. Useful, but they don't produce a redacted document.
The official Redact PDF AI MCP server is now published. It wraps the API above as agent tools, and unlike the text scrubbers it hands back an actual redacted PDF.
claude mcp add redact-pdf --env REDACT_PDF_API_KEY=your_key -- npx -y redact-pdf-mcp
It exposes six tools. redact_pdf_and_wait is the one you will use most: a single call that uploads, redacts, waits, and returns the finished file. The others (redact_pdf, get_job_status, download_redacted, get_account_status) exist for agents that would rather poll on their own schedule.
The tool worth knowing about is try_demo. It needs no API key at all, so an agent can confirm the server works before anyone signs up for anything.
The package is redact-pdf-mcp on npm, open source, and listed in the official MCP registry as io.github.dambuchs/redact-pdf-mcp. It is stateless and sends no telemetry.
If you are not using MCP, nothing changes: any framework that can make HTTP calls (LangChain, CrewAI, the OpenAI and Anthropic tool-use APIs, or a plain function) can call the REST API directly.
Choosing a redaction backend for your agent: a checklist
- Can you verify it without friction? A keyless test endpoint beats a sales call. Try /v1/demo.
- Is retry safe? Look for idempotency support — autonomous loops retry things.
- Is the output actually irreversible? Rasterized/flattened output, not annotation overlays.
- What happens to the uploaded original? Ephemeral retention should be the default, not a setting to find.
- Where does processing happen? For EU workloads: Redact PDF AI processes in Frankfurt and Switzerland on Azure, with no AI training on your documents.
- Does it handle scans? Agents receive photographed and scanned documents constantly; OCR must be built in.
Frequently asked questions
Can an AI agent redact a PDF without a human in the loop?
Yes — the API detects PII automatically and returns a permanently redacted file. For high-stakes documents you can keep a human review step: retention=studio keeps masks editable in a review UI before export.
Is there an MCP server for PDF redaction?
Yes. Most MCP "redaction" servers scrub text inside prompts; redact-pdf-mcp takes a PDF and returns a permanently redacted PDF. Install it with claude mcp add redact-pdf -- npx -y redact-pdf-mcp, or try its keyless try_demo tool first. It is on npm, GitHub, and the official MCP registry.
How does an agent test the API without an account?
GET https://www.redact-pdf.ai/v1/demo runs a real redaction on a fixed synthetic-PII sample and returns the detected categories plus a link to the redacted output. No key, no upload, no user data.
Which PII types are detected? Person, Email, PhoneNumber, Address, Organization, Date, IBAN, CreditCard — across 100+ languages with automatic language detection, on both digital and scanned PDFs.
In summary
Agents that touch documents need a redaction step, and it has to be a document redaction step — OCR, layout-preserved, irreversible — not a text mask. The Redact PDF AI API gives an agent that in three calls, or in one tool call through the MCP server, with a keyless demo to verify first. Start with the developer docs or read how to redact a PDF for the fundamentals.