Skip to main content
The Firecrawl Python SDK provides a simple interface for scraping, crawling, and extracting structured data from websites. It automatically handles polling for async operations and provides both sync and async client options.

Installation

Install the SDK using pip:

Quick Start

Authentication

Get your API key from firecrawl.dev and set it as an environment variable or pass it directly:

Scraping

Basic Scrape

Scrape a single URL and get content in various formats:

Structured Data Extraction

Extract structured data using Pydantic models:

Extract with Prompt (No Schema)

Additional Formats

Crawling

Basic Crawl (Auto-Wait)

Crawl a website and automatically wait for completion:

Async Crawl (Manual Polling)

Start a crawl and poll manually:

Cancel a Crawl

Manual Pagination

For large crawls, manually paginate through results:

WebSocket Crawling

Watch crawl progress in real-time:

Agent

Use the AI agent to autonomously gather data from the web:

Agent with Schema

Agent with URLs

Focus the agent on specific pages:

Model Selection

Map

Generate a list of all URLs on a website:
Search the web and optionally scrape results:

Search with Content Scraping

Batch Scraping

Scrape multiple URLs in parallel:

Async Batch Scrape

Async Client

For async operations, use the AsyncFirecrawl class:

v1 Compatibility

Legacy v1 API is available under firecrawl.v1:

Error Handling

The SDK raises appropriate exceptions for API errors:

Configuration

Resources