Protect PDF

Open in ChatGPT Open in ChatGPT to ask questions about this page
Open in Claude Open in Claude to ask questions about this page
Copy as MarkdownCopy this page as markdown to use with AI assistants
View as Markdown Open this page as markdown in a new tab

Applies password protection and permission restrictions to a PDF, and makes the protected PDF available for download.


Restrictions Password: If output_settings.restrictions is omitted, output_settings.password is also used as the password for modifying or removing the protection.

Endpoint

OAuth Scope

ZohoWriter.pdfEditor.ALLCopied!

Request Example

cURL
cURL
Java
Python
Deluge
Copied!
curl --request POST \
  --url https://www.zohoapis.com/pdfeditor/api/v1/pdf/protect \
  --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \
  --header 'content-type: multipart/form-data' \
  -F 'file=@file_path' \
  -F 'output_settings={
  "name": "quarterly-review-protected.pdf",
  "password": "OpenSesame123",
  "encryption_algorithm": "AES128",
  "restrictions": {
    "password": "OwnerPass456",
    "permissions": [
      "document.print",
      "document.copy"
    ]
  }
}' \
  -F 'input_options={
  "password": "OpenSesame123"
}'

Request Body

multipart/form-data
filebinary(Required)

The source PDF to protect, uploaded directly or imported from a publicly accessible URL. The file must be no larger than 50 MB, contain no more than 400 pages, and have no page larger than 2,400 square inches. Its filename must not exceed 255 characters. Supported formats: pdf.

Example
quarterly-review.pdf
output_settingsJSON Object(Optional)

Configures the protected PDF's filename, passwords, encryption, and permission restrictions.

Example
{
  "name": "quarterly-review-protected.pdf",
  "password": "OpenSesame123",
  "encryption_algorithm": "AES128",
  "restrictions": {
    "password": "OwnerPass456",
    "permissions": [
      "document.print",
      "document.copy"
    ]
  }
}
Show Sub-Attributes
namestring(Optional)

The filename for the protected PDF. A .pdf extension is appended when the name does not already end with one.

Example
quarterly-review-protected.pdf
Default Value :protected.pdfprotected.pdfCopied!
Maximum Length :255255Copied!
passwordstring(Optional)

The password required to open the protected PDF. If omitted, the protected PDF can be opened without a password.

Example
OpenSesame123
Minimum Length :66Copied!
Maximum Length :255255Copied!
encryption_algorithmstring(Optional)

The encryption algorithm used to protect the PDF. AES256 requires the source PDF to be version 1.7 or later; an older source PDF causes the request to fail.

Example
AES128
Allowed Values :
Show Values ▾
AES128Copied!
AES256Copied!
RC4128Copied!
Copied!Copy all as JSON Array
Default Value :AES128AES128Copied!
restrictionsJSON Object(Optional)

Applies permission restrictions to the protected PDF. Unlike password, which controls opening the PDF, restrictions limits what can be done with it once it is open. If omitted, only editing is restricted.

Example
{
  "password": "OwnerPass456",
  "permissions": [
    "document.print",
    "document.copy"
  ]
}
Show Sub-Attributes
passwordstring(Required)

The password required to modify or remove the restrictions applied to the protected PDF.

Example
OwnerPass456
Minimum Length :66Copied!
Maximum Length :255255Copied!
permissionsarray[string](Required)

The actions to disable on the protected PDF, up to 10 values. Actions not listed remain allowed, except document.edit, which is always disabled.
Supported values:
document.copy — Restricts copying content from the PDF.
document.copy.accessibility — Restricts content extraction for accessibility tools.
document.edit — Restricts editing the PDF.
document.fill — Restricts filling form fields, and also disables annotation editing regardless of document.annotate.
document.print — Restricts printing the PDF.
document.print.low_quality — Has no effect on the protected PDF.
document.annotate — Restricts adding or modifying annotations.
document.assemble_document — Restricts inserting, deleting, or rotating pages.

Example
[
  "document.print",
  "document.copy"
]
Allowed Values :
Show Values ▾
document.copyCopied!
document.copy.accessibilityCopied!
document.editCopied!
document.fillCopied!
document.printCopied!
document.print.low_qualityCopied!
document.annotateCopied!
document.assemble_documentCopied!
Copied!Copy all as JSON Array
Range :[0 .. 10][0 .. 10]
input_optionsJSON Object(Optional)

Configures how the source PDF is unlocked before protection is applied.

Example
{
  "password": "OpenSesame123"
}
Show Sub-Attributes
passwordstring(Optional)

The password to unlock the source PDF, if it is password-protected.

Example
OpenSesame123
Maximum Length :255255Copied!

Body Parameters

Copied!
// Note: payload contains multiple type attributes

// type: file
file = quarterly-review.pdf

// type: object
output_settings = {
  "name": "quarterly-review-protected.pdf",
  "password": "OpenSesame123",
  "encryption_algorithm": "AES128",
  "restrictions": {
    "password": "OwnerPass456",
    "permissions": [
      "document.print",
      "document.copy"
    ]
  }
}

// type: object
input_options = {
  "password": "OpenSesame123"
}
▼ Show full

Response Example

200
Copied!
  {
    "status": "inprogress",
    "status_check_url": "https://www.zohoapis.com/pdfeditor/api/v1/pdf/protect/job/3f65c7592a741d98e46bf310cbe678f574a1d51fce306a8d9b6430217e538acd"
  }
                
▼ Show full

Rate Limits

Duration1 minute
Threshold50
Lock Period5 minutes 30 seconds
Duration1 hour
Threshold200
Lock Period15 minutes
Duration1 day
Threshold2000
Lock Period2 hours

Duration - Time window for the threshold.
Threshold - Number of API calls allowed within the specified duration.
Lock Period - Wait time before consecutive API requests.