xtract.bot
POST /api/pdf-encrypt

Password-protect a PDF. Set a user password (open document) and optionally a separate owner password (change permissions). Restrict printing, modifying, or copying.

Returns a new PDF that requires the supplied user password to open and applies the requested permission restrictions when opened with that password. Two passwords are supported: - `userPassword` (required) — what an end-user types to view the document. - `ownerPassword` (optional) — privileged credential that can change permissions and remove encryption. Defaults to the user password if omitted, but supplying a distinct owner password is the standard pattern for redistributable PDFs. Permissions default to fully permissive; pass `false` for any of `allowPrinting` / `allowModifying` / `allowCopying` to lock that capability behind the owner password. PDF permission bits are advisory — most viewers honour them but they are not strictly enforced.

Inputs

NameTypeDefaultDescription
pdf*fileBase64-encoded source PDF to encrypt.
userPassword*stringPassword the end-user types to open the document. 1–256 chars.
ownerPasswordstringOwner password for permission management. Defaults to the user password if omitted. 0–256 chars.
allowPrintingbooleantrueAllow printing when opened with the user password. Default: true.
allowModifyingbooleantrueAllow modifying / annotating / form-filling. Default: true.
allowCopyingbooleantrueAllow text / image copy-out. Default: true.
ignoreEncryptionbooleanRe-encrypt an already-encrypted source. Default: false (encrypted input is rejected).

Response

Modes: binary, json. Cache: yes (24h TTL).