firecrawl-py 4.5.0


pip install firecrawl-py

  Latest version

Released: Oct 17, 2025


Meta
Author: Mendable.ai
Maintainer: Mendable.ai
Requires Python: >=3.8

Classifiers

Development Status
  • 5 - Production/Stable

Environment
  • Web Environment

Intended Audience
  • Developers

License
  • OSI Approved :: MIT License

Natural Language
  • English

Operating System
  • OS Independent

Programming Language
  • Python
  • Python :: 3
  • Python :: 3.8
  • Python :: 3.9
  • Python :: 3.10

Topic
  • Internet
  • Internet :: WWW/HTTP
  • Internet :: WWW/HTTP :: Indexing/Search
  • Software Development
  • Software Development :: Libraries
  • Software Development :: Libraries :: Python Modules
  • Text Processing
  • Text Processing :: Indexing

Firecrawl Python SDK

The Firecrawl Python SDK is a library that allows you to easily scrape and crawl websites, and output the data in a format ready for use with language models (LLMs). It provides a simple and intuitive interface for interacting with the Firecrawl API.

Installation

To install the Firecrawl Python SDK, you can use pip:

pip install firecrawl-py

Usage

  1. Get an API key from firecrawl.dev
  2. Set the API key as an environment variable named FIRECRAWL_API_KEY or pass it as a parameter to the Firecrawl class.

Here's an example of how to use the SDK:

from firecrawl import Firecrawl
from firecrawl.types import ScrapeOptions

firecrawl = Firecrawl(api_key="fc-YOUR_API_KEY")

# Scrape a website (v2):
data = firecrawl.scrape(
  'https://firecrawl.dev', 
  formats=['markdown', 'html']
)
print(data)

# Crawl a website (v2 waiter):
crawl_status = firecrawl.crawl(
  'https://firecrawl.dev', 
  limit=100, 
  scrape_options=ScrapeOptions(formats=['markdown', 'html'])
)
print(crawl_status)

Scraping a URL

To scrape a single URL, use the scrape method. It takes the URL as a parameter and returns a document with the requested formats.

# Scrape a website (v2):
scrape_result = firecrawl.scrape('https://firecrawl.dev', formats=['markdown', 'html'])
print(scrape_result)

Crawling a Website

To crawl a website, use the crawl method. It takes the starting URL and optional parameters as arguments. You can control depth, limits, formats, and more.

crawl_status = firecrawl.crawl(
  'https://firecrawl.dev', 
  limit=100, 
  scrape_options=ScrapeOptions(formats=['markdown', 'html']),
  poll_interval=30
)
print(crawl_status)

Asynchronous Crawling

Looking for async operations? Check out the Async Class section below.

To enqueue a crawl asynchronously, use start_crawl. It returns the crawl ID which you can use to check the status of the crawl job.

crawl_job = firecrawl.start_crawl(
  'https://firecrawl.dev', 
  limit=100, 
  scrape_options=ScrapeOptions(formats=['markdown', 'html']),
)
print(crawl_job)

Checking Crawl Status

To check the status of a crawl job, use the get_crawl_status method. It takes the job ID as a parameter and returns the current status of the crawl job.

crawl_status = firecrawl.get_crawl_status("<crawl_id>")
print(crawl_status)

Cancelling a Crawl

To cancel an asynchronous crawl job, use the cancel_crawl method. It takes the job ID of the asynchronous crawl as a parameter and returns the cancellation status.

cancel_crawl = firecrawl.cancel_crawl(id)
print(cancel_crawl)

Map a Website

Use map to generate a list of URLs from a website. Options let you customize the mapping process, including whether to use the sitemap or include subdomains.

# Map a website (v2):
map_result = firecrawl.map('https://firecrawl.dev')
print(map_result)

{/* ### Extracting Structured Data from Websites

To extract structured data from websites, use the extract method. It takes the URLs to extract data from, a prompt, and a schema as arguments. The schema is a Pydantic model that defines the structure of the extracted data.

*/}

Crawling a Website with WebSockets

To crawl a website with WebSockets, use the crawl_url_and_watch method. It takes the starting URL and optional parameters as arguments. The params argument allows you to specify additional options for the crawl job, such as the maximum number of pages to crawl, allowed domains, and the output format.

# inside an async function...
nest_asyncio.apply()

# Define event handlers
def on_document(detail):
    print("DOC", detail)

def on_error(detail):
    print("ERR", detail['error'])

def on_done(detail):
    print("DONE", detail['status'])

    # Function to start the crawl and watch process
async def start_crawl_and_watch():
    # Initiate the crawl job and get the watcher
    watcher = app.crawl_url_and_watch('firecrawl.dev', exclude_paths=['blog/*'], limit=5)

    # Add event listeners
    watcher.add_event_listener("document", on_document)
    watcher.add_event_listener("error", on_error)
    watcher.add_event_listener("done", on_done)

    # Start the watcher
    await watcher.connect()

# Run the event loop
await start_crawl_and_watch()

Error Handling

The SDK handles errors returned by the Firecrawl API and raises appropriate exceptions. If an error occurs during a request, an exception will be raised with a descriptive error message.

Async Class

For async operations, you can use the AsyncFirecrawl class. Its methods mirror the Firecrawl class, but you await them.

from firecrawl import AsyncFirecrawl

firecrawl = AsyncFirecrawl(api_key="YOUR_API_KEY")

# Async Scrape (v2)
async def example_scrape():
  scrape_result = await firecrawl.scrape(url="https://example.com")
  print(scrape_result)

# Async Crawl (v2)
async def example_crawl():
  crawl_result = await firecrawl.crawl(url="https://example.com")
  print(crawl_result)

v1 compatibility

For legacy code paths, v1 remains available under firecrawl.v1 with the original method names.

from firecrawl import Firecrawl

firecrawl = Firecrawl(api_key="YOUR_API_KEY")

# v1 methods (feature‑frozen)
doc_v1 = firecrawl.v1.scrape_url('https://firecrawl.dev', formats=['markdown', 'html'])
crawl_v1 = firecrawl.v1.crawl_url('https://firecrawl.dev', limit=100)
map_v1 = firecrawl.v1.map_url('https://firecrawl.dev')
4.5.0 Oct 17, 2025
4.4.0 Oct 13, 2025
4.3.7 Oct 10, 2025
4.3.6 Sep 07, 2025
4.3.5 Sep 05, 2025
4.3.4 Sep 05, 2025
4.3.3 Sep 03, 2025
4.3.2 Sep 03, 2025
4.3.1 Sep 01, 2025
4.3.0 Sep 01, 2025
4.2.0 Sep 01, 2025
4.1.1 Aug 30, 2025
4.1.0 Aug 30, 2025
4.0.0 Aug 29, 2025
3.4.0 Aug 27, 2025
3.3.3 Aug 27, 2025
3.3.2 Aug 23, 2025
3.3.1 Aug 23, 2025
3.3.0 Aug 23, 2025
3.2.1 Aug 22, 2025
3.2.0 Aug 22, 2025
3.1.1 Aug 22, 2025
3.1.0 Aug 21, 2025
3.0.3 Aug 19, 2025
3.0.2 Aug 19, 2025
2.16.5 Aug 06, 2025
2.16.3 Jul 29, 2025
2.16.2 Jul 22, 2025
2.16.1 Jul 15, 2025
2.16.0 Jul 14, 2025
2.15.0 Jul 04, 2025
2.14.0 Jul 02, 2025
2.13.0 Jul 01, 2025
2.12.0 Jun 27, 2025
2.11.0 Jun 27, 2025
2.10.0 Jun 26, 2025
2.9.0 Jun 20, 2025
2.8.0 Jun 06, 2025
2.7.1 May 28, 2025
2.7.0 May 20, 2025
2.6.0 May 16, 2025
2.5.4 May 08, 2025
2.5.3 Apr 29, 2025
2.5.2 Apr 29, 2025
2.5.1 Apr 29, 2025
2.5.0 Apr 29, 2025
2.4.3 Apr 28, 2025
2.4.2 Apr 28, 2025
2.4.1 Apr 28, 2025
2.4.0 Apr 26, 2025
2.3.0 Apr 24, 2025
2.2.0 Apr 22, 2025
2.1.2 Apr 19, 2025
2.1.1 Apr 18, 2025
2.1.0 Apr 18, 2025
2.0.2 Apr 18, 2025
2.0.1 Apr 18, 2025
2.0.0 Apr 18, 2025
1.17.0 Apr 17, 2025
1.16.0 Apr 12, 2025
1.15.0 Mar 24, 2025
1.14.1 Mar 17, 2025
1.14.0 Mar 17, 2025
1.13.5 Mar 05, 2025
1.13.4 Mar 05, 2025
1.13.3 Mar 05, 2025
1.13.2 Mar 02, 2025
1.13.1 Mar 02, 2025
1.13.0 Mar 02, 2025
1.12.0 Feb 13, 2025
1.11.1 Feb 06, 2025
1.11.0 Jan 31, 2025
1.10.2 Jan 21, 2025
1.10.1 Jan 20, 2025
1.10.0 Jan 18, 2025
1.9.0 Jan 07, 2025
1.8.0 Jan 02, 2025
1.7.1 Jan 02, 2025
1.7.0 Dec 27, 2024
1.6.8 Dec 19, 2024
1.6.7 Dec 19, 2024
1.6.4 Dec 12, 2024
1.6.3 Dec 04, 2024
1.6.2 Dec 03, 2024
1.6.1 Nov 26, 2024
1.6.0 Nov 26, 2024
1.5.0 Nov 11, 2024
1.4.0 Oct 23, 2024
1.3.1 Oct 13, 2024
1.3.0 Oct 10, 2024
1.2.4 Sep 17, 2024
1.2.3 Sep 04, 2024
1.2.2 Sep 03, 2024
1.2.1 Aug 31, 2024
1.2.0 Aug 31, 2024
1.1.1 Aug 30, 2024
1.1.0 Aug 30, 2024
1.0.1 Aug 28, 2024
1.0.0 Aug 28, 2024
0.0.20 Jul 01, 2024
0.0.18 Jul 01, 2024
0.0.17 Jul 01, 2024
0.0.16 Jun 14, 2024
0.0.14 Jun 07, 2024
0.0.13 Jun 06, 2024
0.0.12 May 31, 2024
0.0.11 May 27, 2024
0.0.10 May 27, 2024
0.0.9 May 20, 2024
0.0.8 May 09, 2024
0.0.7 May 09, 2024
0.0.6 Apr 25, 2024
0.0.5 Apr 12, 2024
0.0.4 Apr 12, 2024
0.0.3 Apr 12, 2024
0.0.2 Apr 12, 2024
0.0.1 Apr 12, 2024

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras: None
Dependencies:
requests
httpx
python-dotenv
websockets
nest-asyncio
pydantic (>=2.0)
aiohttp