Developer Docs

API Reference

Integrate PDF unlocking into your app or AI agent. Pay per use via x402 — no API keys, no subscriptions.

https://unlockpdf.dev
x402 Protocol

No API keys required. The first 10 requests per IP per day are free. After that, each request costs $0.05 USDC via the x402 payment protocol on Base network.

1
Send request — POST to /api/unlock with your PDF
2
Receive 402 — if free tier is used up, server returns HTTP 402 with payment details in the X-Payment-Required header
3
Pay $0.05 USDC on Base network to 0x59387E...734F
4
Retry with payment — include X-Payment: <signed_payload> header
5
Receive unlocked PDF — binary response
GET /api/info

Check your current usage and payment details. Useful for AI agents to discover pricing before uploading.

Response // 200 OK { "service": "UnlockPDF.dev", "free_tier": { "limit": 10, "remaining_today": 7 }, "paid_tier": { "price": "0.05 USDC", "network": "base-mainnet", "pay_to": "0x59387E6869A12d76f321Ea609de4e073284F734F", "protocol": "x402" } }
POST /api/unlock

Remove password protection from a PDF file. Returns the unlocked PDF as a binary download.

FieldTypeDescription
pdf_filefileThe PDF file to unlock. Max 50MB. Required.
passwordstringCurrent PDF password. Optional — leave blank to attempt without.
cURL curl -X POST https://unlockpdf.dev/api/unlock \ -F "[email protected]" \ -F "password=mysecretpassword" \ --output unlocked.pdf
cURL # Include signed payment payload after paying $0.05 USDC curl -X POST https://unlockpdf.dev/api/unlock \ -H "X-Payment: <base64_signed_payload>" \ -F "[email protected]" \ --output unlocked.pdf
Python import requests # Free tier — no payment needed with open("document.pdf", "rb") as f: response = requests.post( "https://unlockpdf.dev/api/unlock", files={"pdf_file": f}, data={"password": "optional_password"} ) if response.status_code == 200: with open("unlocked.pdf", "wb") as out: out.write(response.content) elif response.status_code == 402: # Free tier used up — handle x402 payment payment_info = response.json() print(f"Pay {payment_info['amount']} USDC to {payment_info['payTo']}")
StatusMeaningBody
200SuccessUnlocked PDF binary
400Bad requestNot a PDF, or file too large
402Payment requiredx402 payment details JSON
422UnprocessableWrong password or unsupported encryption
500Server errorProcessing failed
GET /api/health

Service health check. Returns 200 if the API is running.

Response { "status": "ok", "service": "UnlockPDF", "version": "1.0.0" }