Protect PDF API

Purpose

This API allows you to password protect a PDF file or overwrite the permissions of an already protected PDF file.

HTTP Request URL

https://{zohoapis_domain}/pdfeditor/api/v1/pdf/protect

Body Parameters

ParameterData TypeDescription
Mandatory Parameters
file

File

or

String

Upload the PDF file which needs to be password protected using one of the following methods:

  • Upload the PDF directly from your local drive or desktop.
  • If the PDF is available via a publicly accessible web URL, you can provide the URL using the same parameter.

Note: The maximum file size allowed for the input PDF is 50 MB. It cannot be more than 150 pages.

input_options

{

  "password": ***

}

If the input PDF is already password protected, specify the password to unlock it.
output_settings{
  "name": "<document_name>",
  "encryption_algorithm": "AES128 | AES256 | RC4128", 
  "password": ****,  
  "restrictions": 
  {  
     "password": ****,
     "permissions": ["document.copy", "document.copy.accessibility", "document.fill", "document.print", "document.print.low_quality", "document.annotate", "document.assemble_document"]
    }
}

Specify the output PDF protection settings. 

name(optional) – Name of the output PDF after protection.


encryption_algorithm(optional) – Encryption type.

Supported values: AES128, AES256, RC4128.

Default value: AES128.

Note: AES256 is supported only for PDF version 1.7 or above.


password(optional) – Specify the password to be set for the output PDF. Allowed character limit: 6 to 255.


restrictions(optional)
 – password: Specify the password to enable or override the restricted permissions. Allowed character limit: 6 to 255.
 – permissions: Specify the actions that needs to be restricted in the PDF.

Note: If restrictions param is passed, then both password and permissions fields are mandatory.

Note: To use this API, an OAuth token should be generated with the following scopes: ZohoWriter.pdfEditor.ALL

permissions

Permission Key NameDescription

document.copy

Copy content from the PDF.

document.copy.accessibility

Copy content for use with accessibility tools (e.g., screen readers).

document.fill

To fill in form fields within the PDF.

document.print

Print content from the PDF.

document.print.low_quality

Print the PDF in low quality.

document.annotate

To add comments, annotations, or markups to the PDF.

document.assemble_document

To insert, rotate, delete, or rearrange pages in the PDF.

Sample Request

Copiedcurl --location --request POST "https:///www.zohoapis.com/pdfeditor/api/v1/pdf/protect" \
  --header "Authorization: Zoho-oauthtoken xxx.yyy.zzz" \
  --form 'file=@/Users/username/Documents/Original.pdf' \
  --form 'input_options={"password": "abc123"}' \
 --form 'output_settings={"name": "protected_document.pdf", "encryption_algorithm": "AES256", "password": "user123", "restrictions": {"password": "owner123", "permissions": ["document.copy", "document.print", "document.fill"]}}'

Once the process begins, you will initially receive the 'status_url'. By invoking the 'status_url', you will be able to monitor the status of the scheduled job.

Sample Response

Copied{
	"status_check_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/protect/job/f931a01183b33",
	"status": "inprogress"
}

Success Response

Copied{
	"download_url": "https://pdf.zoho.com/pdfeditor/api/v1/pdf/protect/download/f931a01183b33",
	"status": "success"
}