# Add a password to a PDF

Encrypt a PDF so it requires a password to open, in a Power Automate flow. No code to write, and no document is stored after the run.

Use this action to encrypt and protect a PDF document with a password to prevent unauthorized access.

<PowerAutomateAction
  title="Add a password to a PDF"
  caption="Add a password to a PDF."
  connection="PDF Blocks Next"
  fields={[
    { label: "File Content", kind: "token", value: "File Content", required: true },
    { label: "Password", placeholder: "The password required to open the file", required: true },
    { label: "Encryption Algorithm", kind: "select", value: "AES-128", options: ["AES-128", "AES-256"], advanced: true },
  ]}
/>

<ConnectorNotice kind="parameter" />

## Parameters

<ParamField name="File Content" type="File" required>
  The content of the input PDF document.
</ParamField>

<ParamField name="Password" type="String" required>
  The password required to open the file. The length is between 4 and 32 characters. The characters in the password must be in the ASCII printable range (between positions 32 and 126). This range includes lowercase and uppercase letters, numbers, space, and some commonly used symbols like . , : ; # $ % & ( ) * + = ? !
</ParamField>

<ParamField name="Encryption Algorithm" type="String" default="AES-128">
  The algorithm used to encrypt the PDF document. This field is optional. Valid values are AES-128 and AES-256.
</ParamField>

## Response

<ParamField name="Password Protected PDF File Content" type="File">
  The content of the password protected PDF document. You can use it as an input to other actions in your flow.
</ParamField>

## Related actions

<CardGroup cols={2}>

<Card title="Remove password" href="/docs/power-automate/remove-password-from-pdf">
  Take the password back off an encrypted document.
</Card>

<Card title="Add restrictions" href="/docs/power-automate/add-restrictions-to-pdf">
  Restrict copying, printing, and editing instead of blocking access.
</Card>

<Card title="Remove restrictions" href="/docs/power-automate/remove-restrictions-from-pdf">
  Clear the restrictions from a document.
</Card>

<Card title="Remove signatures" href="/docs/power-automate/remove-signatures-from-pdf">
  Strip cryptographic signatures before re-protecting.
</Card>

</CardGroup>
