Encrypt a PDF with an open password. MCP tool add_password / HTTP POST /v1/password/add.
Encrypt a PDF so it can only be opened with the password you set.
At a glance
Section titled “At a glance”| MCP tool | add_password |
| HTTP endpoint | POST /v1/password/add |
| Price | $0.05 |
| Input | One PDF + a password |
| Output | An encrypted PDF requiring the password to open |
Parameters
Section titled “Parameters”| Parameter | Type | Required | Description |
|---|---|---|---|
file |
file | yes | Source PDF. |
password |
string | yes | The open (user) password required to view the document. |
MCP example
Section titled “MCP example”Password-protect
https://example.com/contract.pdfwith the passwords3cret.
{ "file": "https://example.com/contract.pdf", "password": "s3cret"}HTTP example
Section titled “HTTP example”curl -i -X POST https://api.pdfasyougo.com/v1/password/add \ -H "Content-Type: application/json" \ -H "X-PAYMENT: <base64-encoded-payment-payload>" \ -d '{"file":"https://example.com/contract.pdf","password":"s3cret"}'import { wrapFetchWithPayment } from 'x402-fetch';import { privateKeyToAccount } from 'viem/accounts';
const account = privateKeyToAccount(process.env.X402_WALLET_PRIVATE_KEY as `0x${string}`);const fetchWithPay = wrapFetchWithPayment(fetch, account);
const res = await fetchWithPay('https://api.pdfasyougo.com/v1/password/add', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ file: 'https://example.com/contract.pdf', password: 's3cret' }),});console.log((await res.json()).output.url);Response
Section titled “Response”{ "output": { "url": "https://files.pdfasyougo.com/o/a17c…?token=…", "expires_at": "2026-06-29T12:00:00Z", "pages": 8, "bytes": 73728 }, "operation": "password.add", "cost": "0.05 USDC"}- This sets an open (user) password — required to view the document.
- To control what a viewer can do (print, copy, modify) rather than whether they can open it, use Add restrictions.
- The password you supply is used only to encrypt the output and is not retained — see Privacy & retention.