Python
Get started with Firecrawl in Python. Scrape, search, and interact with web data using the official SDK.
Prerequisites
- Python 3.8+
- A Firecrawl API key — get one free
Install the SDK
pip install firecrawl-pySearch 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)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-KEYapp = Firecrawl()Next steps
Was this page helpful?Suggest editsRaise issue