# Add PDF security — PDF.co

> Add PDF security. See docs here

- Key: `pdf_co-pdf-add-security`
- Type: Action (Write)
- Version: 0.0.2
- App: PDF.co (`pdf_co`) — https://pipedream.com/apps/pdf-co.md
- This page (HTML): https://pipedream.com/apps/pdf-co/actions/pdf-add-security
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/pdf_co/actions/pdf-add-security/pdf-add-security.mjs

## Description

Add PDF security. [See docs here](https://apidocs.pdf.co/32-pdf-password-and-security)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `async` | `boolean` | No | Runs processing asynchronously. Returns JobId. |
| `name` | `string` | No | File name for generated output. |
| `expiration` | `integer` | No | Output link expiration in minutes. Default is 60 (i.e. 60 minutes or 1 hour). |
| `profiles` | `any` | No | Use this parameter to set additional configuration for fine tuning and extra options. Explore PDF.co for profile examples. |
| `url` | `string` | Yes | URL to the source file. Supports links from Google Drive, Dropbox and from built-in PDF.co files storage. |
| `ownerPassword` | `string` | Yes | The main owner password that is used for documents encryption and for setting/removing restrictions. |
| `encryptionAlgorithm` | `string` | Yes | Encryption algorithm. Valid values: RC4_40bit, RC4_128bit, AES_128bit, AES_256bit. AES_128bit or higher is recommended. |
| `userPassword` | `string` | No | The optional user password will be asked for viewing and printing document. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "pdf_co",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "pdf_co-pdf-add-security",
  arguments: {
    async: true,
    name: "Name",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "pdf_co-pdf-add-security",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    pdf_co: { authProvisionId: "apn_xxxxxxx" },
    async: true,
    name: "Name",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "pdf_co-pdf-add-security",
    "configured_props": {
      "pdf_co": { "authProvisionId": "apn_xxxxxxx" },
      "async": true,
      "name": "Name"
    }
  }'
```

---

- App: https://pipedream.com/apps/pdf-co.md · All apps: https://pipedream.com/apps
