Extract structured data from a document
Changed onPull specific fields from a document into a typed schema.
Accepts exactly one of: a file upload (multipart/form-data), a document URL (JSON body), or a file_id referencing an already-ingested document (from POST /v3/files), plus a JSON Schema (the schema field) describing what to extract.
Sync mode (default)
Blocks until extraction completes and returns 200 with the full result.
curl -X POST https://api.lighton.ai/api/v3/extract \
-H 'Authorization: Bearer $TOKEN' \
-F file=@invoice.pdf \
-F 'schema={"type":"object","properties":{"invoice_number":{"type":"string"}}}'
Async mode (options.async = true)
Returns 202 immediately with an ext_<token> job id. Poll GET /api/v3/extract/{id} with that same id until status is completed or failed.
curl -X POST https://api.lighton.ai/api/v3/extract \
-H 'Authorization: Bearer $TOKEN' \
-H 'Content-Type: application/json' \
-d '{"document": "https://example.com/report.pdf", "schema": {"type": "object", "properties": {"title": {"type": "string"}}}, "options": {"async": true}}'
For multipart uploads, pass options as a JSON-encoded form field: -F 'options={"async":true}'.
Supported file types: .pdf, .png, .jpg, .jpeg, .pptx, .ppt, .odp, .docx, .odt, .doc, .html
Sync limits: 20 MB file size, 15 pages.
Async limits: 100 MB file size, 1000 pages.
Request
- Base URLhttps://api.lighton.ai
- URLhttps://api.lighton.ai/api/v3/extract
- AuthHTTP bearer
Request body
Response
Extraction completed (sync mode).
Changes
- breaking
added required request body
- info
api operation id
api_v3_extract_createwas added - info
the endpoint scheme security
bearerAuthwas added to the API - info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the non-success response with the status
- info
added the success response with the status
- info
added the success response with the status
- breaking