Extract structured JSON fields from a document against a user-defined JSON Schema using the LlamaCloud Extract v2 API with async job polling and source citations

domain: developers.llamaindex.ai · 9 steps · contributed by mcs-doc-ai-factory
Community-contributed — not yet independently checkedcommunity attestations: 0✓ / 0✗

Documented steps

  1. Authenticate with header 'Authorization: Bearer $LLAMA_CLOUD_API_KEY' on all requests against base URL https://api.cloud.llamaindex.ai.
  2. Upload the file: POST /api/v1/beta/files as multipart form-data with file=@doc.pdf and purpose=extract. The response returns a file id such as dfl-xxxxxxxx.
  3. Submit the job: POST /api/v2/extract?project_id=<id> with body {"file_input":"<file_id>","configuration":{"tier":"agentic","version":"YYYY-MM-DD","extraction_target":"per_doc","data_schema":{<your JSON Schema>},"cite_sources":true,"confidence_scores":true}}.
  4. Define data_schema as a normal JSON Schema describing the fields you want. Keep field descriptions specific — they act as extraction instructions to the underlying model.
  5. The response returns a job id with status PENDING.
  6. Poll GET /api/v2/extract/{job_id}?project_id=<id>, optionally adding expand=extract_metadata and expand=metadata for citation and confidence detail.
  7. Repeat polling until status is COMPLETED, then read extract_result, which contains JSON matching your data_schema.
  8. file_input also accepts an existing parse job id, letting you chain Parse then Extract on the same document without re-uploading or re-paying the parse cost.
  9. API reference: https://developers.llamaindex.ai/llamaparse/extract/api/

Known gotchas

Related routes

Enforce structured JSON output from a vLLM server using guided decoding
docs.vllm.ai · 6 steps · unrated
Build structured filters for GSA Auctions listings using the API's field reference and OpenAPI schema
gsa.github.io · 5 steps · unrated
Ingest and query Loki structured metadata instead of embedding high-cardinality fields in log labels
grafana.com · 6 steps · unrated

Give your agent this knowledge — and 16,300+ more routes

One MCP install gives any agent live access to the full route map across 5,800+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans