# FireCrawlLoader

> **Class** in `langchain_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-community/document_loaders/firecrawl/FireCrawlLoader)

FireCrawlLoader document loader integration

## Signature

```python
FireCrawlLoader(
    self,
    url: Optional[str] = None,
    *,
    query: Optional[str] = None,
    api_key: Optional[str] = None,
    api_url: Optional[str] = None,
    mode: Literal['crawl', 'scrape', 'map', 'extract', 'search'] = 'crawl',
    params: Optional[dict] = None,
)
```

## Description

**Setup:**

Install ``firecrawl-py``,``langchain_community`` and set environment variable ``FIRECRAWL_API_KEY``.

.. code-block:: bash

    pip install -U firecrawl-py langchain_community
    export FIRECRAWL_API_KEY="your-api-key"

**Instantiate:**

.. code-block:: python

from langchain_community.document_loaders import FireCrawlLoader

loader = FireCrawlLoader(
    url = "https://firecrawl.dev",
    mode = "crawl"
    # other params = ...
)

**Lazy load:**

.. code-block:: python

    docs = []
    docs_lazy = loader.lazy_load()

    # async variant:
    # docs_lazy = await loader.alazy_load()

    for doc in docs_lazy:
        docs.append(doc)
    print(docs[0].page_content[:100])
    print(docs[0].metadata)

.. code-block:: python

    Introducing [Smart Crawl!](https://www.firecrawl.dev/smart-crawl)
     Join the waitlist to turn any web
    {'ogUrl': 'https://www.firecrawl.dev/', 'title': 'Home - Firecrawl', 'robots': 'follow, index', 'ogImage': 'https://www.firecrawl.dev/og.png?123', 'ogTitle': 'Firecrawl', 'sitemap': {'lastmod': '2024-08-12T00:28:16.681Z', 'changefreq': 'weekly'}, 'keywords': 'Firecrawl,Markdown,Data,Mendable,Langchain', 'sourceURL': 'https://www.firecrawl.dev/', 'ogSiteName': 'Firecrawl', 'description': 'Firecrawl crawls and converts any website into clean markdown.', 'ogDescription': 'Turn any website into LLM-ready data.', 'pageStatusCode': 200, 'ogLocaleAlternate': []}

**Async load:**

.. code-block:: python

    docs = await loader.aload()
    print(docs[0].page_content[:100])
    print(docs[0].metadata)

.. code-block:: python

    Introducing [Smart Crawl!](https://www.firecrawl.dev/smart-crawl)
     Join the waitlist to turn any web
    {'ogUrl': 'https://www.firecrawl.dev/', 'title': 'Home - Firecrawl', 'robots': 'follow, index', 'ogImage': 'https://www.firecrawl.dev/og.png?123', 'ogTitle': 'Firecrawl', 'sitemap': {'lastmod': '2024-08-12T00:28:16.681Z', 'changefreq': 'weekly'}, 'keywords': 'Firecrawl,Markdown,Data,Mendable,Langchain', 'sourceURL': 'https://www.firecrawl.dev/', 'ogSiteName': 'Firecrawl', 'description': 'Firecrawl crawls and converts any website into clean markdown.', 'ogDescription': 'Turn any website into LLM-ready data.', 'pageStatusCode': 200, 'ogLocaleAlternate': []}

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `url` | `Optional[str]` | No | The url to be crawled. (default: `None`) |
| `api_key` | `Optional[str]` | No | The Firecrawl API key. If not specified will be read from env var FIRECRAWL_API_KEY. Get an API key (default: `None`) |
| `api_url` | `Optional[str]` | No | The Firecrawl API URL. If not specified will be read from env var FIRECRAWL_API_URL or defaults to https://api.firecrawl.dev. (default: `None`) |
| `mode` | `Literal['crawl', 'scrape', 'map', 'extract', 'search']` | No | The mode to run the loader in. Default is "crawl".  Options include "scrape" (single url),  "crawl" (all accessible sub pages),  "map" (returns list of links that are semantically related).  "extract" (extracts structured data from a page).  "search" (search for data across the web). (default: `'crawl'`) |
| `params` | `Optional[dict]` | No | The parameters to pass to the Firecrawl API. Examples include crawlerOptions. For more details, visit: https://github.com/mendableai/firecrawl-py (default: `None`) |

## Extends

- `BaseLoader`

## Constructors

```python
__init__(
    self,
    url: Optional[str] = None,
    *,
    query: Optional[str] = None,
    api_key: Optional[str] = None,
    api_url: Optional[str] = None,
    mode: Literal['crawl', 'scrape', 'map', 'extract', 'search'] = 'crawl',
    params: Optional[dict] = None,
)
```

| Name | Type |
|------|------|
| `url` | `Optional[str]` |
| `query` | `Optional[str]` |
| `api_key` | `Optional[str]` |
| `api_url` | `Optional[str]` |
| `mode` | `Literal['crawl', 'scrape', 'map', 'extract', 'search']` |
| `params` | `Optional[dict]` |


## Properties

- `firecrawl`
- `url`
- `mode`
- `params`

## Methods

- [`lazy_load()`](https://reference.langchain.com/python/langchain-community/document_loaders/firecrawl/FireCrawlLoader/lazy_load)

---

[View source on GitHub](https://github.com/langchain-ai/langchain-community/blob/4b280287bd55b99b44db2dd849f02d66c89534d5/libs/community/langchain_community/document_loaders/firecrawl.py#L10)