The Protect PDF endpoint secures a PDF document by applying password protection and permission restrictions.
You can encrypt the PDF using AES-128 or AES-256, set user and owner passwords, and control which actions are allowed, such as printing, copying, or editing.
File type: .pdf
The PDF file to be processed. Used when uploading a new file directly.
The ID of an already uploaded file stored on our server.
Default: AES256
Specifies the encryption algorithm. AES256 offers the highest security, while AES128 ensures better compatibility with older PDF readers.
Password required to open the PDF. If not provided, the document will be accessible without a password unless restrictions depend on the owner password.
Password that grants full control over the PDF, including the ability to change permissions or remove restrictions. Must not be empty if AES256 is used and a userPassword is defined.
When true, prevents the PDF from being printed.
When true, disables copying or text/image extraction from the document.
When true, prevents modifications to the document (e.g., form editing or annotation changes).
Default: false
Determines whether the document metadata (title, author, keywords, etc.) should be encrypted. If set to false, metadata remains visible without decryption.
Default: false
Returns JSON response instead of file stream.
Minimum: 60 seconds
Maximum: 86400 seconds (24 hours)
Use this to control temporary authorized access to files. After this duration, the URL automatically expires and can no longer be used to download the PDF. The value must be provided in seconds.
If you need to generate a new pre-signed URL for an existing document, use the Get Document endpoint.
Sets custom data to your document record.
1curl -X POST "https://api.pdfgate.com/protect/pdf" \2 -H "Authorization: Bearer YOUR_API_KEY" \3 -F "file=@YOUR_FILE.pdf" \4 -F "ownerPassword=ownerPassword" \5 -F "userPassword=userPassword" \6 -F "disablePrint=true" \7 -F "disableCopy=true" \8 -F "disableEditing=true" \9 --output protected.pdf1File stream1{2 "id" : "6642381c5c61",3 "status" : "completed",4 "fileUrl" : "https://api.pdfgate.com/file/open/:preSignedUrlToken",5 "size" : 1620006,6 "type" : "encrypted",7 "derivedFrom" : "68f920bacfe16de217f019as",8 "createdAt" : "2024-02-13T15:56:12.607Z"9}