Protect PDF Files with a Password via API
Add password protection to any PDF document via REST API. Upload your file and password as multipart/form-data and receive an encrypted PDF in response. Perfect for securing sensitive documents in automated workflows.
# Protect a PDF with a password
curl -X POST \
https://api.convertfilefast.com/v2/pdf/protect \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "file=@document.pdf" \
-F "password=MySecretPassword123" \
--output protected.pdf
# HTTP 200 OK — Content-Type: application/pdfimport requests
response = requests.post(
"https://api.convertfilefast.com/v2/pdf/protect",
headers={"Authorization": "Bearer YOUR_API_KEY"},
files={"file": open("document.pdf", "rb")},
data={"password": "MySecretPassword123"}
)
with open("protected.pdf", "wb") as f:
f.write(response.content)const formData = new FormData();
formData.append("file", fs.createReadStream("document.pdf"));
formData.append("password", "MySecretPassword123");
const response = await fetch(
"https://api.convertfilefast.com/v2/pdf/protect",
{
method: "POST",
headers: { "Authorization": "Bearer YOUR_API_KEY" },
body: formData,
}
);
fs.writeFileSync("protected.pdf", Buffer.from(await response.arrayBuffer()));// n8n HTTP Request Node
{
"method": "POST",
"url": "https://api.convertfilefast.com/v2/pdf/protect",
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{ "name": "file", "parameterType": "formBinaryData", "inputDataFieldName": "data" },
{ "name": "password", "value": "MySecretPassword123" }
]
},
"options": { "response": { "responseFormat": "file" } }
}Advantages
Why use our API?
Complete and reliable solution for integration in any tech stack.
Strong Encryption
PDF files are encrypted with AES-256 standard. Password-protected PDFs cannot be opened without the correct password.
Simple Multipart Upload
Upload your PDF and password as form fields. Receive the protected PDF binary in response. No complex configuration.
Automation Ready
Integrate password protection into document generation pipelines. Protect contracts, invoices, and reports automatically.
n8n Workflow Support
Trigger PDF protection from any n8n workflow — after generating a report, receiving an email, or completing a form.
Bulk Protection
Loop through batches of PDF documents and protect each one with a unique or shared password via API calls.
Zero Storage
Both the original and protected PDFs are processed in memory and deleted immediately. Your documents are never stored.
How it works
4 steps to run this conversion
- 1
Create an API key
Sign up at convertfilefast.com/signup and copy your cff_ API key from the dashboard. The free tier includes 10 conversions per month.
- 2
POST the PDF to the endpoint
Send a multipart/form-data POST to https://api.convertfilefast.com/v2/pdf/protect with header X-API-Key: cff_your_key (Authorization: Bearer also works), the PDF as a file field or a public url field, and a password field.
- 3
Receive the PDF
The response body is the resulting PDF, streamed back with a Content-Disposition filename. Save it or pass it straight to the next step of your pipeline — nothing is stored on our side.
- 4
Or invoke it from an AI agent
Add the MCP server to Claude, Cursor or any MCP-compatible client using https://mcp.convertfilefast.com/mcp, then call protect_pdf({ source_url: '...', password: 's3cret' }) as a single tool call — no HTTP client, no file handling.
Or call this from Claude, Cursor, or any MCP client
Convert File Fast ships a native Model Context Protocol server. Give this conversion to an AI agent as a single tool call — no HTTP client, no binary handling, per-user API keys.
npx -y convertfilefast-mcpprotect_pdf({ source_url: "https://example.com/doc.pdf", password: "s3cret" })Compared with
Convert File Fast vs alternatives
| Product | Native MCP | Free tier | Price |
|---|---|---|---|
| Convert File Fast | Yes | 10/month | $0.004/conv from $4 |
| Smallpdf | No | 2/day (unregistered) | $9/mo Pro |
| iLovePDF | No | Rate-limited | $7/mo Premium |
| Adobe Acrobat Online | No | Limited trials | $19.99/mo Acrobat Standard |
| CloudConvert | No | 25 conv-min | From $0.01/min |
Competitor pricing checked on 2026-07-16.
FAQ
Frequently Asked Questions
What encryption does the Protect PDF API use?
Protected files are encrypted with the AES-256 standard. Once the PDF is returned, it cannot be opened in any reader without the password you supplied — the protection travels with the file, not with our service.
How do I send the file and the password?
Post both as `multipart/form-data`: a `file` field with the PDF and a `password` field with the password string. The response body is the encrypted PDF binary, ready to store or forward without any extra step.
Can I protect many PDFs with different passwords?
Yes. Each call handles one document, so loop through your batch and pass a different `password` per request when documents belong to different recipients, or reuse one password for an internal archive.
Are my documents stored after processing?
No. The original and the protected PDF are both handled in memory and discarded as soon as the response is sent. Nothing is written to disk, which is why the same endpoint is safe for contracts, invoices, and payroll files.
Related Tools
Start Protecting PDFs via API
Get your API key and add password protection to PDF files in seconds. Free plan includes 10 conversions per month.
No credit card. 10 free conversions on Free plan.