{"id":5767,"library":"firecrawl","title":"Firecrawl Python SDK","description":"The Firecrawl Python SDK provides a client for the Firecrawl API, enabling developers to scrape, crawl, and interact with web pages efficiently. It's designed for AI agents and data extraction tasks, supporting various formats and dynamic content. The current version is 4.22.1, and the library undergoes active development with frequent minor and patch releases.","status":"active","version":"4.22.1","language":"en","source_language":"en","source_url":"https://github.com/firecrawl/firecrawl","tags":["web scraping","web crawling","api client","ai agents","llm tools","data extraction","headless browser"],"install":[{"cmd":"pip install firecrawl","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Used for making HTTP requests to the Firecrawl API.","package":"requests","optional":false},{"reason":"Used for data validation and parsing API responses into Python objects.","package":"pydantic","optional":false}],"imports":[{"symbol":"FirecrawlApp","correct":"from firecrawl import FirecrawlApp"}],"quickstart":{"code":"import os\nfrom firecrawl import FirecrawlApp\n\n# Ensure you have your Firecrawl API key set as an environment variable\napi_key = os.environ.get('FIRECRAWL_API_KEY', '')\n\nif not api_key:\n    print(\"Error: FIRECRAWL_API_KEY environment variable not set.\")\n    print(\"Please set FIRECRAWL_API_KEY to your Firecrawl API key.\")\n    exit(1)\n\ntry:\n    app = FirecrawlApp(api_key=api_key)\n    \n    # Scrape a URL\n    url_to_scrape = \"https://www.firecrawl.ai/\"\n    print(f\"Scraping: {url_to_scrape}\")\n    scraped_data = app.scrape(url_to_scrape)\n    \n    print(\"Scrape successful!\")\n    # Access the content from the 'data' field, which is a list of results\n    if scraped_data and isinstance(scraped_data, dict) and 'data' in scraped_data and scraped_data['data']:\n        first_item = scraped_data['data'][0]\n        print(f\"Title: {first_item.get('metadata', {}).get('title', 'N/A')}\")\n        print(f\"Text content length: {len(first_item.get('content', ''))}\")\n    else:\n        print(\"No data found in scrape result.\")\n\n    # Example: Crawl a website (optional, might take longer and consume more credits)\n    # print(f\"\\nCrawling: {url_to_scrape} up to 1 page\")\n    # crawled_data = app.crawl(url_to_scrape, params={'limit': 1})\n    # if crawled_data and 'data' in crawled_data:\n    #     print(f\"Crawled {len(crawled_data['data'])} pages.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n","lang":"python","description":"Initialize the FirecrawlApp client with your API key and perform a basic scrape operation. The example includes error handling for missing API keys and demonstrates accessing the scraped content from the API response."},"warnings":[{"fix":"Uninstall the old package (`pip uninstall firecrawl-py`), then install the new one (`pip install firecrawl`). Update import statements from `from firecrawl_py import FirecrawlApp` to `from firecrawl import FirecrawlApp`.","message":"The library's package name changed from `firecrawl-py` to `firecrawl` with version 3.0.0. Projects using the older `firecrawl-py` will need to update their `pip install` command and import paths.","severity":"breaking","affected_versions":"3.0.0+"},{"fix":"Thoroughly review the official Firecrawl Python SDK documentation for versions 3.0.0 and above, paying close attention to specific API endpoint usage, parameter options, and the expected format of returned data.","message":"Version 3.0.0 introduced a complete rewrite of the SDK to align with the new Firecrawl API structure. This may lead to changes in method signatures, available parameters, and the structure of API responses, even for seemingly similar operations like `scrape` or `crawl`.","severity":"breaking","affected_versions":"3.0.0+"},{"fix":"Set the `FIRECRAWL_API_KEY` environment variable with your key, or pass it directly to the `FirecrawlApp` constructor: `FirecrawlApp(api_key=\"YOUR_KEY\")`. Obtain your API key from the Firecrawl dashboard.","message":"A valid Firecrawl API key is mandatory for all API calls. Requests made without a properly configured API key will result in authentication errors or failed operations.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Monitor your credit usage via the Firecrawl dashboard. Optimize your API calls by using parameters like `pageActions`, `limit`, `onlyMainContent`, `screenshot=False`, or specific extractors to minimize unnecessary processing and credit consumption.","message":"Firecrawl API usage consumes credits. Be aware of the unified billing model (implemented on the API side) where various operations, including scrapes, crawls, and interactions, deduct from your account credits.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}