JustPDF

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/v1

Content Type

multipart/form-data

Response 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

  1. Sign in to your JustPDF account
  2. Make a POST request to /api/v1/keys with your Firebase auth token
  3. Store the returned key securely — it is only shown once
Create an API key
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"}'
Using your API key
curl -X POST https://justpdf.app/api/v1/compress \
  -H "X-API-Key: jpdf_your_api_key_here" \
  -F "file=@document.pdf" \
  -o compressed.pdf

Endpoints

POST/api/v1/merge

Merge multiple PDF files into a single document.

Parameters

NameTypeRequiredDescription
filesFile[]requiredTwo or more PDF files to merge (multipart form field, repeated)

Examples

cURL
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.pdf
Python
import 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)
Node.js
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).

POST/api/v1/compress

Compress a PDF to reduce file size.

Parameters

NameTypeRequiredDescription
fileFilerequiredThe PDF file to compress

Examples

cURL
curl -X POST https://justpdf.app/api/v1/compress \
  -H "X-API-Key: jpdf_your_key" \
  -F "file=@document.pdf" \
  -o compressed.pdf
Python
import 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)
Node.js
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).

POST/api/v1/split

Split a PDF into one or more documents by page ranges.

Parameters

NameTypeRequiredDescription
fileFilerequiredThe PDF file to split
rangesstringrequiredJSON array of page ranges (0-indexed, inclusive). Example: [{"start":0,"end":2}]

Examples

cURL
# 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}]'
Python
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"]))
Node.js
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>"}]}.

POST/api/v1/rotate

Rotate all pages of a PDF by a specified angle.

Parameters

NameTypeRequiredDescription
fileFilerequiredThe PDF file to rotate
rotationnumberrequiredRotation angle in degrees clockwise: 90, 180, or 270

Examples

cURL
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.pdf
Python
import 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)
Node.js
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).

POST/api/v1/keys

Create 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.

GET/api/v1/keys

List all your API keys. Keys are masked (first 8 characters shown).

DELETE/api/v1/keys/:id

Revoke an API key. The key is permanently deleted and can no longer be used.

Rate Limits

PlanRequests per DayMax File Size
Basic10050 MB
Pro1,000200 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

StatusCodeDescription
400Bad RequestMissing or invalid parameters (e.g., no file uploaded, invalid rotation value)
401UnauthorizedInvalid or missing API key
403ForbiddenAttempting to access a resource that belongs to another user
404Not FoundThe requested resource does not exist
413Payload Too LargeFile exceeds the size limit for your plan (50 MB basic, 200 MB pro)
429Too Many RequestsDaily rate limit exceeded. Limits reset at midnight UTC.
500Internal Server ErrorSomething went wrong during processing. Try again or contact support.

Error Response Format

JSON
{
  "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