JustPDF API Documentation
Integrate powerful PDF tools directly into your application. Merge, compress, split, and rotate PDFs with simple HTTP requests.
Overview
The JustPDF API provides server-side PDF processing via a RESTful interface. Upload your files, and receive processed PDFs in the response.
Base URL
https://justpdf.app/api/v1Content Type
multipart/form-dataResponse Format
Binary PDF (application/pdf) or JSON
Authentication
API key via X-API-Key header
Authentication
All API requests require an API key. Include your key in the X-API-Key header of every request.
Getting an API Key
- Sign in to your JustPDF account
- Make a POST request to
/api/v1/keyswith your Firebase auth token - Store the returned key securely — it is only shown once
curl -X POST https://justpdf.app/api/v1/keys \
-H "Authorization: Bearer YOUR_FIREBASE_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "My App", "tier": "basic"}'curl -X POST https://justpdf.app/api/v1/compress \
-H "X-API-Key: jpdf_your_api_key_here" \
-F "file=@document.pdf" \
-o compressed.pdfEndpoints
/api/v1/mergeMerge multiple PDF files into a single document.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| files | File[] | required | Two or more PDF files to merge (multipart form field, repeated) |
Examples
curl -X POST https://justpdf.app/api/v1/merge \
-H "X-API-Key: jpdf_your_key" \
-F "files=@file1.pdf" \
-F "files=@file2.pdf" \
-F "files=@file3.pdf" \
-o merged.pdfimport requests
url = "https://justpdf.app/api/v1/merge"
headers = {"X-API-Key": "jpdf_your_key"}
files = [
("files", ("file1.pdf", open("file1.pdf", "rb"), "application/pdf")),
("files", ("file2.pdf", open("file2.pdf", "rb"), "application/pdf")),
]
response = requests.post(url, headers=headers, files=files)
with open("merged.pdf", "wb") as f:
f.write(response.content)const fs = require("fs");
const form = new FormData();
form.append("files", new Blob([fs.readFileSync("file1.pdf")]), "file1.pdf");
form.append("files", new Blob([fs.readFileSync("file2.pdf")]), "file2.pdf");
const response = await fetch("https://justpdf.app/api/v1/merge", {
method: "POST",
headers: { "X-API-Key": "jpdf_your_key" },
body: form,
});
const buffer = await response.arrayBuffer();
fs.writeFileSync("merged.pdf", Buffer.from(buffer));Response
Returns the merged PDF as a binary file (application/pdf).
/api/v1/compressCompress a PDF to reduce file size.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| file | File | required | The PDF file to compress |
Examples
curl -X POST https://justpdf.app/api/v1/compress \
-H "X-API-Key: jpdf_your_key" \
-F "file=@document.pdf" \
-o compressed.pdfimport requests
url = "https://justpdf.app/api/v1/compress"
headers = {"X-API-Key": "jpdf_your_key"}
files = {"file": ("document.pdf", open("document.pdf", "rb"), "application/pdf")}
response = requests.post(url, headers=headers, files=files)
with open("compressed.pdf", "wb") as f:
f.write(response.content)const fs = require("fs");
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("document.pdf")]), "document.pdf");
const response = await fetch("https://justpdf.app/api/v1/compress", {
method: "POST",
headers: { "X-API-Key": "jpdf_your_key" },
body: form,
});
const buffer = await response.arrayBuffer();
fs.writeFileSync("compressed.pdf", Buffer.from(buffer));Response
Returns the compressed PDF as a binary file (application/pdf).
/api/v1/splitSplit a PDF into one or more documents by page ranges.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| file | File | required | The PDF file to split |
| ranges | string | required | JSON array of page ranges (0-indexed, inclusive). Example: [{"start":0,"end":2}] |
Examples
# Single range — returns PDF directly
curl -X POST https://justpdf.app/api/v1/split \
-H "X-API-Key: jpdf_your_key" \
-F "file=@document.pdf" \
-F 'ranges=[{"start":0,"end":2}]' \
-o pages_1_to_3.pdf
# Multiple ranges — returns JSON with base64 PDFs
curl -X POST https://justpdf.app/api/v1/split \
-H "X-API-Key: jpdf_your_key" \
-F "file=@document.pdf" \
-F 'ranges=[{"start":0,"end":2},{"start":3,"end":5}]'import requests
import json
import base64
url = "https://justpdf.app/api/v1/split"
headers = {"X-API-Key": "jpdf_your_key"}
# Single range
files = {"file": ("document.pdf", open("document.pdf", "rb"), "application/pdf")}
data = {"ranges": json.dumps([{"start": 0, "end": 2}])}
response = requests.post(url, headers=headers, files=files, data=data)
with open("split.pdf", "wb") as f:
f.write(response.content)
# Multiple ranges — decode base64 from JSON response
data = {"ranges": json.dumps([{"start": 0, "end": 2}, {"start": 3, "end": 5}])}
response = requests.post(url, headers=headers, files=files, data=data)
result = response.json()
for item in result["files"]:
with open(item["filename"], "wb") as f:
f.write(base64.b64decode(item["data"]))const fs = require("fs");
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("document.pdf")]), "document.pdf");
form.append("ranges", JSON.stringify([{ start: 0, end: 2 }]));
const response = await fetch("https://justpdf.app/api/v1/split", {
method: "POST",
headers: { "X-API-Key": "jpdf_your_key" },
body: form,
});
// Single range: binary PDF response
const buffer = await response.arrayBuffer();
fs.writeFileSync("split.pdf", Buffer.from(buffer));Response
Single range: returns the PDF as a binary file. Multiple ranges: returns JSON {"files": [{"filename": "split_1.pdf", "data": "<base64>"}]}.
/api/v1/rotateRotate all pages of a PDF by a specified angle.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| file | File | required | The PDF file to rotate |
| rotation | number | required | Rotation angle in degrees clockwise: 90, 180, or 270 |
Examples
curl -X POST https://justpdf.app/api/v1/rotate \
-H "X-API-Key: jpdf_your_key" \
-F "file=@document.pdf" \
-F "rotation=90" \
-o rotated.pdfimport requests
url = "https://justpdf.app/api/v1/rotate"
headers = {"X-API-Key": "jpdf_your_key"}
files = {"file": ("document.pdf", open("document.pdf", "rb"), "application/pdf")}
data = {"rotation": "90"}
response = requests.post(url, headers=headers, files=files, data=data)
with open("rotated.pdf", "wb") as f:
f.write(response.content)const fs = require("fs");
const form = new FormData();
form.append("file", new Blob([fs.readFileSync("document.pdf")]), "document.pdf");
form.append("rotation", "90");
const response = await fetch("https://justpdf.app/api/v1/rotate", {
method: "POST",
headers: { "X-API-Key": "jpdf_your_key" },
body: form,
});
const buffer = await response.arrayBuffer();
fs.writeFileSync("rotated.pdf", Buffer.from(buffer));Response
Returns the rotated PDF as a binary file (application/pdf).
API Key Management
Manage your API keys programmatically. These endpoints require Firebase authentication via a Bearer token (not an API key).
/api/v1/keysCreate a new API key. Send {"name": "My App", "tier": "basic"} in the request body. Returns the full key (shown only once). Maximum 5 keys per account.
/api/v1/keysList all your API keys. Keys are masked (first 8 characters shown).
/api/v1/keys/:idRevoke an API key. The key is permanently deleted and can no longer be used.
Rate Limits
| Plan | Requests per Day | Max File Size |
|---|---|---|
| Basic | 100 | 50 MB |
| Pro | 1,000 | 200 MB |
Rate limits reset daily at midnight UTC. When you exceed the limit, the API returns a 429 response. Contact us if you need higher limits.
Error Codes
| Status | Code | Description |
|---|---|---|
| 400 | Bad Request | Missing or invalid parameters (e.g., no file uploaded, invalid rotation value) |
| 401 | Unauthorized | Invalid or missing API key |
| 403 | Forbidden | Attempting to access a resource that belongs to another user |
| 404 | Not Found | The requested resource does not exist |
| 413 | Payload Too Large | File exceeds the size limit for your plan (50 MB basic, 200 MB pro) |
| 429 | Too Many Requests | Daily rate limit exceeded. Limits reset at midnight UTC. |
| 500 | Internal Server Error | Something went wrong during processing. Try again or contact support. |
Error Response Format
{
"error": "Description of what went wrong"
}Privacy & Security
Files are processed server-side and immediately deleted. They are never stored. All communication is encrypted via HTTPS.
- Files are held in memory only during processing
- No files are written to disk or persisted in any database
- API keys are stored securely and can be revoked at any time
- All requests are served over TLS/HTTPS
Need more requests or higher limits?
View API Plans & Pricing