PDF Password Protect API
Convert pdf files to pdf with a single POST request. Upload a file as multipart/form-data and the API returns a download URL for the converted file.
Input
Output
pdf (application/pdf)
Credit cost
1 per file
Max file size
Per plan (10–500 MB)
Endpoint
https://api.fileswitch.co/api/v1/converter/pdf-password-protectAuthentication is optional for guests and recommended for production. Send either an API key or a JWT access token as a Bearer token. Authenticated requests deduct 1 credit from your balance; failed conversions are refunded. See Authentication for details.
Quick start
The same request in every supported language. Each example uploads a file and prints the downloadUrl from the response.
curl -X POST https://api.fileswitch.co/api/v1/converter/pdf-password-protect \
-H "Authorization: Bearer fc_YOUR_API_KEY" \
-F "file=@input.pdf" \
-F "algorithm=aes256" \
-F "allowPrinting=true" \
-F "allowCopying=true" \
-F "allowExtraction=true"Parameters
Send file plus any optional options. Every option is optional and falls back to its default when omitted.
| Field | Type | Default | Description |
|---|---|---|---|
| file | binary | — | The file to convert. Accepts .pdf |
| password | string | — | Password required to open the PDF. |
| ownerPassword | string | — | Owner password; defaults to the user password when omitted. |
| algorithm | string | aes256 | Encryption algorithm. Values: aes256, rc4 |
| allowPrinting | boolean | true | Allow printing the document. |
| allowModifying | boolean | false | Allow modifying the document. |
| allowCopying | boolean | true | Allow copying content. |
| allowAnnotating | boolean | false | Allow adding annotations. |
| allowFillingForms | boolean | false | Allow filling form fields. |
| allowExtraction | boolean | true | Allow extracting text. |
| allowAssembly | boolean | false | Allow assembling pages. |
| allowHighQualityPrint | boolean | false | Allow high-resolution printing. |
{
"file": "input.pdf",
"password": "",
"ownerPassword": "",
"algorithm": "aes256",
"allowPrinting": true,
"allowModifying": false,
"allowCopying": true,
"allowAnnotating": false,
"allowFillingForms": false,
"allowExtraction": true,
"allowAssembly": false,
"allowHighQualityPrint": false
}Response
Every conversion endpoint returns the same success / message / data envelope. The data object is a Conversion record with a temporary downloadUrl.
{
"success": true,
"message": "Conversion completed",
"data": {
"id": "b10a5f2e-8c1e-4b3a-9c1d-2e3f4a5b6c7d",
"inputFormat": "html",
"outputFormat": "pdf",
"inputFileName": "document.html",
"outputFileName": "document.pdf",
"inputFileSize": 45210,
"outputFileSize": 88431,
"status": "completed",
"error": null,
"creditCost": 2,
"downloadUrl": "/api/v1/converter/download/conversions%2Fb10a5f2e-8c1e-4b3a-9c1d-2e3f4a5b6c7d%2Foutput.pdf",
"createdAt": "2026-07-31T13:00:00.000Z",
"completedAt": "2026-07-31T13:00:02.000Z"
}
}Prepend https://api.fileswitch.co/api/v1 to the downloadUrl and download with the same credentials. Files are retained temporarily and auto-deleted. See the full field reference in Response Schema.
Related conversions
Ready to convert pdf → pdf? Start free — no credit card required.