Skip to main content

Prerequisites

Install the SDK

pip install firecrawl-py

Search the web

from firecrawl import Firecrawl

app = Firecrawl(api_key="fc-YOUR-API-KEY")
results = app.search("firecrawl web scraping", limit=5)

for result in results.web:
    print(result.title, result.url)

Scrape a page

result = app.scrape("https://example.com")
print(result.markdown)
{
  "markdown": "# Example Domain\n\nThis domain is for use in illustrative examples...",
  "metadata": {
    "title": "Example Domain",
    "sourceURL": "https://example.com"
  }
}

Interact with a page

Use Interact to control a live browser session — click buttons, fill forms, and extract dynamic content.
result = app.scrape("https://www.amazon.com", formats=["markdown"])
scrape_id = result.metadata.scrape_id

app.interact(scrape_id, prompt="Search for iPhone 16 Pro Max")
response = app.interact(scrape_id, prompt="Click on the first result and tell me the price")
print(response.output)

app.stop_interaction(scrape_id)

Environment variable

Instead of passing api_key directly, set the FIRECRAWL_API_KEY environment variable:
export FIRECRAWL_API_KEY=fc-YOUR-API-KEY
app = Firecrawl()

Next steps

Scrape docs

All scrape options including formats, actions, and proxies

Search docs

Search the web and get full page content

Interact docs

Click, fill forms, and extract dynamic content

Python SDK reference

Full SDK reference with crawl, map, async, and more