Developer Documentationv1.0

AllPDFMagic API

REST API for PDF processing and AI document intelligence. Free Starter tier for every registered user — no credit card required.

Starter tier free50+ endpointsSSL encryptedSandbox test mode
Free
Starter tier
50+
API endpoints
Sandbox
Test without quota
$29
Developer / month

Quick Start

Starter — Free
cURL
curl -X POST \
  https://www.allpdfmagic.com/api/v1/pdf/compress \
  -H "Authorization: Bearer YOUR_KEY" \
  -F "file=@document.pdf" \
  -o compressed.pdf
Python
import requests

API_KEY = "apm_live_YOUR_KEY"
BASE = "https://www.allpdfmagic.com"

with open("document.pdf", "rb") as f:
    res = requests.post(
        f"{BASE}/api/v1/pdf/compress",
        headers={"Authorization": f"Bearer {API_KEY}"},
        files={"file": f},
    )

# Check remaining quota
remaining = res.headers.get("X-RateLimit-Remaining")
print(f"Calls remaining: {remaining}")

with open("compressed.pdf", "wb") as out:
    out.write(res.content)
Node.js
import fs from "fs";
import FormData from "form-data";
import fetch from "node-fetch";

const KEY = "apm_live_YOUR_KEY";
const BASE = "https://www.allpdfmagic.com";

const form = new FormData();
form.append("file", fs.createReadStream("doc.pdf"));

const res = await fetch(`${BASE}/api/v1/pdf/compress`, {
  method: "POST",
  headers: { Authorization: `Bearer ${KEY}` },
  body: form,
});

const remaining = res.headers.get("x-ratelimit-remaining");
console.log("Calls remaining:", remaining);

const buf = Buffer.from(await res.arrayBuffer());
fs.writeFileSync("compressed.pdf", buf);

AI Invoice Extraction — Developer tier example:

cURL — Extract Invoice
curl -X POST \
  https://www.allpdfmagic.com/api/v1/ai/extract-invoice \
  -H "Authorization: Bearer YOUR_KEY" \
  -F "file=@invoice.pdf" \
  -F "export_format=json"
Python — Extract Invoice
with open("invoice.pdf", "rb") as f:
    res = requests.post(
        f"{BASE}/api/v1/ai/extract-invoice",
        headers={"Authorization": f"Bearer {API_KEY}"},
        files={"file": f},
        data={"export_format": "json"},
    )
data = res.json()
print(data["data"]["total_amount"])
print(data["data"]["vendor"]["gstin"])

Authentication

All requests require a Bearer token in the Authorization header. API keys are generated from your dashboard — free for every registered user.

Authorization: Bearer apm_live_xxxxxxxxxxxxxxxxxxxxxxxx

Get your free API key

Sign up to get 200 API calls/month at no cost. No credit card required. Upgrade when you need more.

Sandbox — Test Mode

All tiers — no quota consumed

Replace /api/v1/ with /api/v1/sandbox/ to get realistic mock responses without consuming quota. Your API key is still validated — so you can test auth too.

Production

POST /api/v1/ai/extract-invoice

Sandbox (same key, zero quota)

POST /api/v1/sandbox/ai/extract-invoice

Sandbox responses include

X-Sandbox: trueRealistic mock dataSame JSON schema as productionZero quota usageFast response (~12ms)

API Pricing

Starter

Free
500calls / month
  • PDF compress, merge, split, rotate
  • Delete & extract pages
  • Add page numbers
  • PDF → TXT & PDF → PNG
  • Image to PDF
  • Usage & health (no quota)
  • 1 API key
  • Sandbox test mode

Indie

$9/mo
2,000calls / month

$90/yr — save $18

  • Everything in Starter
  • PDF sign (text, drawn, image)
  • AI summarise documents
  • HTML → PDF & PDF → CSV
  • 8 Office ↔ PDF conversion APIs
  • 2 API keys

Developer

$29/mo
10,000calls / month

$290/yr — save $58

  • Everything in Indie
  • PDF protect, watermark & unlock
  • AI invoice extraction & OCR
  • AI table extraction
  • AI document Q&A (generate questions)
  • 5 API keys

Business

$99/mo
100,000calls / month

$990/yr — save $198

  • Everything in Developer
  • parse-document & parse-batch
  • validate-file & validate-batch
  • auto-redact PII (GDPR/DPDP)
  • extract-clauses, diff-documents, cross-check
  • Fraud detection & GSTR-2B reconciliation
  • Bulk async processing (100 files/call)
  • 5 pipeline APIs
  • 10 API keys
  • Priority SLA

Rate Limit Headers

Every API response includes these headers so your code can track usage in real time:

X-RateLimit-Limit: 200 / 10000 / 100000
Monthly quota for your tier
X-RateLimit-Remaining: 147
Calls remaining this month
X-RateLimit-Reset: 1748736000
Next reset (Unix timestamp)
X-Api-Tier: starter
Your current tier
X-Upgrade-Url: …/pricing#api
Present at ≥80% usage and on 429/403
X-Usage-Warning: 85% of quota used
Present at ≥80% usage

API Endpoints

56 endpoints

PDF Operations

Starter — Free

Core PDF tools — free for all registered users

10 endpoints
POST/api/v1/pdf/compress

Compress a PDF to reduce file size

Parameters

filefilerequiredPDF to compress
levelstringlow | medium | high (default: medium)
POST/api/v1/pdf/merge

Merge multiple PDFs into one document

Parameters

filesfile[]requiredPDFs to merge (sent in order)
POST/api/v1/pdf/split

Split a PDF into separate files

Parameters

filefilerequiredPDF to split
pagesstringPage ranges e.g. "1-3,5,7-9"
POST/api/v1/pdf/rotate

Rotate pages in a PDF

Parameters

filefilerequiredPDF to rotate
degreesinteger90 | 180 | 270 (default: 90)
POST/api/v1/pdf/delete-pages

Remove specific pages from a PDF

Parameters

filefilerequiredPDF to edit
pagesstringrequiredPages to remove e.g. "1,3-5,8"
POST/api/v1/pdf/extract-pages

Extract specific pages into a new PDF

Parameters

filefilerequiredPDF to extract from
pagesstringrequiredPages to keep e.g. "2-4,7"
POST/api/v1/pdf/add-page-numbers

Add page numbers to a PDF

Parameters

filefilerequiredPDF to number
positionstringbottom-center | bottom-left | bottom-right | top-center (default: bottom-center)
start_numberintegerStarting page number (default: 1)
formatstring"{n}" | "Page {n}" | "{n} of {total}" (default: "{n}")
POST/api/v1/convert/image-to-pdf

Convert JPG / PNG / WebP images to PDF

Parameters

filesfile[]requiredImage files (add multiple for multi-page)
POST/api/v1/convert/pdf-to-txt

Extract all text from a PDF — instant, zero cost, no AI

Parameters

filefilerequiredPDF file
POST/api/v1/convert/pdf-to-png

Convert each PDF page to a PNG image

Parameters

filefilerequiredPDF file
dpiintegerResolution in DPI (default: 150)

Signatures & Signing

Indie — $9/mo

Add text, drawn, or image signatures to PDFs — Indie tier

1 endpoints
POST/api/v1/pdf/sign

Add a signature to a PDF — text typed, drawn (base64), or uploaded image

Parameters

filefilerequiredPDF to sign
signature_typestringtext | base64 | image (default: text)
textstringSignature text (when signature_type=text)
signature_datastringBase64-encoded PNG of drawn signature (when signature_type=base64)
signature_filefilePNG/JPG signature image (when signature_type=image)
pageinteger0-indexed page number to sign (default: last page)
xintegerX position in points (default: 100)
yintegerY position in points (default: 100)
widthintegerSignature width in points (default: 200)
heightintegerSignature height in points (default: 100)

AI Summarisation

Indie — $9/mo

Instant AI-powered document summaries — Indie tier

1 endpoints
POST/api/v1/ai/summarize

Generate an AI summary of any document with key points extracted

Parameters

filefilerequiredPDF document
max_lengthintegerMax words in summary (default: 500)

Format Conversions

Indie — $9/mo

Convert between PDF and Office / CSV formats — Indie tier and above

8 endpoints
POST/api/v1/convert/html-to-pdf

Render HTML to PDF — upload file or supply a public URL

Parameters

filefileHTML file (.html / .htm)
urlstringPublic URL to render (use file OR url)
POST/api/v1/convert/pdf-to-csv

Extract tables from PDF and return as CSV

Parameters

filefilerequiredPDF with tables
POST/api/v1/convert/pdf-to-word

Convert PDF to editable Word document (.docx)

Parameters

filefilerequiredPDF file
POST/api/v1/convert/pdf-to-excel

Extract tables from PDF to Excel (.xlsx)

Parameters

filefilerequiredPDF file
POST/api/v1/convert/pdf-to-jpg

Convert each PDF page to a JPG image

Parameters

filefilerequiredPDF file
dpiintegerResolution in DPI (default: 150)
POST/api/v1/convert/word-to-pdf

Convert Word document (.docx / .doc) to PDF

Parameters

filefilerequired.docx or .doc file
POST/api/v1/convert/excel-to-pdf

Convert Excel spreadsheet (.xlsx) to PDF

Parameters

filefilerequired.xlsx or .xls file
POST/api/v1/convert/ppt-to-pdf

Convert PowerPoint (.pptx) to PDF

Parameters

filefilerequired.pptx or .ppt file

PDF Security & Editing

Developer — $29/mo

Password protection, watermarking, and unlock — Developer tier

3 endpoints
POST/api/v1/pdf/protect

Password-protect a PDF and set permissions

Parameters

filefilerequiredPDF to protect
passwordstringrequiredPassword to set on the PDF
permissionsstringJSON array: ["print","copy","annotate","fill_forms"] — default: read-only
POST/api/v1/pdf/watermark

Add text or image watermark to a PDF

Parameters

filefilerequiredPDF to watermark
textstringWatermark text (use text OR image_file)
image_filefileWatermark image PNG/JPG
opacityfloat0.0–1.0 (default: 0.3)
positionstringcenter | diagonal | top-left | top-right | bottom-left | bottom-right (default: diagonal)
pagesstringall (default) or e.g. "1,3-5"
POST/api/v1/pdf/unlock

Remove password protection from a PDF

Parameters

filefilerequiredPassword-protected PDF
passwordstringOwner/user password if known (tried first)

AI Document Intelligence

Developer — $29/mo

AI-powered data extraction, OCR, table extraction, and document Q&A

4 endpoints
POST/api/v1/ai/extract-invoice

Extract structured data from invoices — vendor, amounts, GSTIN, line items

Parameters

filefilerequiredInvoice PDF
export_formatstringjson | csv | excel | quickbooks | xero
include_line_itemsbooleanExtract line items (default: true)
POST/api/v1/ai/ocr

Extract text from scanned PDFs and images using OCR

Parameters

filefilerequiredScanned PDF or image
POST/api/v1/ai/extract-tables

Extract tables from PDF to structured JSON or Excel

Parameters

filefilerequiredPDF with tables
pagesstringPage numbers to process
POST/api/v1/ai/questions

Generate comprehension questions from a document — for quizzes, onboarding, document review

Parameters

filefilerequiredPDF document
num_questionsintegerNumber of questions (default: 5, max: 20)
difficultystringeasy | medium | hard (default: medium)
focus_areastringFree-text hint e.g. "financial figures"

Enterprise Workflows

Business — $99/mo

Document intelligence workflows for fintech, legal, and accounting teams

14 endpoints
POST/api/v1/workflows/parse-document

Parse any document to structured JSON — entities, amounts, dates, tables

Parameters

filefilerequiredPDF, Excel, Word, or image
extract_entitiesbooleanExtract dates, amounts (default: true)
include_tablesbooleanInclude table data (default: true)
POST/api/v1/workflows/parse-batch

Parse up to 100 documents in one call

Parameters

filesfile[]requiredUp to 100 files
POST/api/v1/workflows/validate-file

Validate a document against compliance rules — GST, bank upload, vendor onboarding, insurance

Parameters

filefilerequiredDocument to validate
format_typestringgst | bank_upload | vendor_onboarding | insurance_claim
POST/api/v1/workflows/validate-batch

Validate multiple documents in one call — same format_types as validate-file

Parameters

filesfile[]requiredUp to 100 files
format_typestringgst | bank_upload | vendor_onboarding | insurance_claim
POST/api/v1/workflows/auto-redact

Automatically detect and redact PII — GDPR / DPDP compliant

Parameters

filefilerequiredPDF file
pii_typesstringpan,aadhaar,ssn,email,phone,bank_account,credit_card
POST/api/v1/workflows/extract-clauses

Extract clauses, obligations, deadlines, and risk levels from contracts

Parameters

filefilerequiredContract or policy PDF
document_typestringcontract | policy | terms (default: contract)
POST/api/v1/workflows/detect-duplicates

Detect duplicate and near-duplicate documents across a set of files

Parameters

filesfile[]required2 or more files to compare
similarity_thresholdfloat0–1 (default: 0.95)
POST/api/v1/workflows/diff-documents

Compare two document versions and extract a structured change log

Parameters

old_versionfilerequiredPrevious version
new_versionfilerequiredNew version
POST/api/v1/workflows/cross-check

Cross-check two documents for consistency — e.g. Invoice vs Purchase Order

Parameters

filesfile[]requiredTwo files to compare
comparison_typestringinvoice_po | vendor_verification | auto
POST/api/v1/workflows/process-bank-statement

Analyse a bank statement — transactions, categories, Tally-ready export

Parameters

filefilerequiredBank statement PDF
currencystringinr_gst | usd | gbp | eur
POST/api/v1/workflows/reconcile-documents

Reconcile purchase records with GSTR-2B to identify ITC discrepancies

Parameters

filefilerequiredPurchase register or GSTR-2B PDF
reconciliation_typestringgstr_2b | gstr_3b
POST/api/v1/workflows/detect-fraud

AI fraud detection on invoices — risk score and red flags

Parameters

filefilerequiredInvoice PDF
filesfile[]Additional files for cross-vendor check (optional)
POST/api/v1/bulk/upload

Submit a batch of up to 100 files for async processing

Parameters

filesfile[]requiredUp to 100 files
operationstringrequiredcompress | merge | convert | extract-invoice
GET/api/v1/bulk/:job_id

Poll batch job status and retrieve results

Parameters

job_idpathrequiredJob ID from upload response

Document Pipelines

Business — $99/mo

Chained multi-workflow pipelines for complete business outcomes — Business tier

5 endpoints
POST/api/v1/pipelines/trusted-data

Normalise → validate → quality-score any document in one pipeline call

Parameters

filefilerequiredPDF, Excel, Word, or image
extract_entitiesbooleanExtract entities (default: true)
include_tablesbooleanInclude table data (default: true)
POST/api/v1/pipelines/onboarding

Vendor onboarding pipeline — extract → verify GSTIN/PAN → risk-score → approve/reject decision

Parameters

filefilerequiredBusiness registration, GST cert, or PAN doc
gstinstringGSTIN override if not in document
panstringPAN override if not in document
vendor_namestringTrading name (aids extraction accuracy)
POST/api/v1/pipelines/risk-check

Comprehensive risk pipeline — fraud score + compliance score + duplicate detection on any document

Parameters

filefilerequiredInvoice, contract, or filing PDF
document_typestringinvoice | contract | gst_filing | bank_statement (auto-detected)
POST/api/v1/pipelines/contract-intel

Contract intelligence pipeline — clause extraction + obligation mapping + risk scoring + executive summary

Parameters

filefilerequiredContract PDF
counterparty_namestringCounterparty name (aids party extraction)
POST/api/v1/pipelines/regulatory

Regulatory compliance pipeline — detect filing type → validate fields → flag violations → ready-to-file check

Parameters

filefilerequiredRegulatory document (GST return, ITR, TDS, audit report)
filing_typestringgst | itr | tds | audit | mca (auto-detected)
assessment_yearstringe.g. "2024-25"

Sandbox (Test Mode)

Starter — Free

Same signature as production. Returns mock data. Zero quota consumption.

7 endpoints
POST/api/v1/sandbox/pdf/compress

Sandbox: compress — returns a test PDF

POST/api/v1/sandbox/pdf/sign

Sandbox: sign — returns a test signed PDF

POST/api/v1/sandbox/convert/pdf-to-png

Sandbox: pdf-to-png — returns mock base64 PNG images

POST/api/v1/sandbox/ai/extract-invoice

Sandbox: extract-invoice — returns mock invoice JSON

POST/api/v1/sandbox/ai/questions

Sandbox: questions — returns 5 mock questions

POST/api/v1/sandbox/workflows/parse-document

Sandbox: parse-document — returns mock parsed JSON

GET/api/v1/sandbox/usage/check

Sandbox: usage check — returns mock usage stats

Usage & Health

Starter — Free

Monitor quota and API status

3 endpoints
GET/api/v1/health

API health check — no authentication required

GET/api/v1/usage/check

Check current usage count, limit, and reset date

GET/api/v1/usage/stats

Detailed usage statistics broken down by endpoint and day

Response Examples

Success (200) — AI extract-invoice
{
  "success": true,
  "data": {
    "invoice_number": "INV-2024-001",
    "date": "2024-12-15",
    "vendor": {
      "name": "Acme Corp",
      "gstin": "29AABCS1429B1ZB"
    },
    "total_amount": 14160.00,
    "currency": "INR",
    "line_items": [...]
  },
  "confidence": 0.97,
  "responseTime": "820ms"
}
Rate limit error (429)
{
  "success": false,
  "error": "Monthly limit reached (200 calls/Starter). Resets on the 1st.",
  "documentation": "https://www.allpdfmagic.com/docs/api",
  "upgrade": "https://www.allpdfmagic.com/pricing#api"
}

// Response headers also include:
// X-Upgrade-Url: https://www.allpdfmagic.com/pricing#api
// X-RateLimit-Limit: 200
// X-Api-Tier: starter

Error Codes

Code
Status
Description
200
OK
Request successful
400
Bad Request
Invalid parameters or file format
401
Unauthorized
Missing or invalid API key
403
Forbidden
Endpoint requires a higher tier plan
413
File Too Large
File exceeds 100MB limit
429
Rate Limited
Monthly quota exceeded — X-Upgrade-Url in header
500
Server Error
Internal processing error

Webhooks

Developer+

Receive real-time notifications when batch jobs complete or fraud is flagged. Configure webhook URLs in your API dashboard.

Webhook Payload
{
  "event": "job.completed",
  "job_id": "job_abc123xyz",
  "status": "success",
  "files_processed": 25,
  "download_url": "https://www.allpdfmagic.com/api/dashboard/download?...",
  "timestamp": "2024-12-17T10:30:00Z"
}

API Playground

Try any endpoint live — no code required. Use sandbox mode to test without quota.

Sandbox mode returns realistic mock data instantly, uses zero quota, and works with any API key. Switch to Live to call the real endpoint.

Start building today — it's free

Ready to integrate?

Get a free API key in seconds. 200 calls/month included forever. Test in the sandbox first, then go live.