How to Password-Protect PDFs in an Agent Workflow
The documents that need passwords — statements, payslips, contracts — are exactly the ones produced in batches at the end of some other workflow. Which is why protection gets skipped: it's one more desktop-tool detour between “files are ready” and “files are sent.”
With Apdf connected over MCP, encryption is just another step the agent runs in the same conversation that produced the files — and, because the agent can read PDFs too, it verifies the lock actually held before anything leaves.
Connect the agent to Apdf
claude mcp add --transport http apdf https://apdf.io/mcp/main
Same endpoint in Claude Desktop (Settings → Connectors), Cursor, or anything else that speaks MCP — one OAuth sign-in, scoped to your workspace.
Lock it — and prove the lock held
The add-pdf-security call returns the protected
file:
{
"file": "https://apdf-files.s3.eu-central-1.amazonaws.com/73a991466a61e112b0f61.pdf",
"expiration": "2026-07-23T10:38:26.955862Z"
}
And the verification probe shows what an outsider sees — which is the point:
{
"title": null,
"creator": null,
"producer": null,
"created": null,
"modified": null,
"pages": 0,
"encrypted": true,
"page_size": null,
"file_size": 8396,
"pdf_version": null
}
Unlock when the archive needs it back
{
"title": null,
"creator": "pdf-lib (https://github.com/Hopding/pdf-lib)",
"producer": "pdf-lib (https://github.com/Hopding/pdf-lib)",
"created": "Thu Jul 23 11:10:06 2026 CEST",
"modified": "Thu Jul 23 11:10:06 2026 CEST",
"pages": 9,
"encrypted": false,
"page_size": "595 x 842 pts (A4)",
"file_size": 7355,
"pdf_version": "1.7"
}
Chain it with the other tools and the whole delivery pipeline is one conversation: split the batch into per-client files, protect each with its client's password, verify, ship.
Where to go from here
The same connection carries every PDF operation — and the engagement layer behind them.
Related tutorials
Batch Password Protect PDFs for GDPR Compliance
This tutorial shows how to automatically password-protect sensitive documents like payslips and medical records before emailing. Using JavaScript and the Apdf Security API, you can batch-process documents with user-specific passwords for GDPR compliance.
Search a PDF From Your Editor
The integration spec is a PDF and your questions arrive mid-function. With the editor connected over MCP, 'what's the retry policy?' comes back with the exact line and page — and a regex search turns 'list every error code' into one call with three cited matches.
Watermark Draft PDFs via Claude Before Sharing
The draft that leaks is the one you didn't stamp. Conversationally it's one message: the agent designs the translucent DRAFT — CONFIDENTIAL stamp itself with the PDF generator, overlays it across every page, renders a page to prove it looks right — and mints one named copy per reviewer.
Your code made the PDF.
Then it went dark.
Opened, read, re-read, dropped on page 4 — you never see any of it. Share the PDFs you generate through Apdf recipient links, and every signal becomes something you can act on: ping Slack, update the CRM, let an agent follow up. Same account, same API token, one more call.
API · Webhook · MCP