PDF Password API
Start building for free today – no credit card required.
Secure your PDF documents by adding password protection with our API. Simply set a password, and our API ensures your files are encrypted and accessible only to authorized users. Perfect for safeguarding sensitive information and enhancing document security.
Claude, ChatGPT, Cursor or your own agent can call
add-pdf-security and remove-pdf-security directly.
Benefits of our PDF Password API
Secure your PDF documents effortlessly with our robust PDF Password API.
Add custom passwords to encrypt your files and control access, ensuring
that sensitive information remains protected. This feature enhances
document security while maintaining a professional appearance,
seamlessly integrating into your workflow for secure and
efficient file management.
Read our API documentation to learn how to protect PDFs.
Multi-language Code Example
curl -X POST https://apdf.io/api/pdf/security/add \
-H "Authorization: Bearer TOKEN" \
-d file="FILE_URL" \
-d owner_password="OWNER_PASSWORD" \
-d user_password="USER_PASSWORD"
const data = new FormData();
data.append('file', 'FILE_URL');
data.append('owner_password', 'OWNER_PASSWORD');
data.append('user_password', 'USER_PASSWORD');
fetch('https://apdf.io/api/pdf/security/add', {
headers: {'Authorization': 'Bearer TOKEN'},
method: 'POST',
body: data
})
.then(response => response.json())
.then(json => console.log(json));
use GuzzleHttp\Client;
$client = new Client();
$response = $client->post(
'https://apdf.io/api/pdf/security/add', [
'headers' => [
'Authorization' => 'Bearer TOKEN'
],
'form_params' => [
'file' => 'FILE_URL',
'owner_password' => 'OWNER_PASSWORD',
'user_password' => 'USER_PASSWORD'
]
]);
$body = $response->getBody();
echo json_encode($body->getContents());
require 'rest-client'
response = RestClient.post(
'https://apdf.io/api/pdf/security/add',
{
'file' => 'FILE_URL',
'owner_password' => 'OWNER_PASSWORD',
'user_password' => 'USER_PASSWORD'
},
{
Authorization: "Bearer TOKEN"
}
)
puts response.body
import requests
response = requests.post(
'https://apdf.io/api/pdf/security/add',
headers = {
'Authorization': 'Bearer TOKEN'
},
data = {
'file': 'FILE_URL',
'owner_password': 'OWNER_PASSWORD',
'user_password': 'USER_PASSWORD'
}
)
print(response.text)
import (
"fmt"
"github.com/go-resty/resty/v2"
)
func main() {
client := resty.New()
data := map[string]string{
"file": "FILE_URL",
"owner_password": "OWNER_PASSWORD",
"user_password": "USER_PASSWORD"
}
resp, _ := client.R().
SetFormData(data).
SetHeader("Authorization", "Bearer TOKEN").
Post("https://apdf.io/api/pdf/security/add")
fmt.Println(resp.String())
}
import okhttp3.*;
class Pdf {
public static void main(String[] args) throws Exception {
OkHttpClient client = new OkHttpClient();
FormBody formBody = new FormBody.Builder()
.add("file", "FILE_URL")
.add("owner_password", "OWNER_PASSWORD")
.add("user_password", "USER_PASSWORD")
.build();
Request request = new Request.Builder()
.url("https://apdf.io/api/pdf/security/add")
.addHeader("Authorization", "Bearer TOKEN")
.post(formBody)
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}
No-Code PDF Protection
Integrate our PDF API with Zapier Webhooks to automate your PDF protection workflows effortlessly. Whether you're securing sensitive contracts, invoices, or confidential reports, you can trigger PDF protection from hundreds of apps supported by Zapier. Automatically apply password encryption to your documents, safeguarding your data and eliminating the need for manual security settings.
PDF password and security tutorials
Password-Protect PDFs in an Agent Workflow
Encryption as a step the agent runs, not a desktop-tool detour: lock a client statement with owner and user passwords, have the agent probe the result to prove the lock held (encrypted: true, everything else hidden), and unlock the archive copy in the same conversation.
Batch Password Protect PDFs for GDPR Compliance
This tutorial shows how to automatically password-protect sensitive documents like payslips and medical records before emailing. Using JavaScript and the Apdf Security API, you can batch-process documents with user-specific passwords for GDPR compliance.
Remove Password Protection from Archived PDFs with Ruby
Batch remove password protection from PDF documents using Ruby when you have the known password. Ideal for migrating protected archives to new systems or simplifying access to legacy documents protected with standard organizational passwords.
Your code made the PDF.
Then it went dark.
Opened, read, re-read, dropped on page 4 — you never see any of it. Share the PDFs you generate through Apdf recipient links, and every signal becomes something you can act on: ping Slack, update the CRM, let an agent follow up. Same account, same API token, one more call.
API · Webhook · MCP