eGate Document Extraction API

Upload a photo or PDF of an invoice or delivery order. You get structured JSON back, with a confidence score (0 to 1) for every field.

1. Request

Method / URLPOST https://docextract.egateai.com/v1/extract
HeaderX-API-Key: <your key>
Bodymultipart/form-data
filerequired. JPG, PNG, WEBP, HEIC or PDF, max 10 MB
document_typeoptional: auto (default, detects it), invoice or delivery_order

2. Example (curl)

curl -X POST https://docextract.egateai.com/v1/extract \
  -H "X-API-Key: YOUR_KEY" \
  -F "[email protected]" \
  -F "document_type=auto"

3. Example (Python)

import requests
r = requests.post("https://docextract.egateai.com/v1/extract",
    headers={"X-API-Key": "YOUR_KEY"},
    files={"file": open("invoice.jpg", "rb")}, data={"document_type": "auto"})
print(r.json())

4. Response

Every response has success, document_type (invoice or delivery_order), document_type_confidence and data. Each field in data looks like {"value": "INV-001", "confidence": 0.98}. A value is null when it is not on the document. Fields below 0.6 should be reviewed by a person. warnings lists anything unclear.

Invoice data: invoice_number, invoice_date, due_date, po_number, payment_terms, currency, supplier{name, registration_no, tax_id, address, phone}, buyer{...}, line_items[{description, quantity, unit, unit_price, amount, confidence}], subtotal, tax_amount, total, warnings.

Delivery order data: do_number, do_date, po_number, reference_no, supplier{...}, customer{...}, delivery_address, vehicle_no, driver_name, items[{description, quantity, unit, confidence}], received{received_by_name, received_date, signature_present (yes/no), stamp_company_name, stamp_location}, remarks, warnings.

5. Errors

CodeMeaning
400Empty file or bad document_type
401Missing or wrong X-API-Key
413File over 10 MB
415Unsupported file type
422Not an invoice or delivery order (auto mode)
502Reading service busy; retry in a few seconds

6. Tips

eGate Messaging Sdn Bhd | [email protected] | +603 7877 6216