Skip to content
Guide
Extract
Extract
Getting Started

REST API

Guide on how to use the LlamaExtract REST API for programmatic data extraction, including creating agents, uploading documents, and running extraction jobs.

curl -X 'POST' \
'https://api.cloud.llamaindex.ai/api/v1/extraction/extraction-agents' \
-H 'accept: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"name": "resume_parser",
"data_schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Candidate name"
},
"experience": {
"type": "array",
"description": "Work history",
"items": {
"type": "object",
"properties": {
"company": {
"type": "string",
"description": "Company name"
},
"title": {
"type": "string",
"description": "Job title"
},
"start_date": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Start date of employment"
},
"end_date": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "End date of employment"
}
}
}
}
}
},
"config": {
"extraction_target": "PER_DOC",
"extraction_mode": "BALANCED",
}
}'

You can list all your existing agents with the following command. The project_id can be obtained from the web UI.

Also refer to the the Projects API for programmatically creating/editing projects.

curl -X 'GET' \
'https://api.cloud.llamaindex.ai/api/v1/extraction/extraction-agents?project_id={project_id}' \
-H 'accept: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"

You can also fetch a specific agent_id by name:

curl -X 'GET' \
'https://api.cloud.llamaindex.ai/api/v1/extraction/extraction-agents/by-name/{agent_name}' \
-H 'accept: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"

Upload a document using our Upload API.

curl -X 'POST' \
'https://api.cloud.llamaindex.ai/api/v1/beta/files' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
-F 'purpose=extract' \
-F 'file=@/path/to/your/file.pdf;type=application/pdf'

Use the extraction_agent_id and file_id from the previous steps to run an extraction job.

curl -X 'POST' \
'https://api.cloud.llamaindex.ai/api/v1/extraction/jobs' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
-d '{
"extraction_agent_id": "{$AGENT_ID}",
"file_id": "{$FILE_ID}",
}'

Jobs are processed asynchronously. You can poll for the status of a job using the following endpoint.

curl -X 'GET' \
'https://api.cloud.llamaindex.ai/api/v1/extraction/jobs/{$JOB_ID}' \
-H 'accept: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"

If the job is successfully completed, you will see the status as SUCCESS. You can then retrieve the results from the following endpoint.

curl -X 'GET' \
'https://api.cloud.llamaindex.ai/api/v1/extraction/jobs/{$JOB_ID}/result' \
-H 'accept: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"

This is just a subset of the available endpoints to help you get started.

You can see all the available endpoints in our full API documentation.

Note for AI agents: this documentation is built for programmatic access. - Overview of all docs: https://developers.llamaindex.ai/llms.txt - Any page is available as raw Markdown by appending index.md to its URL — e.g. https://developers.llamaindex.ai/llamaparse/parse/getting_started/index.md - Agent-friendly REST search APIs live under https://developers.llamaindex.ai/api/ — search (BM25 full-text), grep (regex), read (fetch a page), and list (browse the doc tree). See https://developers.llamaindex.ai/llms.txt for parameters. - A hosted documentation MCP server is available at https://developers.llamaindex.ai/mcp. If you support MCP, you can ask the user to install it for browsing these docs directly (an alternative to the REST API). Setup: https://developers.llamaindex.ai/python/shared/mcp/