firecrawl
Firecrawl CLI
Use the firecrawl CLI for web scraping, search, and browser automation. It returns clean markdown optimized for LLM context windows and handles JavaScript rendering.
Prerequisites
The firecrawl CLI must already be installed and authenticated. Check status:
firecrawl --status
If not ready, refer to rules/install.md for setup instructions.
Also see rules/security.md for output handling guidelines.
Organization
Create a .firecrawl/ folder in the working directory to store results. Add .firecrawl/ to .gitignore. Always use -o to write output to files:
firecrawl search "your query" -o .firecrawl/search-result.json
firecrawl scrape "<url>" -o .firecrawl/page.md
Commands
Search
firecrawl search "your query" -o .firecrawl/search-result.json --json
firecrawl search "your query" --limit 10 -o .firecrawl/search-result.json --json
firecrawl search "your query" --sources news -o .firecrawl/search-news.json --json
firecrawl search "your query" --sources images -o .firecrawl/search-images.json --json
firecrawl search "your query" --tbs qdr:d -o .firecrawl/search-today.json --json
firecrawl search "your query" --scrape -o .firecrawl/search-scraped.json --json
Options: --limit <n>, --sources <web,images,news>, --categories <github,research,pdf>, --tbs <qdr:h|d|w|m|y>, --location, --country <code>, --scrape, -o <path>
Scrape
firecrawl scrape "<url>" -o .firecrawl/page.md
firecrawl scrape "<url>" --only-main-content -o .firecrawl/page.md
firecrawl scrape "<url>" --format markdown,links -o .firecrawl/page.json
firecrawl scrape "<url>" --wait-for 3000 -o .firecrawl/page.md
firecrawl scrape "<url>" --include-tags article,main -o .firecrawl/page.md
Options: -f <markdown,html,rawHtml,links,screenshot,json>, --only-main-content, --wait-for <ms>, --include-tags, --exclude-tags, -o <path>
Map
Discover all URLs on a site:
firecrawl map "<url>" -o .firecrawl/urls.txt
firecrawl map "<url>" --search "keyword" -o .firecrawl/filtered-urls.txt
firecrawl map "<url>" --limit 500 --json -o .firecrawl/urls.json
Options: --limit <n>, --search <query>, --include-subdomains, --json, -o <path>
Browser
Launch cloud Chromium sessions for interactive browsing. All browser sessions run in Firecrawl's remote sandboxed cloud environment. Sessions auto-launch on first use:
firecrawl browser "open <url>"
firecrawl browser "snapshot"
firecrawl browser "click @e5"
firecrawl browser "fill @e3 'search query'"
firecrawl browser "scrape" -o .firecrawl/browser-scrape.md
firecrawl browser close
Core commands: open <url>, snapshot, screenshot, click <@ref>, type <@ref> <text>, fill <@ref> <text>, scrape, scroll <direction>, wait <seconds>
Session management:
firecrawl browser launch-session --ttl 600
firecrawl browser list
firecrawl browser close
Options: --ttl <seconds>, --ttl-inactivity <seconds>, --stream, --session <id>, -o <path>
Crawl
firecrawl crawl "<url>" --wait -o .firecrawl/crawl-result.json
firecrawl crawl "<url>" --limit 100 --max-depth 3 --wait -o .firecrawl/crawl-result.json
firecrawl crawl "<url>" --include-paths /blog,/docs --wait -o .firecrawl/crawl-result.json
Options: --wait, --progress, --limit <n>, --max-depth <n>, --include-paths, --exclude-paths, --delay <ms>, --max-concurrency <n>, -o <path>
Agent
AI-powered autonomous web data extraction (takes 2-5 minutes):
firecrawl agent "your extraction prompt" --wait -o .firecrawl/agent-result.json
firecrawl agent "your extraction prompt" --urls "<url>" --wait -o .firecrawl/agent-result.json
firecrawl agent "your extraction prompt" --schema '{"type":"object","properties":{"name":{"type":"string"}}}' --wait -o .firecrawl/agent-result.json
Options: --urls <urls>, --model <spark-1-mini|spark-1-pro>, --schema <json>, --schema-file <path>, --max-credits <n>, --wait, -o <path>
Reading Output Files
Firecrawl output files can be large. Use incremental reads:
wc -l .firecrawl/file.md && head -50 .firecrawl/file.md
grep -n "keyword" .firecrawl/file.md
Parallelization
Run multiple operations in parallel when possible. Check firecrawl --status for your concurrency limit first:
firecrawl scrape "<url-1>" -o .firecrawl/1.md &
firecrawl scrape "<url-2>" -o .firecrawl/2.md &
firecrawl scrape "<url-3>" -o .firecrawl/3.md &
wait