API documentation
Upload a document, poll its status and fetch the result.
1. Authentication
Create an API key in your account and send it as a Bearer token.
Authorization: Bearer dv_xxxxxxxxxxxxxxxx
2. Create a job
curl -X POST https://docudex.comtronix.nl/api/v1/jobs \
-H "Authorization: Bearer $KEY" \
-F "file=@document.pdf" \
-F "type=extract" # info | text | ocr | extract | tables | pdf_edit | redact | ai_extract
# optioneel: -F "webhook_url=https://example.com/hook"
info = metadata, text = extract text, ocr = turn a scan into a searchable PDF + text.
3. Get the status
curl -H "Authorization: Bearer $KEY" https://docudex.comtronix.nl/api/v1/jobs/{id}
# status: queued → processing → done | failed
4. Fetch the result
curl -H "Authorization: Bearer $KEY" "https://docudex.comtronix.nl/api/v1/jobs/{id}/result?format=json"
curl -H "Authorization: Bearer $KEY" "https://docudex.comtronix.nl/api/v1/jobs/{id}/result?format=text"
curl -H "Authorization: Bearer $KEY" "https://docudex.comtronix.nl/api/v1/jobs/{id}/result?format=pdf" -o ocr.pdf # export
# omzetten (plan met export): html, docx, report_pdf (nieuwe pdf met bladwijzers), report_txt
curl -H "Authorization: Bearer $KEY" "https://docudex.comtronix.nl/api/v1/jobs/{id}/result?format=docx" -o rapport.docx
The conversion keeps the structure: headings, lists, tables and a table of contents (from the PDF bookmarks, or from the recognized headings).
Job types
Choose with the type field. Pass parameters as JSON in the params field.
| type | Meaning | params (JSON) |
|---|---|---|
| info | metadata, pages, needs_ocr… | – |
| text | text per page | – |
| ocr | scan → searchable PDF + text | – |
| extract | supplier, document type, fields, rates, line items + checks (needs_review) | – |
| ai_extract | AI reading: summary, fields, line items, answers + checks (own AI or, if enabled for you, the server AI) | {"source":"own|system","consent":true,"instructions":"…","learn":true} — consent is required when the AI is Claude (document goes to Anthropic). learn (optional): let the system remember recognition patterns (sender, document type, fixed words; never your data) so later documents of this kind are processed faster and locally. An administrator approves new patterns first. |
| tables | tables as JSON + CSV zip (PDF, XLSX/ODS, CSV, HTML) | {"pages":"1-3"} |
| pdf_edit | rotate · delete · extract · split · merge · compress · watermark · metadata · to_images | {"op":"rotate","angle":90,"pages":"1,3-5"}; merge: extra files in files[] |
| redact | black out text for real (verified afterwards) | {"terms":["Jansen"],"patterns":["iban","email","phone","postcode","bsn","url","date_of_birth"]} |
curl -X POST https://docudex.comtronix.nl/api/v1/jobs -H "Authorization: Bearer $KEY" \
-F "file=@a.pdf" -F "type=redact" -F 'params={"patterns":["iban","email"]}'
curl -H "Authorization: Bearer $KEY" "https://docudex.comtronix.nl/api/v1/jobs/{id}/result?format=file" -o redacted.pdf
curl -H "Authorization: Bearer $KEY" "https://docudex.comtronix.nl/api/v1/search?q=energie"
Supported file formats: PDF, PNG, JPG, JPEG, GIF, BMP, TIF, TIFF, WEBP, HEIC, HEIF, DOCX, XLSX, PPTX, ODT, ODS, ODP, EPUB, RTF, TXT, MD, LOG, CSV, TSV, JSON, HTML, HTM, XML, EML
Prepaid credits
With a prepaid bundle every job costs a fixed number of credits (see GET /me, field credit_costs). If a job fails because of a fault on our side the credits come back; if a file truly cannot be recognized, send it for inspection (credits back double). Without balance the API answers 402 insufficient_credits.
5. Other endpoints
| Methode | Pad | |
|---|---|---|
| GET | /me | Your plan, limits and usage |
| GET | /jobs | Your latest jobs |
| DELETE | /jobs/{id} | Delete a job and its files |
| GET | /openapi.json | OpenAPI 3 |
6. Example code: upload, wait, process the result
Always the same pattern: POST the file, poll the status until "done", then fetch the result. Instead of polling, pass a webhook_url and you get a call when the job is finished.
Python
import time, requests
API, KEY = "https://docudex.comtronix.nl/api/v1", "dv_xxxxxxxx"
H = {"Authorization": "Bearer " + KEY}
with open("factuur.pdf", "rb") as f:
job = requests.post(API + "/jobs", headers=H, files={"file": f}, data={"type": "extract"}).json()
while True: # status: queued → processing → done | failed
s = requests.get(f"{API}/jobs/{job['id']}", headers=H).json()
if s["status"] in ("done", "failed"): break
time.sleep(2)
if s["status"] == "done":
result = requests.get(f"{API}/jobs/{job['id']}/result?format=json", headers=H).json()
print(result["supplier"], result["fields"].get("total_amount"), result["needs_review"])
PHP
$api = 'https://docudex.comtronix.nl/api/v1'; $h = ['Authorization: Bearer dv_xxxxxxxx'];
$ch = curl_init("$api/jobs");
curl_setopt_array($ch, [CURLOPT_POST => 1, CURLOPT_HTTPHEADER => $h, CURLOPT_RETURNTRANSFER => 1,
CURLOPT_POSTFIELDS => ['file' => new CURLFile('factuur.pdf'), 'type' => 'extract']]);
$job = json_decode(curl_exec($ch), true);
do { sleep(2);
$s = json_decode(file_get_contents("$api/jobs/{$job['id']}", false,
stream_context_create(['http' => ['header' => $h[0]]])), true);
} while (in_array($s['status'], ['queued', 'processing']));
$result = json_decode(file_get_contents("$api/jobs/{$job['id']}/result?format=json", false,
stream_context_create(['http' => ['header' => $h[0]]])), true);
JavaScript (Node 18+ / browser)
const API = "https://docudex.comtronix.nl/api/v1", H = { Authorization: "Bearer dv_xxxxxxxx" };
const fd = new FormData(); fd.append("file", fileBlob, "factuur.pdf"); fd.append("type", "extract");
const job = await (await fetch(API + "/jobs", { method: "POST", headers: H, body: fd })).json();
let s;
do { await new Promise(r => setTimeout(r, 2000));
s = await (await fetch(`${API}/jobs/${job.id}`, { headers: H })).json();
} while (["queued", "processing"].includes(s.status));
const result = await (await fetch(`${API}/jobs/${job.id}/result?format=json`, { headers: H })).json();
Call the API from a server and never put your key in public browser code.
7. API tester
Try it right here. Your key only goes to this site and is not stored. Create a key under My account.
8. Error codes
| HTTP | Meaning |
|---|---|
| 401 | Missing/invalid key |
| 402 | monthly_limit |
| 403 | feature_not_in_plan |
| 413 / 415 | file_too_large / unsupported_type |
| 429 | rate_limited / daily_limit |