Skip to content

Protect PDF API – AES-256 Password Encryption

Lock any PDF with AES-256 encryption in seconds. Password protect PDFs programmatically with no code complexity.

curl -X POST "https://api.xspdf.com/v1/security/protect" \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input_url": "https://files.example.com/contract.pdf",
    "options": {
      "user_password": "viewpass123",
      "owner_password": "adminpass456",
      "encryption": "AES-256",
      "permissions": ["print", "copy"]
    }
  }'
8,700+ teams
280ms median
99.95% success
AES-256
Encryption
280ms
Median latency
99.95%
Success rate
8,700+
Teams trust us

PDF Security Shouldn't Be This Hard

Complex Libraries

PyPDF2, PDFBox, and iText require hundreds of lines of code just to add password protection. Debugging encryption errors wastes hours.

Security Vulnerabilities

Weak encryption defaults expose sensitive documents. Many libraries still support obsolete 40-bit encryption that can be cracked in seconds.

Infrastructure Overhead

Self-hosting encryption servers means managing dependencies, security patches, and scaling infrastructure as your document volume grows.

Hidden Cost

Every week spent wrestling with PDF encryption libraries is time not spent building your core product. Security compliance reviews cost extra when you're handling encryption yourself.

One API Call. Bank-Grade Encryption.

1

Upload Your PDF

Pass a URL or base64-encoded file. We support public URLs, signed S3 links, and direct file uploads.

2

Set Passwords & Permissions

Define user passwords for viewing, owner passwords for editing, and granular permissions like print-only or no-copy.

3

Get Protected PDF

Receive a secure download URL instantly. AES-256 encryption applied. No logs, no storage.

response = requests.post(
    "https://api.xspdf.com/v1/security/protect",
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "input_url": "https://files.example.com/contract.pdf",
        "options": {
            "user_password": "viewpass123",
            "owner_password": "adminpass456",
            "encryption": "AES-256",
            "permissions": ["print", "copy"]
        }
    }
)
protected_url = response.json()["output_url"]

Enterprise-Grade Security Features

AES-256 Encryption

Military-grade encryption that meets SOC 2, HIPAA, and GDPR standards. Same encryption used by government agencies.

Granular Permissions

Control printing, copying, editing, annotations, form filling, and page extraction independently. Lock down exactly what you need.

Dual Password Support

Set separate user passwords for viewing and owner passwords for editing. Perfect for client deliverables.

Lightning Fast

280ms median response time. No waiting. Process thousands of documents per hour with automatic scaling.

Zero Storage

We don't store your PDFs or passwords. Files are processed in memory and immediately deleted after encryption.

99.95% Uptime

Multi-region infrastructure with automatic failover. SLA-backed reliability for mission-critical workflows.

Frequently Asked Questions

How secure is AES-256 encryption?

AES-256 is the industry standard for document encryption, used by banks, governments, and security agencies worldwide. It would take billions of years to brute-force crack with current technology. xspdf implements AES-256 with secure key derivation and random initialization vectors.

What permissions can I control?

You can independently control printing (full or degraded quality), text/image copying, document editing, annotations, form filling, page extraction, and document assembly. Set any combination that fits your security requirements.

Do you store the passwords I set?

No. Passwords are used during the encryption process and immediately discarded. We don't log, store, or have any way to retrieve passwords after encryption. The encrypted PDF is the only record.

Can I protect PDFs with existing encryption?

If a PDF is already password-protected, you'll need to unlock it first using our /unlock-pdf-api endpoint, then apply new protection. This prevents accidental double-encryption that would make files unreadable.

What file size limits apply?

Standard plans support PDFs up to 100MB. Enterprise plans support up to 500MB. Encryption time scales linearly with file size, typically adding 50-100ms per 10MB.

Secure Your PDFs in Under 5 Minutes

Join 8,700+ teams using xspdf for document security. Free API key. No credit card required.