Encrypt PDFs
Lock a PDF with a password, or let it open freely but restrict what readers may do with it.
POST https://api.pdfdispatch.com/v1/pdf/encrypt
Form fields
| Field | Type | Default | What it does |
|---|---|---|---|
files required | file(s) | – | The PDFs to protect. |
userPassword | string | – | The password needed to open the PDF. Leave it out for a PDF that opens freely but keeps the restrictions below. |
ownerPassword | string | – | The password that lifts all restrictions. Without it, it is the same as userPassword. One of the two is required. |
allowPrinting, allowCopying, allowModifying, allowAnnotating, allowFillingForms, allowAssembling | boolean | true | Set any to false to forbid printing, copying text and images, changing content, adding comments, filling forms, or inserting, removing and rotating pages. |
The same fields work on every conversion route, so a new PDF can be born protected.
Examples
A payslip that needs a password to open, and that cannot be changed:
curl --fail-with-body \
--header "Authorization: Bearer $PDD_KEY" \
--form files=@payslip-2026-10.pdf \
--form userPassword=8813-2026 \
--form ownerPassword="$OWNER_SECRET" \
--form allowModifying=false \
--form allowAssembling=false \
--output payslip-2026-10-protected.pdf \
https://api.pdfdispatch.com/v1/pdf/encrypt
A brochure that opens without a password but cannot be printed:
curl --fail-with-body \
--header "Authorization: Bearer $PDD_KEY" \
--form files=@brochure.pdf \
--form ownerPassword="$OWNER_SECRET" \
--form allowPrinting=false \
--output brochure-locked.pdf \
https://api.pdfdispatch.com/v1/pdf/encrypt
Good to know
- A restriction without any password is refused (
400): there would be nothing to stop someone lifting it. - Permissions are honoured by PDF viewers, not enforced by the encryption itself. Someone with the user password and the wrong tool can still copy the content. Use the open password for what must stay secret.
- PDF/A cannot be encrypted.
- Passwords travel in the request body over HTTPS. We do not keep them.