Skip to main content

pdfeditor.pk Developer API

A REST API for the PDF tools you already use on pdfeditor.pk — merge, split, compress, and convert at scale.

v1 (stable) Bearer auth JSON errors 200 MB upload limit

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
Tip: the /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"
}
StatusCodeMeaning
400no_file / no_filesRequired file field was missing.
400invalid_pagesThe pages spec referenced a page outside the document.
400invalid_dpi / invalid_qualityParameter was outside the allowed set.
401missing_api_keyNo Authorization: Bearer header.
401invalid_api_keyKey not recognized.
403key_revokedKey was revoked — generate a new one.
413file_too_largeUpload exceeded the 200 MB limit.
422pdf_password_protectedInput PDF is encrypted — unlock first.
429rate_limit_exceededPer-key quota or burst limit hit (see rate limits).
500merge_failed / split_failed / convert_failedThe tool ran into an unrecoverable error processing the file.
503database_unavailableAuth 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.

Heads up: these are placeholder limits while the API is in preview. Limits per pricing tier are being finalized — reach out to [email protected] if you need higher throughput today.

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:

  • Pythonpip install pdfeditor (coming soon)
  • Node.jsnpm 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.