LlamaParse documentation
LlamaParse is the document processing platform from LlamaIndex. 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.
Available document APIs
Section titled “Available document APIs”LlamaParse is the document processing platform from LlamaIndex. Each product is a separate API on the same key and SDK. Chain them (Split, then Extract) or use one on its own.
Parse
Agentic OCR for 130+ formats. PDFs, scans, tables, and charts to clean markdown, text, or JSON.
Extract
Pull typed, schema-shaped data out of documents, with citations back to the page.
Index
Managed ingestion, embedding, and retrieval for RAG over your document set.
Classify
Sort documents by type using natural-language rules, no training data needed.
Split
Break combined files into logical sections before you parse or extract.
Try it
Section titled “Try it”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 documentfile = client.files.create(file="document.pdf", purpose="parse")result = client.parsing.parse( file_id=file.id, tier="agentic", version="latest", expand=["markdown"],)
# Get markdown outputprint(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 documentconst 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 outputconsole.log(result.markdown.pages[0].markdown);# Upload the documentcurl -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 idcurl -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 completescurl -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, Fieldfrom llama_cloud import LlamaCloud
# Define your schemaclass 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 extractfile = 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 Zodconst 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 extractconst 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);# Upload the documentcurl -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 schemacurl -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 documentfile = client.files.create(file="document.pdf", purpose="classify")
# Classify with natural language rulesresult = 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 documentconst file = await client.files.create({ file: fs.createReadStream('document.pdf'), purpose: 'classify',});
// Classify with natural language rulesconst 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 PDFfile = client.files.create(file="combined.pdf", purpose="split")
# Split into logical sectionsjob = 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 PDFconst file = await client.files.create({ file: fs.createReadStream('combined.pdf'), purpose: 'split',});
// Split into logical sectionsconst 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})`);}# Upload the combined PDFcurl -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 jobcurl -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 completescurl -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"Next steps
Section titled “Next steps”- 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