Encrypt PDFs
Encrypts one or more PDF files with a user and/or owner password.
Set passwords to control PDF access. The user password is required to open the PDF; the owner password controls permissions (printing, copying, editing).
Encryption strength (e.g., AES-256) depends on the active PDF Engine. See PDF Engines Configuration.
POST/forms/pdfengines/encrypt
Headers
Gotenberg-Output-Filenamestring
The filename of the resulting file - Gotenberg automatically appends the file extension. Defaults to a random UUID filename.
Gotenberg-Tracestring
A custom request ID to identify the request in the logs; overrides the default UUID.
Form Fields
userPasswordstringrequired
The password required to open the PDF.
ownerPasswordstring
The password required to change permissions or edit the PDF.
Form Files
filesfile[]required
PDF files to encrypt.
Example Request
cURL
curl \
--request POST http://localhost:3000/forms/pdfengines/encrypt \
--form files=@/path/to/file.pdf \
--form userPassword=open \
--form ownerPassword=manage \
-o my.pdf
Responses
- 200
- 400
- 503
The encrypted PDF file.
Content-Disposition: attachment; filename={output-filename.pdf}
Content-Type: {content-type}
Content-Length: {content-length}
Gotenberg-Trace: {trace}
Body: {output-file}
The request had one ore more invalid form fields.
Content-Type: text/plain; charset=UTF-8
Gotenberg-Trace: {trace}
Body: {error}
The request did not complete within the configured maximum duration.
Content-Type: text/plain; charset=UTF-8
Gotenberg-Trace: {trace}
Body: Service Unavailable

