Skip to main content

Secure Word Document in n8n

Secure Word Document is a PDF4me node action in n8n that locks a .docx file with a password, an editing restriction, or both. Use it to protect confidential reports before they are sent, keep a signed template from being altered, or let reviewers comment on a contract without changing its text.

What this node does

PDF4me Word: Secure Word Document applies two independent kinds of protection. Secure On Open plus Open Password decides whether the file opens at all. Protection Type plus Protection Password decides what may be changed once it is open, from fully read-only to comments, form fields, or tracked revisions only. Use either, or both together.

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 document security requests.

Important Facts You Should Not Miss

Two passwords, two different jobs
Open Password gates the file. Protection Password gates editing. Setting them to the same value hands an editor the keys to both, which defeats the point of the restriction.
Never type a password into the node
Anything entered directly lands in the saved workflow JSON, which gets exported and often committed to git. Use an expression that reads a credential or environment variable.
Protection is applied, not recoverable
This action adds protection. If the passwords are lost there is no path back through this node, so store both values before the workflow runs at scale.
The PDF4me Word node in n8n with Operation set to Secure Word Document, Word File Input Method set to From Previous Node, Secure On Open toggled on, Protection Type set to Read Only, and Output File Name set to secured_document.docx

Secure On Open is a toggle, and Protection Type is a separate dropdown set to Read Only here. The two password fields beneath them are independent of each other.

Open Password vs Editing Restriction

QuestionOpen passwordEditing restriction
Which fields set itSecure On Open and Open PasswordProtection Type and Protection Password
What it blocksOpening the document at allChanging the document once open
Can the recipient read itOnly with the passwordYes, reading is always allowed
Typical recipientA named person receiving something confidentialA reviewer or a form filler
Use it whenThe content must not be seen by othersThe content may be seen but not altered

What Parameters Does Secure Word Document Need?

ParameterRequiredWhat it doesExample
Credential to connect withRequiredThe PDF4me account credential the node authenticates with.PDF4ME account
OperationRequiredThe action this node performs. Select Secure Word Document.Secure Word Document
Word File Input MethodRequiredHow the .docx reaches the node: from the previous node as binary data, as a Base64 string, or from a URL.From Previous Node (Binary Data)
Binary Data Property NameConditionalName of the binary property holding the document. Appears when the file comes from the previous node.data
Document NameRequiredFilename of the input document including the extension. Drives format detection.document.docx
Secure On OpenOptionalToggle that requires a password before the document will open. Leave off if you only want an editing restriction.enabled
Open PasswordConditionalThe password needed to open the file. Required once Secure On Open is enabled. Supply it through an expression, not as literal text.{{ $env.DOC_OPEN_PW }}
Protection TypeOptionalEditing restriction applied to the document: Read Only, Allow Comments, Allow Form Fields, or Allow Revisions.Read Only
Protection PasswordConditionalThe password that lifts the editing restriction. Required once a Protection Type is chosen, and should differ from Open Password.{{ $env.DOC_EDIT_PW }}
Output File NameOptionalFilename of the returned secured document. Keep the .docx extension.secured_document.docx
Output Binary Data NameOptionalBinary property the secured document is written to. Leave as data unless a later node expects another name.data

Protection Type options

OptionWhat the recipient can do
Read OnlyView the document only. No edits of any kind are accepted.
Allow CommentsAdd and edit comments, but not change the document text itself.
Allow Form FieldsFill in form fields while the surrounding content stays locked.
Allow RevisionsEdit, but only with tracked changes recorded so every alteration is visible.

Output

FieldTypeWhat it contains
fileNameStringName of the returned secured document.
fileSizeNumberSize of the secured document in bytes.
successBooleanWhether protection was applied. Branch on this so failures surface as alerts.
originalFileNameStringName of the input document as supplied in Document Name.
secureOnOpenBooleanWhether an open password was applied, echoed back for verification.
protectionTypeStringThe editing restriction applied, such as ReadOnly, or empty when none was set.
messageStringHuman-readable status text describing the result of the operation.

Checking protectionType in the response is the cheapest way to confirm the restriction you intended is the one that actually landed.

How Do I Set Up Secure Word Document in n8n?

  1. Add the PDF4me Word node to your workflow and set Operation to Secure Word Document.
  2. Select your PDF4me credential, or create one and paste your API key.
  3. Pick a Word File Input Method and supply the .docx through the field beneath it.
  4. Set Document Name with the correct extension.
  5. To gate opening, turn on Secure On Open and set Open Password from a credential or environment variable.
  6. To gate editing, set Protection Type and supply a different Protection Password.
  7. Set Output File Name ending in .docx.
  8. Execute the node, confirm secureOnOpen and protectionType in the response, then route the secured file onward.

Typical Setups

Workflow ExamplesCommon n8n workflow patterns using Secure Word Document.
Send a confidential report
  1. A reporting step produces a document with sensitive figures.
  2. Secure On Open applies a password held in an environment variable.
  3. The file is emailed, and the password is shared over a separate channel.
Circulate a contract for comment
  1. Protection Type is set to Allow Comments.
  2. Reviewers annotate without altering any clause text.
  3. Feedback arrives without a diff to reconcile afterwards.
Distribute a fillable form
  1. Allow Form Fields keeps the surrounding wording fixed.
  2. Recipients complete only the fields intended for them.
  3. Returned forms are consistent enough to parse automatically.
Lock an approved template
  1. A template is approved and published to a shared drive.
  2. Read Only protection prevents silent local edits.
  3. Everyone works from the same authoritative wording.

Practical Tips

Keep passwords out of the workflow
An expression reading a credential or environment variable keeps the secret out of exported workflow JSON and out of version control.
Use different values for the two passwords
Reusing one value means anyone who can open the file can also unlock editing, which removes the distinction you set up.
Pick the least restrictive type that works
Allow Comments or Allow Revisions often serves a review better than Read Only, because reviewers can still express changes.
Verify protectionType in the response
The echoed value confirms the restriction landed as intended, which is faster than opening a sample in Word every run.
Secure last in the chain
Watermarking, merging, and header updates all need an editable file. Apply protection after those steps, not before.
Record the passwords before scaling up
This action applies protection and offers no recovery. Store both values in your secret manager before running it across a batch.

Cheat Sheet

FieldValue
OperationSecure Word Document
Word File Input MethodFrom Previous Node (Binary Data)
Binary Data Property Namedata
Document Namedocument.docx
Secure On Openenabled
Open Password{{ $env.DOC_OPEN_PW }}
Protection TypeRead Only
Protection Password{{ $env.DOC_EDIT_PW }}
Output File Namesecured_document.docx
Output Binary Data Namedata

Common Questions

What is the difference between the open password and the protection password?+
The open password gates the file itself: without it the document will not open at all. The protection password gates editing: the document opens for anyone but stays restricted until that second password is entered. They are separate fields and should hold different values, because a recipient who needs to read but not edit should only ever receive the first one.
What do the Protection Type options do?+
Read Only stops edits entirely. Allow Comments permits commenting but no text changes. Allow Form Fields permits filling fields while the rest stays locked. Allow Revisions permits editing only with tracked changes recorded. Microsoft describes the equivalent desktop behaviour under restricting changes in Word.
Where should I store the passwords in n8n?+
Not in the node. A password typed directly into either field is saved inside the workflow JSON, which gets exported, shared, and often committed to version control. Reference an n8n credential or an environment variable through an expression so the secret stays out of the workflow definition.
Can I apply both an open password and an editing restriction at once?+
Yes. Secure On Open and Protection Type are independent, so a document can require a password to open and still be read-only afterwards. That combination suits a confidential document a named recipient may read but nobody may alter.
How do I remove the protection later?+
Editing restrictions are lifted in Word by supplying the protection password, and the open password is entered when the file is opened. Keep both values in your secret store rather than relying on memory, because this action applies protection and there is no recovery path through it if the passwords are lost.

Same Task on Other Platforms

Get Help