Protect a PDF with a password
Protect PDF is an API that adds a password to a PDF, so it can only be opened with it. Great for sending payslips, contracts or sensitive data from n8n, Make or Zapier, with no servers to maintain.
How it works
You send a PDF and the password you want to set, and get back the same PDF protected: any PDF reader will ask for it before opening. Nothing is stored: it's generated on the fly.
To remove the password later, use Remove password (you need to know it).
All you need
- Your API key. Create it in your dashboard with "+ Create key". It's shown only once, so copy and save it.
- In your automation platform, an "HTTP Request" step (n8n, Make, Zapier, Pipedream… all have one).
How to use it in n8n (step by step)
You send your PDF as is (as binary data) and the password as a parameter. In the HTTP Request node:
- Method:
POST - URL:
https://api.cofferdock.com/pdf-protect - Send Query Parameters: on, and add
password= whatever password you want. - Send Headers: on → add two:
x-api-key= your key, andContent-Type=application/pdf - Send Body: on → choose the binary file option (in n8n: "n8n Binary File", with your PDF's binary property, usually
data) - Under Options → Response → Response Format: choose File
In Make (HTTP → Make a request module): same method and URL, password in Query String, the two headers, and the PDF as binary data in the body.
Options
| Option | Default | What it does |
|---|---|---|
password | - | Required. The password that will be asked for when opening the PDF. |
API overview
- Endpoint:
POST https://api.cofferdock.com/pdf-protect - Auth: header
x-api-key: YOUR_KEY. - Input: the PDF goes in the body as
application/pdf(raw, withpasswordas a Query param) or asapplication/jsonwith{ "file": "<base64>", "password": "..." }. - Output: by default, with
application/pdfit returns the binary; with JSON it returns base64 inpdf.output=pdf/output=jsonforces either. - Encryption: 256-bit AES (the recommended standard). An already-protected PDF can't be protected again without removing its current password first → 400.
- Limits: input PDF up to 20 MB (50 MB on Business/Scale) in
application/pdfmode, or ~4 MB real in JSON with base64. 30 requests/min per IP. 1 call = 1 credit.
Options
| Option | Default | Description |
|---|---|---|
password | - | Required. |
file | - | JSON mode only: the PDF in base64. |
output | per mode | pdf (binary) or json (base64). |
Examples
curl (raw PDF):
curl -X POST "https://api.cofferdock.com/pdf-protect?password=SuperSecret123" \
-H "x-api-key: YOUR_KEY" \
-H "Content-Type: application/pdf" \
--data-binary @document.pdf \
-o protected.pdf
JavaScript (Node 18+):
const fs = require('fs');
const r = await fetch('https://api.cofferdock.com/pdf-protect?password=SuperSecret123', {
method: 'POST',
headers: { 'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/pdf' },
body: fs.readFileSync('document.pdf'),
});
fs.writeFileSync('protected.pdf', Buffer.from(await r.arrayBuffer()));
Python:
import requests
r = requests.post(
'https://api.cofferdock.com/pdf-protect',
params={'password': 'SuperSecret123'},
headers={'x-api-key': 'YOUR_KEY', 'Content-Type': 'application/pdf'},
data=open('document.pdf', 'rb').read(),
)
open('protected.pdf', 'wb').write(r.content)
JSON mode (base64 response)
{ "file": "JVBERi0xLjQ…", "password": "SuperSecret123" }
→ { "success": true, "pdf": "JVBERi0xLjQ…", "mime_type": "application/pdf",
"meta": { "used": 12, "remaining": 488 } }
What you get back
The protected PDF itself, ready to save or send. (In JSON mode, the PDF comes in base64.)