Appearance
Document Parsing
Updated Feb 2026Firecrawl automatically detects and converts documents (PDF, DOCX, XLSX) into clean, structured markdown. Just pass a document URL to the scrape endpoint.
Direct File Upload
For local files not accessible by URL, use the dedicated Parse endpoint — it accepts file uploads directly via multipart/form-data and is up to 5x faster.
Supported Formats
| Format | Extensions | Output |
|---|---|---|
.pdf | Extracted text with layout preservation; OCR for scanned docs | |
| Word | .docx, .doc, .odt, .rtf | Headings, paragraphs, lists, tables preserved |
| Excel | .xlsx, .xls | Worksheets as HTML tables, sheet names as H2 headings |
How It Works
Document parsing is built into the standard scrape endpoint. Firecrawl detects the file type via URL extension or content-type header and automatically processes it.
Basic Usage
Python
python
from firecrawl import Firecrawl
firecrawl = Firecrawl(api_key="fc-YOUR-API-KEY")
# PDF document
result = firecrawl.scrape("https://example.com/report.pdf")
print(result['markdown'])
# Word document
result = firecrawl.scrape("https://example.com/proposal.docx")
print(result['markdown'])
# Excel spreadsheet
result = firecrawl.scrape("https://example.com/data.xlsx")
print(result['markdown'])Node.js
javascript
import Firecrawl from '@mendable/firecrawl-js';
const firecrawl = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });
// PDF document
const doc = await firecrawl.scrape("https://example.com/report.pdf", {
formats: ["markdown"]
});
console.log(doc.markdown);
// Word document
const wordDoc = await firecrawl.scrape("https://example.com/proposal.docx", {
formats: ["markdown"]
});
console.log(wordDoc.markdown);
// Excel spreadsheet
const excelDoc = await firecrawl.scrape("https://example.com/data.xlsx", {
formats: ["markdown"]
});
console.log(excelDoc.markdown);cURL
bash
curl -X POST https://api.firecrawl.dev/v2/scrape \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer fc-YOUR-API-KEY' \
-d '{
"url": "https://example.com/report.pdf",
"formats": ["markdown"]
}'PDF Parsing Modes
Control how PDFs are processed using the parsers option:
| Mode | Description | Speed | Use When |
|---|---|---|---|
auto | Attempts fast text extraction first, falls back to OCR if needed | Fast (with fallback) | Default -- works for most PDFs |
fast | Text-only extraction, skips scanned/image-heavy pages | Fastest | Digital-native PDFs with selectable text |
ocr | Forces OCR on every page | Slowest | Scanned documents, image-heavy PDFs |
Configuring PDF Parsers
python
# Auto mode (default)
result = firecrawl.scrape(
"https://example.com/report.pdf",
formats=["markdown"]
)
# Force OCR for a scanned document
result = firecrawl.scrape(
"https://example.com/scanned-contract.pdf",
formats=["markdown"],
parsers=[{"type": "pdf", "mode": "ocr"}]
)
# Fast mode for text-based PDFs
result = firecrawl.scrape(
"https://example.com/digital-report.pdf",
formats=["markdown"],
parsers=[{"type": "pdf", "mode": "fast"}]
)
# Limit page count
result = firecrawl.scrape(
"https://example.com/long-report.pdf",
formats=["markdown"],
parsers=[{"type": "pdf", "mode": "auto", "maxPages": 20}]
)javascript
// Force OCR
const doc = await firecrawl.scrape("https://example.com/scanned.pdf", {
formats: ["markdown"],
parsers: [{ type: "pdf", mode: "ocr" }]
});
// Fast mode with page limit
const doc = await firecrawl.scrape("https://example.com/report.pdf", {
formats: ["markdown"],
parsers: [{ type: "pdf", mode: "fast", maxPages: 50 }]
});bash
curl -X POST https://api.firecrawl.dev/v2/scrape \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer fc-YOUR-API-KEY' \
-d '{
"url": "https://example.com/scanned.pdf",
"formats": ["markdown"],
"parsers": [{"type": "pdf", "mode": "ocr", "maxPages": 20}]
}'Parser Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
type | string | Required | Document type ("pdf") |
mode | string | "auto" | Parsing mode: auto, fast, ocr |
maxPages | number | -- | Maximum pages to process |
Word Document Output
Word documents preserve their structural elements:
| Source Element | Markdown Output |
|---|---|
| Headings | #, ##, ### (matching level) |
| Paragraphs | Standard text blocks |
| Bulleted lists | - Item |
| Numbered lists | 1. Item |
| Tables | Markdown tables |
| Bold/italic | **bold** / *italic* |
Example Output
markdown
# Quarterly Report Q4 2025
## Executive Summary
Revenue increased **15%** year-over-year, driven by:
- New enterprise contracts
- Expansion in APAC region
- Product line additions
## Financial Details
| Metric | Q3 2025 | Q4 2025 | Change |
|--------|---------|---------|--------|
| Revenue | $12.5M | $14.4M | +15% |
| Users | 50,000 | 62,000 | +24% |Excel Document Output
Each worksheet becomes a section with the sheet name as a heading:
Example Output
markdown
## Sheet: Revenue Data
| Month | Revenue | Growth |
|-------|---------|--------|
| January | $1.2M | 5% |
| February | $1.3M | 8% |
| March | $1.5M | 15% |
## Sheet: User Metrics
| Month | Active Users | Churn |
|-------|-------------|-------|
| January | 45,000 | 2.1% |
| February | 48,000 | 1.8% |JSON Extraction from Documents
Combine document parsing with JSON extraction to pull structured data from documents:
python
from pydantic import BaseModel
from typing import List
class InvoiceItem(BaseModel):
description: str
quantity: int
unit_price: float
total: float
class Invoice(BaseModel):
invoice_number: str
date: str
vendor: str
items: List[InvoiceItem]
grand_total: float
result = firecrawl.scrape(
"https://example.com/invoice.pdf",
formats=[{
"type": "json",
"schema": Invoice.model_json_schema()
}],
parsers=[{"type": "pdf", "mode": "ocr"}]
)
invoice = result['json']
print(f"Invoice #{invoice['invoice_number']}: ${invoice['grand_total']}")LlamaParse Integration
For advanced PDF parsing (complex tables, charts, multi-column layouts), configure LlamaParse in self-hosted deployments:
bash
# In .env
LLAMAPARSE_API_KEY=your-llamaparse-keyLlamaParse provides enhanced accuracy for:
- Complex multi-column layouts
- Tables with merged cells
- Charts and diagrams (text extraction)
- Academic papers with equations
Cost
| Operation | Credits |
|---|---|
| Document scrape (base) | 1 per page of content |
| PDF parsing | +1 per PDF page |
| JSON extraction from document | +4 per page |
Cost Examples
| Scenario | Credits |
|---|---|
| 10-page PDF, markdown only | 11 (1 base + 10 PDF pages) |
| 10-page PDF with JSON extraction | 15 (1 base + 10 PDF pages + 4 JSON) |
| Word document (any length) | 1 |
| Excel spreadsheet (any size) | 1 |
Related Pages
- Scrape -- All scrape formats and options
- LLM Extract -- Schema-based extraction details
- Batch Scrape -- Process multiple documents at once
- Pricing -- Full credit cost breakdown
Next: Enhanced Mode -->