Bytefusedocs

AI Tools

AI Extract Data

Pull structured JSON out of a PDF — using a built-in preset (invoice, receipt, resume), your own JSON schema, or a fully automatic “all salient fields” pass. A premium vision engine reads the page image directly for degraded scans.

PRO / ENTERPRISE only 100 credits / callAI vision: 200 / callSynchronous

Overview

Upload a PDF; the extracted data comes back inline as JSON (no download URL). The model is instructed to use null for absent fields — it never invents values.

POSThttps://api.bytefuse.in/api/v1/ai/extract-data

Paid plans only

Requires a PRO or ENTERPRISE plan — anonymous → 401, free-tier → 403.

Request

Content type multipart/form-data:

filefilerequired
The PDF to read (must end in .pdf, else 415).
presetstringoptional
invoice, receipt or resume selects a built-in field map. Blank or unknown means “extract all salient key/value fields”. Ignored if schema is supplied.Default: auto
schemastring (JSON)optional
A JSON schema / field map as a JSON string. If present it must parse as JSON (else 422) and overrides preset.Default: none
enginestringoptional
auto (text/OCR → LLM) or vision (reads the page image). Any other value → 422.Default: auto

Engines & pricing

Billed per call, flat, regardless of page count:

ConditionCost / call
engine=auto (default) — text/OCR then LLMai.extract100
engine=vision — reads the first ≤3 pages as an imageai.extract.ai200

Vision billing & fallback

engine=vision wins on degraded/photographed scans where OCR garbles numbers. It’s billed the 200-credit vision rate based on the engine you requested — even if it internally falls back to the text path, the charge stands (though the response engine field reports the path that actually ran). If AI vision isn’t configured, the call returns 422.

Response

200 OK, application/json:

200 OK
{
  "success": true,
  "data": { "invoice_number": "INV-1042", "total": 980.00, "line_items": [ … ] },
  "credits_charged": 200,
  "engine": "vision",
  "preset": "invoice",
  "had_schema": false,
  "parsed_ok": true,
  "processing_time_ms": 4501
}
dataobject | arrayoptional
The extracted JSON. If the model output couldn’t be parsed, this is { "_unparsed": "<raw text>" } (still a 200 — see parsed_ok).
enginestringoptional
The path that actually produced the data — vision or auto (a vision request that fell back reports auto).
presetstring | nulloptional
Echo of the requested preset.
had_schemabooloptional
true if a custom schema was supplied.
parsed_okbooloptional
true if data is valid parsed JSON; false for the _unparsed fallback.
credits_chargedintoptional
100 or 200. Mirrors X-Credits-Charged.

Examples

curl -X POST https://api.bytefuse.in/api/v1/ai/extract-data \
  -H "X-API-Key: dt_live_your_key" \
  -F "file=@invoice.pdf" \
  -F "preset=invoice" \
  -F "engine=vision"

Errors

401Anonymous / no valid credential.
403Free-tier account — AI tools need PRO or ENTERPRISE.
415Missing filename or not a .pdf.
422engine isn’t auto/vision, schema isn’t valid JSON, no extractable text, vision not configured, or a password-protected PDF.
402 / 429 / 503Insufficient credits, rate limited, or capacity/config error.
500AI processing failed unexpectedly.