Protect PDF API

Encrypt and secure PDF documents before distribution.

check-mark-icnNo credit card required

Protect PDF API Overview

The Protect PDF API allows you to apply encryption, passwords, and permission rules to PDF documents as part of an automated document workflow. It is designed for use cases where access to PDFs needs to be controlled and sensitive content must be protected before sharing or storage.

Protecting a PDF helps prevent unauthorized access, editing, or copying of document content. This is commonly used to secure documents that contain confidential information, legal data, or internal business materials.

This endpoint can be used on its own or combined with other PDFGate endpoints. A typical workflow includes generating a PDF, applying protection rules to restrict access or permissions, and then distributing the secured document to end users.

The Protect PDF API is well suited for SaaS platforms, internal systems, and document automation workflows that require consistent, programmatic PDF security without manual intervention.

Useful Guides

Quick Start


Get started quickly with a single API call. This endpoint fits easily into your existing workflows and works with any language that can make HTTP requests, including Node.js, Python, PHP, and more. Use the examples to protect a PDF in just a few steps.

CURL
NODE.JS
PYTHON
GO
PHP
JAVA
C#
RUBY
copy-integration-source-code-icon
curl -X POST "https://api.pdfgate.com/protect/pdf" \ -H "Authorization: Bearer YOUR_API_KEY" \ -F "file=@YOUR_FILE.pdf" \ -F "ownerPassword=ownerPassword" \ -F "userPassword=userPassword" \ -F "disablePrint=true" \ -F "disableCopy=true" \ -F "disableEditing=true" \ --output protectedFile.pdf

API Parameters

File

The PDF file you want to protect. You must provide either this or documentId.

Document Id

The ID of a PDF that already exists in your PDFGate account. Use this instead of uploading a file again.

Algorithm

The encryption algorithm to use. Defaults to AES256. Acceptable values: AES256, AES128.

User Password

Password required to open the protected PDF. If not provided, the document can still be accessed but user-level protection may not apply.

Owner Password

Owner password granting full control over the PDF, including the ability to change permissions or remove restrictions.

Disable Print

When set to true, prevents the PDF from being printed.

Disable Copy

When true, disables copying or extraction of text and images from the document.

Disable Editing

When true, prevents modifications to the PDF, such as annotation or content changes.

Encrypt Metadata

Determines whether the document’s metadata (title, author, keywords, etc.) should be encrypted. Defaults to false.

Json Response

If it is set to true, the API will return a JSON response instead of the PDF file.

Pre Signed Url Expires In

Expiration time (in seconds) for the generated temporary download URL.

Metadata

Custom metadata you want to attach to the document.