Welcome Back

Sign in to access your documents and signatures

or continue with email
Forgot password?
API v1 · Stable

WHAT A PDF! Developer API

Process PDFs at scale from your application. Compress, merge, split, and OCR over a clean REST interface with Bearer-token authentication and per-plan rate limits.

Quickstart

Three steps to your first API call.

  1. Create an API key from Account › API Keys
  2. Send a multipart/form-data POST to one of the v1 endpoints with an Authorization: Bearer header.
  3. Inspect the JSON response — successful calls return a signed download URL valid for 15 minutes.

Base URL

https://whatapdf.com/api/v1

Authentication

Every request must include an Authorization header with your API key as a Bearer token.

Authorization: Bearer pdn_live_a1b2c3d4e5f6...
Keep your live keys secret. Treat them like passwords. Never commit them to source control or expose them in client-side code.

Key formats

  • pdn_live_<32 hex> — Production key. Counts toward your plan's rate limit.
  • pdn_test_<32 hex> — Test key. Same rate limit; useful for distinguishing environments in logs.

Rate limits

Rate limits are calculated per user, per rolling 1-hour window. Every response includes X-RateLimit-* headers so you can plan your retries.

PlanRequests / hour
Free10
Premium1,000
Business5,000
EnterpriseUnlimited

Response headers

  • X-RateLimit-Limit — Your plan's hourly cap.
  • X-RateLimit-Remaining — Calls remaining in the current window.
  • X-RateLimit-Reset — Unix timestamp when the window resets.
  • Retry-After — Seconds to wait, sent only on 429 responses.

Errors

All errors are returned as JSON with a stable code and a human-readable message.

{
  "error": {
    "code": "rate_limited",
    "message": "Rate limit exceeded for your plan (free: 10/hour)."
  },
  "meta": { "request_id": "8f9a2b3c1d4e5f6a" }
}

Error codes

CodeHTTPMeaning
unauthorized401Missing, malformed, or revoked API key.
rate_limited429Hourly rate limit exceeded for your plan.
invalid_input400Request body or parameters failed validation.
payload_too_large413File or combined payload exceeds your plan's size limit.
internal_error500Unexpected server error. Safe to retry with backoff.

POST /compress

Compress a PDF using Ghostscript when available, with an FPDI fallback. Returns a signed download URL.

POSThttps://whatapdf.com/api/v1/compress

Parameters (multipart/form-data)

NameTypeDescription
file *filePDF file to compress.
levelstringCompression preset. low, medium, high

Code examples

curl -X POST https://whatapdf.com/api/v1/compress \
  -H "Authorization: Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -F "[email protected]" \
  -F "level=medium"
const form = new FormData();
form.append('file', fileInput.files[0]);
form.append('level', 'medium');

const res = await fetch('https://whatapdf.com/api/v1/compress', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' },
  body: form,
});
const json = await res.json();
console.log(json.data.download.url);
import requests

with open('input.pdf', 'rb') as f:
    r = requests.post(
        'https://whatapdf.com/api/v1/compress',
        headers={'Authorization': 'Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'},
        files={'file': f},
        data={'level': 'medium'},
    )
print(r.json())
<?php
$ch = curl_init('https://whatapdf.com/api/v1/compress');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'],
    CURLOPT_POSTFIELDS     => [
        'file'  => new CURLFile('input.pdf', 'application/pdf'),
        'level' => 'medium',
    ],
]);
$res = json_decode(curl_exec($ch), true);
curl_close($ch);
print_r($res);

Example response

{
  "data": {
    "filename": "report_compressed.pdf",
    "original_size": 5242880,
    "compressed_size": 2621440,
    "savings_percent": 50.0,
    "method": "ghostscript",
    "download": {
      "url": "/api/get-pdf.php?file=...&exp=...&sig=...",
      "expires_in": 900
    }
  },
  "meta": { "request_id": "8f9a2b3c1d4e5f6a" }
}

POST /merge

Merge 2–20 PDFs into a single document in upload order.

POSThttps://whatapdf.com/api/v1/merge

Parameters

NameTypeDescription
files[] *file[]Two or more PDF files (multipart array).

Code examples

curl -X POST https://whatapdf.com/api/v1/merge \
  -H "Authorization: Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -F "files[][email protected]" \
  -F "files[][email protected]" \
  -F "files[][email protected]"
const form = new FormData();
for (const f of fileInput.files) form.append('files[]', f);

const res = await fetch('https://whatapdf.com/api/v1/merge', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' },
  body: form,
});
console.log(await res.json());
import requests

files = [
    ('files[]', open('a.pdf', 'rb')),
    ('files[]', open('b.pdf', 'rb')),
    ('files[]', open('c.pdf', 'rb')),
]
r = requests.post(
    'https://whatapdf.com/api/v1/merge',
    headers={'Authorization': 'Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'},
    files=files,
)
print(r.json())
<?php
$ch = curl_init('https://whatapdf.com/api/v1/merge');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'],
    CURLOPT_POSTFIELDS     => [
        'files[0]' => new CURLFile('a.pdf', 'application/pdf'),
        'files[1]' => new CURLFile('b.pdf', 'application/pdf'),
        'files[2]' => new CURLFile('c.pdf', 'application/pdf'),
    ],
]);
echo curl_exec($ch);
curl_close($ch);

POST /split

Split a PDF into one or more parts by page ranges. Each part is returned with its own signed download URL.

POSThttps://whatapdf.com/api/v1/split

Parameters

NameTypeDescription
file *fileSource PDF.
ranges *stringComma-separated page ranges. One range = one output part. e.g. 1-3,5,7-9

Code examples

curl -X POST https://whatapdf.com/api/v1/split \
  -H "Authorization: Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -F "[email protected]" \
  -F "ranges=1-3,5,7-9"
const form = new FormData();
form.append('file', fileInput.files[0]);
form.append('ranges', '1-3,5,7-9');

const res = await fetch('https://whatapdf.com/api/v1/split', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' },
  body: form,
});
console.log(await res.json());
import requests

with open('input.pdf', 'rb') as f:
    r = requests.post(
        'https://whatapdf.com/api/v1/split',
        headers={'Authorization': 'Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'},
        files={'file': f},
        data={'ranges': '1-3,5,7-9'},
    )
for part in r.json()['data']['parts']:
    print(part['pages'], part['download']['url'])
<?php
$ch = curl_init('https://whatapdf.com/api/v1/split');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'],
    CURLOPT_POSTFIELDS     => [
        'file'   => new CURLFile('input.pdf', 'application/pdf'),
        'ranges' => '1-3,5,7-9',
    ],
]);
print_r(json_decode(curl_exec($ch), true));
curl_close($ch);

POST /ocr

Extract text from an image using Tesseract OCR. Supports 20+ languages.

POSThttps://whatapdf.com/api/v1/ocr

Parameters

NameTypeDescription
image *fileImage to OCR (PNG, JPEG, TIFF, WebP, or BMP).
languagestringTesseract language code. Default eng

Code examples

curl -X POST https://whatapdf.com/api/v1/ocr \
  -H "Authorization: Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
  -F "[email protected]" \
  -F "language=eng"
const form = new FormData();
form.append('image', imageInput.files[0]);
form.append('language', 'eng');

const res = await fetch('https://whatapdf.com/api/v1/ocr', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' },
  body: form,
});
const { data } = await res.json();
console.log(data.text);
import requests

with open('scan.png', 'rb') as f:
    r = requests.post(
        'https://whatapdf.com/api/v1/ocr',
        headers={'Authorization': 'Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'},
        files={'image': f},
        data={'language': 'eng'},
    )
print(r.json()['data']['text'])
<?php
$ch = curl_init('https://whatapdf.com/api/v1/ocr');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST           => true,
    CURLOPT_HTTPHEADER     => ['Authorization: Bearer pdn_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'],
    CURLOPT_POSTFIELDS     => [
        'image'    => new CURLFile('scan.png', 'image/png'),
        'language' => 'eng',
    ],
]);
$res = json_decode(curl_exec($ch), true);
echo $res['data']['text'];
curl_close($ch);
WHAT A PDF! for Gmail - Chrome Extension

Open PDF attachments from Gmail directly in WHAT A PDF!. Edit, sign, and convert your PDFs instantly!

Install Free Extension

Wait — don't miss out!

Subscribe for free PDF tips, new tools, and feature updates delivered to your inbox.

No spam ever. Unsubscribe anytime.