Skip to main content

Unlock PDF in n8n

Unlock PDF is a PDF4me node action in n8n that removes password protection from a PDF when you supply the correct password. Use it to make protected files readable by later workflow steps, clear encryption from an archive you own, or unlock every statement a supplier sends without opening them one at a time.

What this node does

PDF4me: Unlock PDF takes a protected PDF from Binary Data, a Base64 String, or a URL, applies the password you provide, and returns a copy that opens without a prompt. The Password field is required, so this unlocks documents you are already authorised to open rather than recovering a lost password. Its usual job is to sit at the front of a pipeline, because extraction and conversion steps cannot read an encrypted file.

Related Blog Posts
No blog post yet for this feature — coming soon.
In the meantime, browse the PDF4me blog for tutorials and workflows across every platform.
Visit the blog

Authenticating Your API Request

Every PDF4me node in n8n requires a valid Credential to connect with. Create or select one that holds your PDF4me API key so the workflow can authenticate unlock requests securely.

Important Facts You Should Not Miss

The password is required
This is not a password recovery tool. Without the correct password the document cannot be unlocked through this action.
Unlock before you extract
Text, table, and form extraction cannot read an encrypted PDF, so this node usually belongs at the very start of the workflow.
Keep the password out of the workflow file
Reference a credential or environment variable rather than typing the secret in, so it is not carried in exported workflow JSON.
PDF4me node in n8n set to Action Unlock PDF, Input Data Type Binary Data, Input Binary Field data, Output File Name unlocked_output.pdf, a masked Password field, and Binary Data Output Name data

PDF4me Unlock PDF parameters panel in n8n

Unlock PDF vs Protect Document

These two actions are opposites, and workflows often use both: unlock an incoming file to read it, then re-protect the result before it goes back out.

AspectUnlock PDFProtect Document
What it doesRemoves existing password protectionApplies password protection
Password you supplyThe current password on the documentThe new password you want to set
Typical positionFirst step, so later nodes can read the fileLast step, before the file is sent or stored
PrerequisiteYou must already know the passwordNone beyond the source document

What Parameters Does Unlock PDF Need?

Required: Action, Input Data Type, the field matching that input type, Output File Name, and Password. Binary Data Output Name and Custom Profiles carry working defaults.

ParameterRequiredWhat it doesExample
ActionRequiredSelects the PDF4me node action to run. Choose Unlock PDF.Unlock PDF
Input Data TypeRequiredFormat of the source PDF input. Choose Binary Data (from a previous node), Base64 String, or URL.Binary Data
Input Binary FieldConditionalName of the binary property on the incoming n8n item that holds the protected PDF. Required when Input Data Type is Binary Data. Defaults to data.data
Base64 Document ContentConditionalBase64-encoded content of the protected PDF. Required when Input Data Type is Base64 String.JVBERi0xLjQK...
File URLConditionalPublicly reachable HTTPS URL to the protected PDF. Required when Input Data Type is URL.https://example.com/statement.pdf
Output File NameRequiredFilename for the unlocked PDF returned by the node. Include the .pdf extension.unlocked_output.pdf
PasswordRequiredThe current password on the document. Shown masked in the panel. Reference a credential or environment variable rather than typing the secret into a saved workflow.{{ $env.PDF_PASSWORD }}
Binary Data Output NameOptionalName of the binary property the output item exposes. Defaults to data.data
Custom ProfilesOptionalAdvanced Options field for extra processing settings, supplied in a JSON-like format. Leave blank unless you have a specific profile to apply.{ "preserveMetadata": true }

Output Fields

A successful run returns one n8n item carrying the unlocked PDF.

FieldTypeWhat it contains
Binary (data)BinaryThe unlocked PDF, under Binary Data Output Name (default data).
fileNameStringGenerated filename, matching Output File Name.
docNameStringName of the processed document, for reference and tracking.
mimeTypeStringMIME type of the output, always application/pdf.
fileSizeNumberSize of the returned PDF in bytes.
isUnlockedBooleanConfirms the document was unlocked. A useful assertion before handing the file to an extraction step.
securityRemovedBooleanConfirms password protection and access restrictions were removed.
successBooleanTrue when the unlock completed, false on failure such as a wrong password. Use it to branch error handling.
messageStringHuman-readable status message, carrying success confirmation or error detail.

How Do I Set Up Unlock PDF in n8n?

  1. Add PDF4me to your n8n workflow and choose the Unlock PDF action.
  2. In Credential to connect with, select your PDF4me credential or click Create New Credential and paste your API key.
  3. Set Input Data Type to Binary Data (default), Base64 String, or URL and supply the matching source PDF field.
  4. Set Output File Name for the unlocked file, ending in .pdf.
  5. Enter the document Password, ideally as an expression that reads a credential or environment variable.
  6. Leave Binary Data Output Name as data unless a later node expects a different property.
  7. Execute the node and route the unlocked PDF into the next step, such as extraction, conversion, or storage.

Typical Setups

Workflow ExamplesCommon n8n workflow patterns using Unlock PDF.
Read protected bank statements
  1. A statement arrives by email protected with a known password.
  2. Unlock PDF removes the protection using a stored secret.
  3. A table extraction step reads the transactions into a sheet.
Clear encryption from an owned archive
  1. Legacy documents in a shared drive all carry the same old password.
  2. Unlock PDF runs over each file during a migration batch.
  3. The unprotected copies land in the new document system, searchable.
Unlock, process, then re-protect
  1. Unlock PDF opens an incoming protected document.
  2. The workflow stamps, merges, or edits the readable file.
  3. Protect Document applies a fresh password before it is sent back out.
Guard the pipeline with a success check
  1. Unlock PDF attempts the stored password on each arriving file.
  2. An IF node tests the returned success and isUnlocked fields.
  3. Failures route to an alert so a rotated password is noticed immediately.

Practical Tips

Never hardcode the password
Use an expression that reads an n8n credential or environment variable, so the secret does not travel inside exported workflow JSON.
Put the unlock first
Extraction and conversion nodes cannot read an encrypted PDF, so unlocking early avoids confusing downstream failures.
Alert on a failed unlock
A rotated password will fail every run. Branch on success so it surfaces as an alert rather than a pile of stuck items.
Assert on isUnlocked before extracting
Checking the flag is cheaper than debugging an extraction node that received a file it could not open.
Only unlock what you are authorised to
The action needs the real password by design. Confirm you have the right to remove protection before automating it across an archive.
re-protect before sending outward
If the document leaves your systems again, add Protect Document at the end so the unlocked copy is not what gets distributed.

Cheat Sheet

FieldValue
ActionUnlock PDF
Input Data TypeBinary Data
Input Binary Fielddata
Output File Nameunlocked_output.pdf
Password{{ $env.PDF_PASSWORD }}
Binary Data Output Namedata
CredentialsPDF4me API credential

Common Questions

Can Unlock PDF open a PDF when I do not know the password?+
No. The Password field is required and must match the password set on the document. The node removes protection from files you are already authorised to open; it is not a password recovery or cracking tool. If nobody in your organisation holds the password, the document cannot be unlocked through this action.
Where should I store the PDF password in n8n?+
Avoid typing it directly into the Password field on a saved workflow. Reference an n8n credential or an environment variable through an expression instead, so the secret is not stored in the workflow JSON that gets exported, shared, or committed to version control.
Does unlocking remove permission restrictions as well as the open password?+
The action removes the password protection so the returned file opens without a prompt, and the response includes a securityRemoved flag confirming restrictions were lifted. Encryption and permission handling are defined in the ISO 32000 PDF specification, so check that flag on a representative document before assuming a specific restriction such as printing or copying is gone.
Why unlock PDFs in a workflow instead of one at a time?+
Downstream steps such as text extraction, table parsing, and conversion cannot read an encrypted PDF. Putting Unlock PDF at the front of the workflow means every protected file that arrives is made readable automatically, rather than stalling the pipeline until someone opens each one by hand.
What happens if the password is wrong?+
The run fails rather than returning a partially unlocked file. Branch on the returned success boolean so a wrong or rotated password raises an alert instead of silently passing the still-encrypted original to the next step, where it would fail again less obviously.

Same Task on Other Platforms

Get Help