API-documentatie
Upload een document, vraag de status op en haal het resultaat op.
1. Authenticatie
Maak een API-sleutel in je account en stuur die mee als Bearer-token.
Authorization: Bearer dv_xxxxxxxxxxxxxxxx
2. Taak aanmaken
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 = tekst uitlezen, ocr = scan omzetten naar doorzoekbare PDF + tekst.
3. Status opvragen
curl -H "Authorization: Bearer $KEY" https://docudex.comtronix.nl/api/v1/jobs/{id}
# status: queued → processing → done | failed
4. Resultaat ophalen
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
De omzetting behoudt de structuur: koppen, lijsten, tabellen en een inhoudsopgave (uit de bladwijzers van de PDF, of uit de herkende koppen).
Soorten verwerking
Kies met het veld type. Parameters geef je mee als JSON in het veld params.
| type | Betekenis | 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"
Ondersteunde bestandsformaten: 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
Met een prepaid bundel kost elke verwerking een vast aantal credits (zie GET /me, veld credit_costs). Mislukt een verwerking door een storing aan onze kant, dan komen de credits terug; kan een bestand echt niet worden herkend, stuur het dan ter inspectie (credits dubbel terug). Zonder saldo antwoordt de API met 402 insufficient_credits.
5. Overige endpoints
| Methode | Pad | |
|---|---|---|
| GET | /me | Je abonnement, limieten en gebruik |
| GET | /jobs | Je laatste taken |
| DELETE | /jobs/{id} | Taak en bestanden verwijderen |
| GET | /openapi.json | OpenAPI 3 |
6. Voorbeeldcode: uploaden, wachten, resultaat verwerken
Het patroon is altijd hetzelfde: POST het bestand, vraag de status op tot "done", haal dan het resultaat op. Alternatief voor wachten: geef een webhook_url mee, dan krijg je een melding zodra de taak klaar is.
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();
Roep de API vanaf een server aan en zet je sleutel nooit in publieke browsercode.
7. API-tester
Probeer het hier direct. Je sleutel gaat alleen naar deze site en wordt niet opgeslagen. Maak een sleutel onder Mijn account.
8. Foutcodes
| HTTP | Betekenis |
|---|---|
| 401 | Missing/invalid key |
| 402 | monthly_limit |
| 403 | feature_not_in_plan |
| 413 / 415 | file_too_large / unsupported_type |
| 429 | rate_limited / daily_limit |