Quickstart
First extraction in under 5 minutes.
1. Create an account
Sign up — free, no credit card required. You get 10 pages free on the free plan.
2. Get an API key
Go to Dashboard → API Keys → New key. Copy it — it starts with exdoc_live_ and is shown only once.
export EXDOC_API_KEY="exdoc_live_your_key_here"
3. Submit a job
curl -X POST "https://exdocapi.cheapehai.shop/api/v1/extract" \
-H "Authorization: Bearer $EXDOC_API_KEY" \
-F "file=@invoice.pdf" \
-F 'extract={"document_type":"invoice","fields":{"invoice_number":"invoice reference number","total":"final amount due","vendor_name":"name of the seller"}}'
Response — 201 Created:
{
"job_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"status": "pending",
"page_count": 2
}
4. Poll until done
curl "https://exdocapi.cheapehai.shop/api/v1/jobs/a1b2c3d4-e5f6-7890-abcd-ef1234567890" \
-H "Authorization: Bearer $EXDOC_API_KEY"
Poll every 2–5 seconds. Most documents finish in under 20 seconds.
5. Read the result
Once status is done:
{
"id": "a1b2c3d4-...",
"status": "done",
"file_name": "invoice.pdf",
"page_count": 2,
"result": {
"invoice_number": "INV-2024-0042",
"total": "18,450.00",
"vendor_name": "Acme Supplies Ltd."
}
}
Fields not found in the document come back as null.
Full example — JavaScript / Node.js
import fs from 'fs'
const API_KEY = process.env.EXDOC_API_KEY
const BASE = 'https://exdocapi.cheapehai.shop'
// 1. Submit
const form = new FormData()
form.append('file', new Blob([fs.readFileSync('invoice.pdf')]), 'invoice.pdf')
form.append('extract', JSON.stringify({
document_type: 'invoice',
fields: {
invoice_number: 'invoice reference number',
total: 'final amount due',
vendor_name: 'name of the seller',
date: 'date the invoice was issued',
}
}))
const submit = await fetch(`${BASE}/api/v1/extract`, {
method: 'POST',
headers: { Authorization: `Bearer ${API_KEY}` },
body: form,
})
const { job_id } = await submit.json()
// 2. Poll
let job
do {
await new Promise(r => setTimeout(r, 3000))
const res = await fetch(`${BASE}/api/v1/jobs/${job_id}`, {
headers: { Authorization: `Bearer ${API_KEY}` },
})
job = await res.json()
} while (job.status !== 'done' && job.status !== 'failed')
if (job.status === 'failed') throw new Error(job.error)
console.log(job.result)
Full example — Python
import requests, time
API_KEY = "exdoc_live_your_key_here"
BASE = "https://exdocapi.cheapehai.shop"
# 1. Submit
with open("invoice.pdf", "rb") as f:
resp = requests.post(
f"{BASE}/api/v1/extract",
headers={"Authorization": f"Bearer {API_KEY}"},
files={"file": ("invoice.pdf", f, "application/pdf")},
data={"extract": '{"document_type":"invoice","fields":{"invoice_number":"invoice reference number","total":"final amount due"}}'},
)
resp.raise_for_status()
job_id = resp.json()["job_id"]
# 2. Poll
while True:
time.sleep(3)
job = requests.get(
f"{BASE}/api/v1/jobs/{job_id}",
headers={"Authorization": f"Bearer {API_KEY}"},
).json()
if job["status"] == "done":
print(job["result"])
break
if job["status"] == "failed":
raise Exception(job["error"])