If you have ever tried to feed a website into an LLM, you know the pain. You write a scraper, it breaks on JavaScript-rendered pages, you add a headless browser, you fight rate limits and cookie banners, and then you still have to strip out navigation bars, footers, and ads before the content is usable.
Firecrawl is an open source project that packages all of that into a single API. You give it a URL (or just a question), and you get back clean Markdown, HTML, or structured JSON that you can drop straight into a prompt, a vector database, or an agent.
This guide covers what Firecrawl does, the endpoints you will actually use, working code in Python, Node.js, and cURL, and the things worth knowing before you put it into production.
What Firecrawl Is
Firecrawl describes itself as knowledge infrastructure for AI agents. In practice it does three things:
- Fetches web content reliably, including JavaScript-heavy pages.
- Cleans it up into LLM-friendly output, with Markdown as the primary format.
- Structures it when you ask, by extracting JSON that matches a schema you define.
It is one of the most popular open source projects in this space, with roughly 200k stars on GitHub at the time of writing.
Three Ways to Run It
This is the first decision you need to make, so it is worth getting clear on upfront.
| Option | What it is | Best for |
|---|---|---|
| Firecrawl Cloud | The hosted API at firecrawl.dev | Getting started fast, full feature set |
| Firecrawl Local | A single binary that serves the v2 API on localhost:3002 and also works as an MCP server |
Local development, agents on your machine |
| Self-hosted | The full server from apps/api, with its own queues, workers, and databases |
Teams that need to own the infrastructure |
One important detail: not every feature is available everywhere. Locally, scraping returns Markdown, HTML, raw HTML, and links. Structured JSON, summaries, screenshots, and browser actions are Cloud features. Check this against your requirements before you commit to a deployment model.
The Core Endpoints
Here is the mental model. Each endpoint answers a different question.
| Endpoint | Question it answers |
|---|---|
| Scrape | "Give me the content of this one page." |
| Crawl | "Give me the content of this whole site." |
| Map | "What URLs exist on this site?" |
| Batch Scrape | "Give me the content of these 500 URLs." |
| Search | "Search the web and give me the full content of the results." |
| Interact | "Click, type, or navigate on a page I already scraped." |
| Agent | "Find this information. I do not know which URLs have it." |
| Parse | "Convert this PDF, DOCX, or XLSX into Markdown or JSON." |
The Cloud API base URL is https://api.firecrawl.dev/v2.
Installation
Official SDKs exist for most languages:
# Python
pip install firecrawl
# Node.js
npm install firecrawl
# Go
go get github.com/firecrawl/firecrawl/apps/go-sdk
# Rust
cargo add firecrawl
# Ruby
gem install firecrawl-sdk
# .NET
dotnet add package firecrawl-sdk
# PHP
composer require firecrawl/firecrawl-sdk
There are also SDKs for Java (com.firecrawl:firecrawl-java on Maven Central) and Elixir.
You will want an API key from firecrawl.dev for real workloads. Keys start with fc-. Store it in an environment variable rather than hardcoding it:
export FIRECRAWL_API_KEY="fc-YOUR_API_KEY"
Your First Scrape
Python
from firecrawl import Firecrawl
firecrawl = Firecrawl(api_key="fc-YOUR_API_KEY")
doc = firecrawl.scrape(
"https://firecrawl.dev",
formats=["markdown", "html"],
)
print(doc.markdown)
Node.js
import { Firecrawl } from 'firecrawl';
const firecrawl = new Firecrawl({ apiKey: process.env.FIRECRAWL_API_KEY });
const doc = await firecrawl.scrape('https://firecrawl.dev', {
formats: ['markdown', 'html'],
});
console.log(doc.markdown);
cURL
curl -X POST 'https://api.firecrawl.dev/v2/scrape' \
-H "Authorization: Bearer $FIRECRAWL_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"url": "https://firecrawl.dev",
"formats": ["markdown", "html"]
}'
Every response also includes metadata such as title, description, sourceURL, statusCode, and contentType, which is useful for logging and for citing sources in RAG pipelines.
Output formats
The formats parameter controls what you get back. The most useful ones are:
-
markdownfor feeding content to an LLM -
htmlandrawHtmlwhen you need the markup -
linksto get every link on the page -
screenshotfor a visual capture -
summaryfor a short summary of the page -
jsonfor structured extraction (covered next)
Structured Extraction with JSON
This is where Firecrawl saves the most code. Instead of writing CSS selectors that break the next time a site redesigns, you describe the data you want and let the model pull it out.
Pass a json object inside formats, with a JSON Schema, a prompt, or both:
from firecrawl import Firecrawl
firecrawl = Firecrawl(api_key="fc-YOUR_API_KEY")
schema = {
"type": "object",
"properties": {
"company_mission": {"type": "string"},
"is_open_source": {"type": "boolean"},
},
"required": ["company_mission"],
}
doc = firecrawl.scrape(
"https://firecrawl.dev",
formats=[{
"type": "json",
"schema": schema,
"prompt": "Extract the company mission and whether the product is open source.",
}],
)
print(doc.json)
If you skip the schema and only send a prompt, the model decides the output structure. That is handy for exploration, but use a schema in production so your downstream code gets a predictable shape.
The raw request body looks like this:
{
"url": "https://firecrawl.dev",
"formats": [{
"type": "json",
"schema": {
"type": "object",
"properties": { "company_mission": { "type": "string" } },
"required": ["company_mission"]
},
"prompt": "Extract the company mission from the page."
}]
}
Crawling an Entire Site
Crawl follows links recursively and scrapes every page it finds. Always set a limit, or a large site will burn through your credits.
Python
job = firecrawl.crawl(
url="https://docs.firecrawl.dev",
limit=10,
poll_interval=1,
timeout=120,
scrape_options={"formats": ["markdown"]},
)
for page in job.data:
print(page.metadata.source_url)
Node.js
const job = await firecrawl.crawl('https://docs.firecrawl.dev', {
limit: 10,
scrapeOptions: { formats: ['markdown'] },
});
console.log(job.data.length);
The crawl() method waits for the job to finish. For large sites, you do not want to block a request handler while that happens. Start the job and check on it separately:
job = firecrawl.start_crawl(url="https://docs.firecrawl.dev", limit=100)
# Later, from a worker, cron job, or webhook handler
status = firecrawl.get_crawl_status(job.id)
print(status.status)
Firecrawl also supports webhooks for asynchronous event delivery, which is the cleaner option once you are running crawls at scale.
Mapping a Site Before You Crawl
Map returns a list of URLs on a site without scraping them. It is fast and cheap, which makes it a good first step: map the site, filter the URLs you actually care about, then batch scrape only those.
result = firecrawl.map(url="https://firecrawl.dev", limit=50)
print(result)
Batch Scraping
When you already have a list of URLs, batch scrape processes them in one job:
urls = [
"https://firecrawl.dev",
"https://docs.firecrawl.dev",
]
batch_job = firecrawl.start_batch_scrape(urls)
status = firecrawl.get_batch_scrape_status(batch_job.id)
print(status)
The map-then-batch pattern usually gives you more control and lower cost than a blind crawl.
Search: Web Search with Full Content
Most search APIs return titles and snippets. Firecrawl's search returns the full page content of the results, which is exactly what you need for grounding an LLM answer.
results = firecrawl.search(query="firecrawl", limit=3)
print(results)
const results = await firecrawl.search('firecrawl', {
limit: 3,
scrapeOptions: { formats: ['markdown'] },
});
Interacting with Pages
Some content only appears after you click a button, fill in a search box, or log in. Firecrawl has two ways to handle that.
Actions (run before scraping)
Actions are a list of steps that run in the browser before the page is captured:
doc = firecrawl.scrape(
"https://example.com",
formats=["markdown"],
actions=[
{"type": "wait", "milliseconds": 1000},
{"type": "click", "selector": "a[href='/pricing']"},
{"type": "wait", "milliseconds": 1500},
{"type": "screenshot", "fullPage": True},
],
)
Supported action types include wait, click, write, press, and screenshot. Add wait steps between actions so the page has time to load.
Interact (continue working on a scraped page)
Interact is the newer approach, and the docs recommend it over actions for new work. You scrape a page, then send follow-up instructions in plain English:
result = firecrawl.scrape("https://www.amazon.com", formats=["markdown"])
scrape_id = result.metadata.scrape_id
firecrawl.interact(scrape_id, prompt="Search for iPhone 16 Pro Max")
response = firecrawl.interact(
scrape_id,
prompt="Click on the first result and tell me the price",
)
firecrawl.stop_interaction(scrape_id)
Remember to call stop_interaction when you are done, so the browser session is released.
Agent: When You Do Not Know the URL
Every endpoint above needs you to know where the data lives. Agent does not. You describe what you want, optionally provide a schema, and it searches, navigates, and extracts on its own.
from typing import List, Optional
from pydantic import BaseModel, Field
from firecrawl import Firecrawl
firecrawl = Firecrawl(api_key="fc-YOUR_API_KEY")
class Founder(BaseModel):
name: str = Field(description="Full name of the founder")
role: Optional[str] = Field(None, description="Role or position")
class FoundersSchema(BaseModel):
founders: List[Founder] = Field(description="List of founders")
result = firecrawl.agent(
prompt="Find the founders of Firecrawl",
schema=FoundersSchema,
model="spark-2",
max_credits=100,
)
print(result.data)
Two things to note:
-
Set
max_credits. An autonomous agent can visit many pages. A cap keeps a vague prompt from turning into a surprise bill. -
Use
start_agentandget_agent_statusfor long-running jobs, the same way you would with crawls.
Parsing Documents
Not everything is a web page. Firecrawl can convert PDFs, DOCX, XLSX, HTML, and similar files into Markdown or structured JSON. If your RAG pipeline ingests both websites and uploaded documents, this lets you use one tool for both instead of maintaining a separate PDF parser.
Using Firecrawl with AI Agents and MCP
If you use an AI coding assistant, you can give it web access through Firecrawl's MCP server.
Run it locally with your API key:
env FIRECRAWL_API_KEY=fc-YOUR_API_KEY npx -y firecrawl-mcp
Or point your client at the hosted endpoint, which uses Streamable HTTP:
https://mcp.firecrawl.dev/v2/mcp
There is also a CLI that can install Firecrawl tools into supported agents such as Claude Code, Antigravity, and OpenCode:
npx -y firecrawl-cli@latest init --all --browser
If you are using Firecrawl Local, firecrawl-local init registers it as an MCP server in Claude Code, Claude Desktop, Cursor, Windsurf, Gemini CLI, and Codex.
Firecrawl also has integrations with platforms like Zapier, n8n, and Lovable if you are working in a no-code or low-code environment.
Running It Locally
Firecrawl Local is a single binary distributed through crates.io. You need Rust and a C compiler installed:
cargo install firecrawl-local
It serves the v2 API on port 3002, so you can point your SDK at http://localhost:3002 during development.
By default, local scrapes that fail on your machine can fall back to Firecrawl Cloud. If you need everything to stay on your machine, for privacy or compliance reasons, turn that off:
export FIRECRAWL_CLOUD=off
Self-Hosting
For full control, you can run the complete server yourself. The self-hosted setup uses Docker Compose with Redis, PostgreSQL, and a browser service. Kubernetes manifests and a Helm chart are available for larger deployments.
The repository's SELF_HOST.md file is the source of truth for the required services and environment variables. Read it before you start, because the setup involves more moving parts than the Cloud API.
Keep in mind that some Cloud features are not part of the self-hosted server. For example, Alexandria, Firecrawl's catalog of 550+ data providers, is Cloud only.
Things Worth Knowing Before Production
These are the details that tend to catch people out.
1. Credits add up per feature, not per request
A basic scrape costs 1 credit. Extras cost more:
- JSON extraction adds 4 credits per page
- PDF parsing costs 1 credit per PDF page
- Cached results still cost 1 credit
A crawl of 1,000 pages with JSON extraction is about 5,000 credits, not 1,000. Do the math before you launch a big job.
2. Results are cached by default
Scrapes use a maxAge cache that defaults to 2 days (172800000 ms) and caps at 7 days. That is great for speed and cost, but it means you may get a two-day-old copy of a page. If you need fresh content, for example for prices or stock levels, pass maxAge: 0:
doc = firecrawl.scrape("https://example.com/pricing", formats=["markdown"], max_age=0)
3. Always bound your jobs
Set limit on crawls and max_credits on agents. An unbounded crawl on a large site can consume your monthly allowance in minutes.
4. Prefer map plus batch over a blind crawl
Mapping first lets you filter out tag pages, pagination, and other noise before you pay to scrape them.
5. Use a schema for anything downstream code depends on
Prompt-only extraction is flexible, but the output shape can vary between pages. A JSON Schema (or a Pydantic model) gives you consistent, typed results.
6. Do not block on long jobs
Use start_crawl, start_batch_scrape, and start_agent with status checks or webhooks in production instead of the blocking helpers.
7. There is a free tier for experimenting
Firecrawl Keyless provides 1,000 free credits per month without an API key or signup, which is enough to prototype. An API key gives you higher rate limits.
8. Check the license
The main project is licensed under AGPL-3.0, while the SDKs and some UI components are MIT. Using the Cloud API or the SDKs in your app is straightforward. If you plan to modify and self-host the server as part of a service you offer to others, review the AGPL obligations with your team first.
9. Scrape responsibly
Firecrawl makes collecting web data easy, but the usual rules still apply. Respect each site's terms of service and robots.txt, avoid hammering small sites, and be careful with personal data.
Useful links:
- GitHub: github.com/firecrawl/firecrawl
- Self-hosting guide:
SELF_HOST.mdin the repository
Top comments (0)