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 links, events and signatures 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.
How to Convert Word and PowerPoint Files to PDF by Asking Claude
Paste the links, get PDFs back. Connect Claude to Apdf over MCP and convert decks and documents conversationally — then let the agent store the PDF as a tracked document and mint a personal link for the client.
Extract the Answers from Filled PDF Forms with an AI Agent
Fillable PDFs already store every answer in a named field — no zones to draw, no parser to train. Hand an agent connected to Apdf a stack of returned applications and it reads each form's fields into one CSV, flags the applicant who skipped a required answer, and catches the copy that came back flattened.
Your code made the PDF.
Then it went dark.
Opened, read, signed or ignored — you never see any of it. Send the PDFs you generate as personal links, and every open, page read, comment and signature comes back to your software as a webhook. Need it signed? Same link. Same account, same API key, one more call.
API · Webhook · MCP