Quickstart
The API is a thin layer over the same PDF engine that powers pdfeditor.pk. If you can curl, you can call it.
1. Get an API key
Sign in and visit your account → API Keys, then click Generate New. Keys are shown once — copy them to your secret manager immediately. The key looks like pdl_live_xxxxxxxxxxxxxxxx.
2. Make your first call
Merge two PDFs from your shell:
curl -X POST https://pdfeditor.pk/api/v1/merge \ -H "Authorization: Bearer pdl_live_xxxxxxxxxxxxxxxx" \ -F "[email protected]" \ -F "[email protected]" \ -o merged.pdf
The response body is the merged PDF. Errors come back as JSON:
{
"error": "Unauthorized: API key not recognized.",
"code": "invalid_api_key"
}
3. Convert a PDF to Word
curl -X POST https://pdfeditor.pk/api/v1/convert/pdf-to-word \ -H "Authorization: Bearer pdl_live_xxxxxxxxxxxxxxxx" \ -F "[email protected]" \ -o report.docx
/api/v1/health endpoint is public — useful as a connectivity check before wiring in your real key.
Authentication
Every request to /api/v1/* (except /health) must carry a Bearer token:
Authorization: Bearer pdl_live_xxxxxxxxxxxxxxxx
We never store the raw key — only its SHA-256 hash. If you lose a key you must rotate it; we cannot recover it for you.
Key rotation
- Generate a new key in the dashboard — do not revoke the old one yet.
- Deploy the new key to your application.
- Once your dashboard shows traffic on the new key for at least one billing cycle, revoke the old one.
Key safety
- Never commit a key to version control. Use environment variables or a secret manager.
- Restrict keys per-environment (dev vs prod) so a leak from staging never affects production.
- If a key is compromised, revoke it from the dashboard immediately — it stops working on the next request.
Endpoint reference
All endpoints accept multipart/form-data. The primary file is uploaded as the file field. Successful responses stream the result with Content-Disposition: attachment.
| Method | Path | Form fields | Response |
|---|---|---|---|
| GET | /api/v1/health |
— | JSON { status, service, version } |
| POST | /api/v1/merge |
file (repeat, ≥ 2) |
application/pdf — merged document |
| POST | /api/v1/split |
file, optional pages (e.g. 1-3,5,8-10) |
application/zip — one PDF per range |
| POST | /api/v1/compress |
file, optional quality (low|medium|high) |
application/pdf — compressed document |
| POST | /api/v1/convert/pdf-to-jpg |
file, optional dpi (72 | 96 | 150 | 200 | 300) |
image/jpeg (single page) or application/zip |
| POST | /api/v1/convert/pdf-to-word |
file |
.docx binary |
More tools are exposed every release. The web UI today wraps 95+ tools and we are working them in starting with the most-requested.
Errors
Failures return JSON in a consistent shape:
{
"error": "Human-readable message.",
"code": "machine_readable_code"
}
| Status | Code | Meaning |
|---|---|---|
| 400 | no_file / no_files | Required file field was missing. |
| 400 | invalid_pages | The pages spec referenced a page outside the document. |
| 400 | invalid_dpi / invalid_quality | Parameter was outside the allowed set. |
| 401 | missing_api_key | No Authorization: Bearer header. |
| 401 | invalid_api_key | Key not recognized. |
| 403 | key_revoked | Key was revoked — generate a new one. |
| 413 | file_too_large | Upload exceeded the 200 MB limit. |
| 422 | pdf_password_protected | Input PDF is encrypted — unlock first. |
| 429 | rate_limit_exceeded | Per-key quota or burst limit hit (see rate limits). |
| 500 | merge_failed / split_failed / convert_failed | The tool ran into an unrecoverable error processing the file. |
| 503 | database_unavailable | Auth backend is down — retry with backoff. |
Rate limits
The launch quota is 1,000 requests per hour per API key. We log every authorized call — you can see your live usage on the dashboard.
Bursts up to 40 requests/second per IP are accepted at the edge. Sustained traffic above the hourly budget gets a 429 rate_limit_exceeded response with a Retry-After header.
OpenAPI spec
A machine-readable OpenAPI 3.0 description lives at /docs/openapi.yaml. Drop it into Postman, Swagger UI, or your favorite client generator:
curl -O https://pdfeditor.pk/docs/openapi.yaml # or render it live: npx @redocly/cli preview-docs https://pdfeditor.pk/docs/openapi.yaml
SDKs
Official SDKs ship alongside GA:
- Python —
pip install pdfeditor(coming soon) - Node.js —
npm install pdfeditor(coming soon)
Until then, plain requests, node-fetch, or any HTTP client is enough — the API is intentionally boring on purpose.
Support
Found a bug, need a tool added, or curious about enterprise pricing? Email [email protected] or open a ticket from your account dashboard. We respond within one business day during the preview.