Link Search Menu Expand Document

PDF Password And Security

Add password and security limitations to PDF or remove existing limits and password from existing PDF files.

Available Methods

Go To Samples

[POST] /pdf/security/add

  • url required. URL to the source file. Must be a String. You can pass link to file from Google Drive, Dropbox or another online file service that can generate shareable links. You can also use built-in PDF.co cloud storage located at https://app.pdf.co/files or upload your file as temporary file right before making this API call (see Upload and Manage Files section for more details on uploading files via API).
  • ownerPassword - The main owner password that is used for documents encryption and for setting/removing restrictions.
  • userPassword - The optional user password will be asked for viewing and printing document.
  • encryptionAlgorithm - Encryption algorithm. Valid values: RC4_40bit, RC4_128bit, AES_128bit, AES_256bit. AES_128bit or higher is recommended.
  • allowAccessibilitySupport - Allow or prohibit content extraction for accessibility needs. true/false. Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if user enters Owner Password.
  • allowAssemblyDocument - Allow or prohibit assembling the document. true/false. Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if user enters Owner Password.
  • allowPrintDocument - Allow or prohibit printing PDF document. true/false. Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if user enters Owner Password.
  • allowFillForms - Allow or prohibit filling of interactive form fields (including signature fields) in PDF document. true/false. Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if user enters Owner Password.
  • allowModifyDocument - Allow or prohibit modification of PDF document. true/false.Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if user enters Owner Password.
  • allowContentExtraction - Allow or prohibit copying content from PDF document. true/false.Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if user enters Owner Password.
  • allowModifyAnnotations - Allow or prohibit interacting with text annotations and forms in PDF document. true/false.Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if user enters Owner Password.
  • printQuality - Allowed printing quality. Valid values: HighResolution, LowResolution. Note: this restriction applies when userPassword (if any) is entered. This restriction does not apply if user enters Owner Password.

  • encrypt optional. Enable encryption for output file when stored in output cloud storage. Must be one of: true, false.

  • async optional. Runs processing asynchronously. Returns Use JobId that you may use with /job/check to check state of the processing (possible states: working, failed, aborted and success). Must be one of: true, false.

  • name optional. name of the output file.
  • expiration (optional). Output link expiration in minutes. Default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage. Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead.

  • profiles optional. Must be a String. You can set additional and extra options using this parameter that allows you to set custom configuration. See profiles samples for examples.

Description

  • Method: POST
  • URL: /v1/pdf/security/add

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/sample1.pdf",
    "ownerPassword": "12345",
    "userPassword": "54321",
    "EncryptionAlgorithm": "AES_128bit",
    "AllowPrintDocument": false,
    "AllowFillForms": false,
    "AllowModifyDocument": false,
    "AllowContentExtraction": false,
    "AllowModifyAnnotations": false,
    "PrintQuality": "LowResolution",
    "encrypt": false,
    "name": "output-protected.pdf",
    "async": false
}

Example responses

/pdf/security/add
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/eaa441ade38548b8a3a96d8014c4f463/sample1.pdf",
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "sample1.pdf",
    "remainingCredits": 616208,
    "credits": 14
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/security/add' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-merge/sample1.pdf",
    "ownerPassword": "12345",
    "userPassword": "54321",
    "EncryptionAlgorithm": "AES_128bit",
    "AllowPrintDocument": false,
    "AllowFillForms": false,
    "AllowModifyDocument": false,
    "AllowContentExtraction": false,
    "AllowModifyAnnotations": false,
    "PrintQuality": "LowResolution",
    "encrypt": false,
    "name": "output-protected.pdf",
    "async": false
}'

[POST] /pdf/security/remove

  • url required. URL to the source file. Must be a String. You can pass link to file from Google Drive, Dropbox or another online file service that can generate shareable links. You can also use built-in PDF.co cloud storage located at https://app.pdf.co/files or upload your file as temporary file right before making this API call (see Upload and Manage Files section for more details on uploading files via API).
  • password - The owner/user password to open file and to remove security features.

  • encrypt optional. Enable encryption for output file. Must be one of: true, false.
  • async optional. Runs processing asynchronously. Returns Use JobId that you may use with /job/check to check state of the processing (possible states: working, failed, aborted and success). Must be one of: true, false.
  • name optional. name of the output file.
  • expiration (optional). Output link expiration in minutes. Default is 60 (i.e. 60 minutes or 1 hour). After this delay generated output file(s) (if any) will be auto-removed from PDF.co temporary files storage. Max allowed expiration period depends on your current subscription plan. To store permanent input files (e.g. re-usable images, pdf, documents), please use PDF.co built-in Files Storage instead.
  • profiles optional. Must be a String. You can set additional and extra options using this parameter that allows you to set custom configuration. See profiles samples for examples.

Description

  • Method: POST
  • URL: /v1/pdf/security/remove

Query parameters

No query parameters accepted.

Body payload

{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-security/ProtectedPDFFile.pdf",
    "password": "admin@123",
    "name": "unprotected"
}

Example responses

/pdf/security/remove
{
    "url": "https://pdf-temp-files.s3.amazonaws.com/9f2a754f76db46ac93781b3d2c6694c3/ProtectedPDFFile.pdf",
    "pageCount": 1,
    "error": false,
    "status": 200,
    "name": "ProtectedPDFFile.pdf",
    "remainingCredits": 616187,
    "credits": 21
}

Code Snippet

CURL
curl --location --request POST 'https://api.pdf.co/v1/pdf/security/remove' \
--header 'x-api-key: ' \
--data-raw '{
    "url": "https://bytescout-com.s3-us-west-2.amazonaws.com/files/demo-files/cloud-api/pdf-security/ProtectedPDFFile.pdf",
    "password": "admin@123",
    "name": "unprotected"
}'

Samples