Skip to content

LlamaParse documentation

Hosted APIs for getting data out of documents. Parse converts PDFs, scans and Office files to markdown or JSON; Extract returns JSON in your schema; Classify, Split and Index cover sorting, segmenting and retrieval. One API key, with SDKs for Python, TypeScript, Go and Java.

Your first result in under a minute

One API key, one SDK, five products. Get a key, install, run a sample.

Each is a separate API on the same key and SDK. Chain them (Split, then Extract) or use one on its own.

The samples run as written once LLAMA_CLOUD_API_KEY is set.

Examples

from llama_cloud import LlamaCloud
client = LlamaCloud() # Uses LLAMA_CLOUD_API_KEY env var
# Upload and parse a document
file = client.files.create(file="document.pdf", purpose="parse")
result = client.parsing.parse(
file_id=file.id,
tier="agentic",
version="latest",
expand=["markdown"],
)
# Get markdown output
print(result.markdown.pages[0].markdown)
import LlamaCloud from '@llamaindex/llama-cloud';
import fs from 'fs';
const client = new LlamaCloud(); // Uses LLAMA_CLOUD_API_KEY env var
// Upload and parse a document
const file = await client.files.create({
file: fs.createReadStream('document.pdf'),
purpose: 'parse',
});
const result = await client.parsing.parse({
file_id: file.id,
tier: 'agentic',
version: 'latest',
expand: ['markdown']
});
// Get markdown output
console.log(result.markdown.pages[0].markdown);
Terminal window
# Upload the document
curl -X POST \
https://api.cloud.llamaindex.ai/api/v1/beta/files \
-H 'Accept: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
-F 'purpose=parse' \
-F 'file=@/path/to/your/file.pdf;type=application/pdf'
# Start a Parse job with the returned file id
curl -X POST \
'https://api.cloud.llamaindex.ai/api/v2/parse' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
--data '{
"file_id": "<file_id>",
"tier": "agentic",
"version": "latest"
}'
# Fetch the markdown once the job completes
curl -X GET \
'https://api.cloud.llamaindex.ai/api/v2/parse/<job_id>?expand=markdown' \
-H 'Accept: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
from pydantic import BaseModel, Field
from llama_cloud import LlamaCloud
# Define your schema
class Resume(BaseModel):
name: str = Field(description="Full name of candidate")
email: str = Field(description="Email address")
skills: list[str] = Field(description="Technical skills")
client = LlamaCloud()
# Upload and extract
file = client.files.create(file="resume.pdf", purpose="extract")
job = client.extract.run(
file_input=file.id,
configuration={
"data_schema": Resume.model_json_schema(),
"tier": "agentic",
},
)
print(job.extract_result)
import LlamaCloud from '@llamaindex/llama-cloud';
import { z } from 'zod';
import fs from 'fs';
// Define your schema with Zod
const ResumeSchema = z.object({
name: z.string().describe('Full name of candidate'),
email: z.string().describe('Email address'),
skills: z.array(z.string()).describe('Technical skills'),
});
const client = new LlamaCloud();
// Upload and extract
const file = await client.files.create({
file: fs.createReadStream('resume.pdf'),
purpose: 'extract',
});
let job = await client.extract.run({
file_input: file.id,
configuration: {
data_schema: z.toJSONSchema(ResumeSchema),
tier: 'agentic',
},
});
console.log(job.extract_result);
Terminal window
# Upload the document
curl -X 'POST' \
'https://api.cloud.llamaindex.ai/api/v1/beta/files' \
-H 'Content-Type: multipart/form-data' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
-F 'file=@/path/to/file' \
-F purpose='extract'
# Run Extract with an inline JSON schema
curl -X 'POST' \
'https://api.cloud.llamaindex.ai/api/v2/extract?project_id={PROJECT_ID}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
-d '{
"file_input": "{FILE_ID}",
"configuration": {
"tier": "agentic",
"data_schema": {
"type": "object",
"properties": {
"name": { "type": "string", "description": "Full name of candidate" },
"email": { "type": "string", "description": "Email address" },
"skills": { "type": "array", "items": { "type": "string" }, "description": "Technical skills" }
}
}
}
}'
from llama_cloud import LlamaCloud
client = LlamaCloud()
# Upload a document
file = client.files.create(file="document.pdf", purpose="classify")
# Classify with natural language rules
result = client.classifier.classify(
file_ids=[file.id],
rules=[
{
"type": "invoice",
"description": "Documents with invoice numbers, line items, and totals"
},
{
"type": "receipt",
"description": "Short POS receipts with merchant and total"
},
{
"type": "contract",
"description": "Legal agreements with terms and signatures"
},
],
mode="FAST", # or "MULTIMODAL" for visual docs
)
for item in result.items:
print(f"Type: {item.result.type}, Confidence: {item.result.confidence}")
import LlamaCloud from '@llamaindex/llama-cloud';
import fs from 'fs';
const client = new LlamaCloud();
// Upload a document
const file = await client.files.create({
file: fs.createReadStream('document.pdf'),
purpose: 'classify',
});
// Classify with natural language rules
const result = await client.classifier.classify({
file_ids: [file.id],
rules: [
{
type: 'invoice',
description: 'Documents with invoice numbers, line items, and totals',
},
{
type: 'receipt',
description: 'Short POS receipts with merchant and total',
},
{
type: 'contract',
description: 'Legal agreements with terms and signatures',
},
],
mode: 'FAST', // or 'MULTIMODAL' for visual docs
});
for (const item of result.items) {
if (item.result) {
console.log(`Type: ${item.result.type}, Confidence: ${item.result.confidence}`);
}
}
import time
from llama_cloud import LlamaCloud
client = LlamaCloud()
# Upload a combined PDF
file = client.files.create(file="combined.pdf", purpose="split")
# Split into logical sections
job = client.beta.split.create(
document_input={"type": "file_id", "value": file.id},
configuration={
"categories": [
{
"name": "invoice",
"description": "Commercial document with line items and totals"
},
{
"name": "contract",
"description": "Legal agreement with terms and signatures"
},
]
},
)
# Poll until the job reaches a terminal state (Split statuses are lowercase)
result = client.beta.split.get(job.id)
while result.status in ("pending", "processing"):
time.sleep(2)
result = client.beta.split.get(job.id)
for segment in result.result.segments:
print(f"Pages {segment.pages}: {segment.category} ({segment.confidence_category})")
import LlamaCloud from '@llamaindex/llama-cloud';
import fs from 'fs';
const client = new LlamaCloud();
// Upload a combined PDF
const file = await client.files.create({
file: fs.createReadStream('combined.pdf'),
purpose: 'split',
});
// Split into logical sections
const job = await client.beta.split.create({
document_input: { type: 'file_id', value: file.id },
configuration: {
categories: [
{
name: 'invoice',
description: 'Commercial document with line items and totals',
},
{
name: 'contract',
description: 'Legal agreement with terms and signatures',
},
],
},
});
// Poll until the job reaches a terminal state (Split statuses are lowercase)
let result = await client.beta.split.get(job.id);
while (result.status === 'pending' || result.status === 'processing') {
await new Promise((resolve) => setTimeout(resolve, 2000));
result = await client.beta.split.get(job.id);
}
for (const segment of result.result.segments) {
console.log(`Pages ${segment.pages}: ${segment.category} (${segment.confidence_category})`);
}
Terminal window
# Upload the combined PDF
curl -X 'POST' \
'https://api.cloud.llamaindex.ai/api/v1/beta/files' \
-H 'accept: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
-F 'purpose=split' \
-F 'file=@/path/to/your/file.pdf;type=application/pdf'
# Start a Split job
curl -X 'POST' \
'https://api.cloud.llamaindex.ai/api/v1/beta/split/jobs' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY" \
-d '{
"document_input": { "type": "file_id", "value": "YOUR_FILE_ID" },
"configuration": {
"categories": [
{ "name": "invoice", "description": "Commercial document with line items and totals" },
{ "name": "contract", "description": "Legal agreement with terms and signatures" }
]
}
}'
# Poll the job until it completes
curl -X 'GET' \
'https://api.cloud.llamaindex.ai/api/v1/beta/split/jobs/YOUR_JOB_ID' \
-H 'accept: application/json' \
-H "Authorization: Bearer $LLAMA_CLOUD_API_KEY"
  • Quickstart: install the SDK in Python, TypeScript, Go, Java, or the CLI and run every product end to end.
  • API reference: every endpoint, request and response shape, across all SDKs.
  • Give your coding agent these docs: claude mcp add llama-index-docs --transport http https://developers.llamaindex.ai/mcp
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/for-agents/mcp/ - Other LlamaIndex tooling for agents — the LlamaParse Platform MCP server, agent skills and plugins, and the n8n node — is mapped at https://developers.llamaindex.ai/for-agents/