# CLI

> Firecrawl skills are an easy way for AI agents such as Codex, Claude Code, Cursor, and OpenCode to use Firecrawl through the CLI.

import InstallationCLI from "/snippets/v2/cli/installation/bash.mdx";
import AuthLogin from "/snippets/v2/cli/auth/login.mdx";
import AuthLogout from "/snippets/v2/cli/auth/logout.mdx";
import AuthConfig from "/snippets/v2/cli/auth/config.mdx";
import AuthSelfHosted from "/snippets/v2/cli/auth/self-hosted.mdx";
import ScrapeBasic from "/snippets/v2/cli/scrape/basic.mdx";
import ScrapeFormats from "/snippets/v2/cli/scrape/formats.mdx";
import ScrapeOptions from "/snippets/v2/cli/scrape/options.mdx";
import CrawlBasic from "/snippets/v2/cli/crawl/basic.mdx";
import CrawlStatus from "/snippets/v2/cli/crawl/status.mdx";
import CrawlOptions from "/snippets/v2/cli/crawl/options.mdx";
import MapBasic from "/snippets/v2/cli/map/basic.mdx";
import MapOptions from "/snippets/v2/cli/map/options.mdx";
import SearchBasic from "/snippets/v2/cli/search/basic.mdx";
import SearchOptions from "/snippets/v2/cli/search/options.mdx";
import AgentBasic from "/snippets/v2/cli/agent/basic.mdx";
import AgentOptions from "/snippets/v2/cli/agent/options.mdx";
import InteractCLI from "/snippets/v2/interact/quickstart/cli.mdx";

Search, scrape, interact, crawl, map, and run agent jobs directly from the terminal. The Firecrawl CLI works standalone or with skills that AI coding agents like Codex, Claude Code, Cursor, and OpenCode can discover and use automatically.

## Installation

If you are using an AI agent like Codex, Claude Code, Cursor, or OpenCode, you can install the Firecrawl skills below and the agent will set them up for you.

```bash
npx -y firecrawl-cli@latest init --all --browser
```

- `--all` skips agent selection and initializes every detected agent
- `--browser` opens the browser for Firecrawl authentication automatically

<Note>
  After installing the skills, restart your agent for it to discover them.
</Note>

You can also manually install the Firecrawl CLI globally using npm:

<InstallationCLI />

## Authentication

Before using the CLI, you need to authenticate with your Firecrawl API key.

<Note>
**Some CLI commands work without logging in.** With no API key configured, supported commands fall back to the keyless free tier — free, but rate-limited per IP. See [Rate Limits](/rate-limits#keyless-no-api-key) for the current keyless command list and caveats. [Sign up for a free key](https://firecrawl.dev) for 1,000 credits and higher limits; the CLI uses it automatically once configured.
</Note>

### Login

<AuthLogin />

### View Configuration

<AuthConfig />

### Logout

<AuthLogout />

### Connect the CLI to self-hosted Firecrawl

First, get one scrape working with the [self-hosting guide](/contributing/self-host). Then point the CLI at that API with `--api-url` or `FIRECRAWL_API_URL`:

<AuthSelfHosted />

When you use a custom API URL instead of `https://api.firecrawl.dev`, the CLI skips Firecrawl Cloud API-key authentication. That matches the trusted-network quickstart, where `USE_DB_AUTHENTICATION=false`.

<Warning>
  Keep an unauthenticated API on a trusted network. If you add an authentication
  proxy or another access-control layer, verify that the CLI can send the
  credentials that layer requires before depending on this path.
</Warning>

The CLI can call only the capabilities enabled in your deployment. Check [self-hosted feature support](/contributing/self-host#self-hosted-feature-support) before using Cloud-only or provider-dependent commands.

### Check Status

Verify installation, authentication, and view rate limits:

```bash CLI
firecrawl --status
```

Output when ready:

```
  🔥 firecrawl cli v1.16.2

  ● Authenticated via FIRECRAWL_API_KEY
  Concurrency: 0/100 jobs (parallel scrape limit)
  Credits: 500,000 remaining
```

- **Concurrency**: Maximum parallel jobs. Run parallel operations close to this limit but not above.
- **Credits**: Remaining API credits. Each scrape/crawl consumes credits.

## Commands

<Note>
The hidden `firecrawl browser` command is deprecated for agent workflows. Use `firecrawl scrape <url>` first, then `firecrawl interact ...` with the resulting scrape session.
</Note>

### Scrape

Scrape a single URL and extract its content in various formats.

<Tip>
  Use `--only-main-content` to get clean output without navigation, footers, and
  ads. This is recommended for most use cases where you want just the article or
  main page content.
</Tip>

<ScrapeBasic />

#### Output Formats

<ScrapeFormats />

#### Scrape Options

<ScrapeOptions />

**Available Options:**

| Option                   | Short | Description                                                                                                                                                     |
| ------------------------ | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--url <url>`            | `-u`  | URL to scrape (alternative to positional argument)                                                                                                              |
| `--format <formats>`     | `-f`  | Output formats (comma-separated): `markdown`, `html`, `rawHtml`, `links`, `screenshot`, `json`, `images`, `summary`, `changeTracking`, `attributes`, `branding` |
| `--html`                 | `-H`  | Shortcut for `--format html`                                                                                                                                    |
| `--only-main-content`    |       | Extract only main content                                                                                                                                       |
| `--wait-for <ms>`        |       | Wait time in milliseconds for JS rendering                                                                                                                      |
| `--screenshot`           |       | Take a screenshot                                                                                                                                               |
| `--full-page-screenshot` |       | Take a full page screenshot                                                                                                                                     |
| `--include-tags <tags>`  |       | HTML tags to include (comma-separated)                                                                                                                          |
| `--exclude-tags <tags>`  |       | HTML tags to exclude (comma-separated)                                                                                                                          |
| `--schema <json>`        |       | JSON schema for structured extraction                                                                                                                           |
| `--schema-file <path>`   |       | Path to JSON schema file                                                                                                                                        |
| `--actions <json>`       |       | JSON actions array to run during scrape                                                                                                                         |
| `--actions-file <path>`  |       | Path to JSON actions file                                                                                                                                       |
| `--proxy <proxy>`        |       | Proxy mode for scraping (for example, `auto` or `basic`)                                                                                                        |
| `--redact-pii`           |       | Redact personally identifiable information from returned content                                                                                                 |
| `--output <path>`        | `-o`  | Save output to file                                                                                                                                             |
| `--json`                 |       | Force JSON output even with single format                                                                                                                       |
| `--pretty`               |       | Pretty print JSON output                                                                                                                                        |
| `--timing`               |       | Show request timing and other useful information                                                                                                                |

---

### Search

Search the web and optionally scrape the results.

<SearchBasic />

#### Search Options

<SearchOptions />

**Available Options:**

| Option                       | Description                                                                                 |
| ---------------------------- | ------------------------------------------------------------------------------------------- |
| `--limit <number>`           | Maximum results (default: 5, max: 100)                                                      |
| `--sources <sources>`        | Sources to search: `web`, `images`, `news` (comma-separated)                                |
| `--categories <categories>`  | Filter by category: `research`, `pdf`, `developer` (comma-separated)                           |
| `--tbs <value>`              | Time filter: `qdr:h` (hour), `qdr:d` (day), `qdr:w` (week), `qdr:m` (month), `qdr:y` (year) |
| `--location <location>`      | Geo-targeting (e.g., "Berlin,Germany")                                                      |
| `--country <code>`           | ISO country code (default: US)                                                              |
| `--timeout <ms>`             | Timeout in milliseconds (default: 60000)                                                    |
| `--ignore-invalid-urls`      | Exclude URLs invalid for other Firecrawl endpoints                                          |
| `--scrape`                   | Scrape search results                                                                       |
| `--scrape-formats <formats>` | Formats for scraped content (default: markdown)                                             |
| `--only-main-content`        | Include only main content when scraping (default: true)                                     |
| `--json`                     | Output as JSON                                                                              |
| `--output <path>`            | Save output to file                                                                         |
| `--pretty`                   | Pretty print JSON output                                                                    |

---

### Developer

Search the [Developer Index](/features/developer) — issues, merged pull requests, and READMEs from public code repositories, alongside curated documentation sites.

```bash CLI
firecrawl developer "how do I configure retries" --limit 10
```

**Available Options:**

| Option              | Description                                    |
| -------------------- | ----------------------------------------------- |
| `--limit <number>`  | Number of results to return (default: 10, max: 100) |
| `--skills-only`     | Search only indexed agent-skill files (default: false) |
| `--json`            | Output as compact JSON                          |
| `--output <path>`   | Save output to file                             |
| `--pretty`          | Pretty print JSON output                        |

---

### Map

Discover all URLs on a website quickly.

<MapBasic />

#### Map Options

<MapOptions />

**Available Options:**

| Option                      | Description                                     |
| --------------------------- | ----------------------------------------------- |
| `--url <url>`               | URL to map (alternative to positional argument) |
| `--limit <number>`          | Maximum URLs to discover                        |
| `--search <query>`          | Filter URLs by search query                     |
| `--sitemap <mode>`          | Sitemap handling: `include`, `skip`, `only`     |
| `--include-subdomains`      | Include subdomains                              |
| `--ignore-query-parameters` | Treat URLs with different params as same        |
| `--wait`                    | Wait for map to complete                        |
| `--timeout <seconds>`       | Timeout in seconds                              |
| `--json`                    | Output as JSON                                  |
| `--output <path>`           | Save output to file                             |
| `--pretty`                  | Pretty print JSON output                        |

---

### Interact

Scrape a page, then interact with it using natural language or code. Interact uses the most recent scrape by default, or you can pass a specific scrape ID.

<InteractCLI />

**Available Options:**

| Option                 | Description                                    |
| ---------------------- | ---------------------------------------------- |
| `-p, --prompt <text>`  | AI prompt (alternative to positional argument) |
| `-c, --code <code>`    | Code to execute in the live page session       |
| `-s, --scrape-id <id>` | Scrape job ID (default: last scrape)           |
| `--python`             | Execute code as Python/Playwright              |
| `--node`               | Execute code as Node.js/Playwright (default)   |
| `--bash`               | Execute code as Bash                           |
| `--timeout <seconds>`  | Timeout in seconds (1-300, default: 30)        |
| `--output <path>`      | Save output to file                            |
| `--json`               | Output as JSON format                          |

---

### Crawl

Crawl an entire website starting from a URL.

<CrawlBasic />

#### Check Crawl Status

<CrawlStatus />

#### Crawl Options

<CrawlOptions />

**Available Options:**

| Option                         | Description                                       |
| ------------------------------ | ------------------------------------------------- |
| `--url <url>`                  | URL to crawl (alternative to positional argument) |
| `--wait`                       | Wait for crawl to complete                        |
| `--progress`                   | Show progress indicator while waiting             |
| `--poll-interval <seconds>`    | Polling interval (default: 5)                     |
| `--timeout <seconds>`          | Timeout when waiting                              |
| `--status`                     | Check status of existing crawl job                |
| `--limit <number>`             | Maximum pages to crawl                            |
| `--max-depth <number>`         | Maximum crawl depth                               |
| `--include-paths <paths>`      | Paths to include (comma-separated)                |
| `--exclude-paths <paths>`      | Paths to exclude (comma-separated)                |
| `--sitemap <mode>`             | Sitemap handling: `include`, `skip`, `only`       |
| `--allow-subdomains`           | Include subdomains                                |
| `--allow-external-links`       | Follow external links                             |
| `--crawl-entire-domain`        | Crawl entire domain                               |
| `--ignore-query-parameters`    | Treat URLs with different params as same          |
| `--delay <ms>`                 | Delay between requests                            |
| `--max-concurrency <n>`        | Maximum concurrent requests                       |
| `--scrape-options <json>`      | JSON scrape options passed to each page           |
| `--scrape-options-file <path>` | Path to scrape options JSON file                  |
| `--webhook <url-or-json>`      | Webhook URL or configuration                      |
| `--cancel`                     | Cancel an active crawl job by job ID              |
| `--output <path>`              | Save output to file                               |
| `--pretty`                     | Pretty print JSON output                          |

---

### Monitor

Create recurring scrapes or crawls that diff each run against the previous snapshot. Add a goal when you want Firecrawl to judge which changed pages are meaningful for your use case.

```bash CLI
firecrawl monitor create --name "Hacker News AI" \
  --schedule "every 30 minutes" \
  --goal "Alert when a new Hacker News story related to AI enters the top 10. Ignore changes to stories that are not about AI. Do not alert on changes outside the top 10." \
  --page https://news.ycombinator.com

firecrawl monitor run <monitorId>
firecrawl monitor checks <monitorId> --limit 10
firecrawl monitor check <monitorId> <checkId> --page-status changed
firecrawl monitor update <monitorId> \
  --goal "Alert when a new Hacker News story related to AI enters the top 10. Do not alert on changes outside the top 10."
firecrawl monitor delete <monitorId>
```

Monitor goals should stay short and faithful to the user's intent: say what should trigger an alert, restate any stated scope, and include exclusions only when they are obvious or explicitly requested. If the user asks for "any change", keep the goal broad.

**Available Options:**

| Option                    | Description                                         |
| ------------------------- | --------------------------------------------------- |
| `--name <name>`           | Monitor name                                        |
| `--goal <goal>`           | Goal for meaningful-change judging                  |
| `--cron <expression>`     | Cron schedule, for example `*/30 * * * *`           |
| `--schedule <text>`       | Natural-language schedule, for example `hourly`     |
| `--timezone <tz>`         | Schedule timezone, default `UTC`                    |
| `--page <url>`            | Single page URL to scrape on each check             |
| `--scrape-urls <list>`    | Comma-separated page URLs to scrape on each check   |
| `--crawl-url <url>`       | Root URL for a crawl target                         |
| `--webhook-url <url>`     | Webhook destination                                 |
| `--webhook-events <list>` | Comma-separated monitor events                      |
| `--email <list>`          | Comma-separated email recipients                    |
| `--retention-days <n>`    | Snapshot retention window                           |
| `--page-status <state>`   | Filter pages on `monitor check`                     |
| `--state <state>`         | Set monitor state on `monitor update`: active/paused |

---

### Agent

Search and gather data from the web using natural language prompts.

<AgentBasic />

#### Agent Options

<AgentOptions />

**Available Options:**

| Option                      | Description                                                                            |
| --------------------------- | -------------------------------------------------------------------------------------- |
| `--urls <urls>`             | Optional list of URLs to focus the agent on (comma-separated)                          |
| `--model <model>`           | Model to use. Defaults to `spark-2`, the model every run executes on. Spark 1 models are deprecated and route to `spark-2` |
| `--schema <json>`           | JSON schema for structured output (inline JSON string)                                 |
| `--schema-file <path>`      | Path to JSON schema file for structured output                                         |
| `--max-credits <number>`    | Maximum credits to spend (job fails if limit reached)                                  |
| `--webhook <url-or-json>`   | Webhook URL or configuration                                                           |
| `--status`                  | Check status of existing agent job                                                     |
| `--cancel`                  | Cancel an active agent job by job ID                                                   |
| `--wait`                    | Wait for agent to complete before returning results                                    |
| `--poll-interval <seconds>` | Polling interval when waiting (default: 5)                                             |
| `--timeout <seconds>`       | Timeout when waiting (default: no timeout)                                             |
| `--output <path>`           | Save output to file                                                                    |
| `--json`                    | Output as JSON format                                                                  |

---

### Credit Usage

Check your team's credit balance and usage.

```bash CLI
# View credit usage
firecrawl credit-usage

# Output as JSON
firecrawl credit-usage --json --pretty
```

---

### Version

Display the CLI version.

```bash CLI
firecrawl version
# or
firecrawl --version
```

## Global Options

These options are available for all commands:

| Option            | Short | Description                                            |
| ----------------- | ----- | ------------------------------------------------------ |
| `--status`        |       | Show version, auth, concurrency, and credits           |
| `--api-key <key>` | `-k`  | Override stored API key for this command               |
| `--api-url <url>` |       | Use custom API URL (for self-hosted/local development) |
| `--help`          | `-h`  | Show help for a command                                |
| `--version`       | `-V`  | Show CLI version                                       |

`init` also accepts `--skip-auth`, `--skip-install`, `--skip-skills`, and `--agent <name>`. See `firecrawl init --help`.

## Output Handling

The CLI outputs to stdout by default, making it easy to pipe or redirect:

```bash CLI
# Pipe markdown to another command
firecrawl https://example.com | head -50

# Redirect to a file
firecrawl https://example.com > output.md

# Save JSON with pretty formatting
firecrawl https://example.com --format markdown,links --pretty -o data.json
```

### Format Behavior

- **Single format**: Outputs raw content (markdown text, HTML, etc.)
- **Multiple formats**: Outputs JSON with all requested data

```bash CLI
# Raw markdown output
firecrawl https://example.com --format markdown

# JSON output with multiple formats
firecrawl https://example.com --format markdown,links
```

## Examples

### Quick Scrape

```bash CLI
# Get markdown content from a URL (use --only-main-content for clean output)
firecrawl https://docs.firecrawl.dev --only-main-content

# Get HTML content
firecrawl https://example.com --html -o page.html
```

### Full Site Crawl

```bash CLI
# Crawl a docs site with limits
firecrawl crawl https://docs.example.com --limit 50 --max-depth 2 --wait --progress -o docs.json
```

### Site Discovery

```bash CLI
# Find all blog posts
firecrawl map https://example.com --search "blog" -o blog-urls.txt
```

### Research Workflow

```bash CLI
# Search and scrape results for research
firecrawl search "machine learning best practices 2024" --scrape --scrape-formats markdown --pretty
```

### Agent

```bash CLI
# URLs are optional
firecrawl agent "Find the top 5 AI startups and their funding amounts" --wait

# Focus on specific URLs
firecrawl agent "Compare pricing plans" --urls https://slack.com/pricing,https://teams.microsoft.com/pricing --wait
```

### Combine with Other Tools

```bash CLI
# Extract URLs from search results
jq -r '.data.web[].url' search-results.json

# Get titles from search results
jq -r '.data.web[] | "\(.title): \(.url)"' search-results.json

# Extract links as JSON and print one URL per line
firecrawl https://example.com --format links --json | jq -r '.links[]'

# Count URLs from map
firecrawl map https://example.com | wc -l
```

## Telemetry

The CLI collects anonymous usage data during authentication to help improve the product:

- CLI version, OS, and Node.js version
- Development tool detection (e.g., Cursor, VS Code, Claude Code)

**No command data, URLs, or file contents are collected via the CLI.**

To disable telemetry, set the environment variable:

```bash CLI
export FIRECRAWL_NO_TELEMETRY=1
```

## Open Source

The Firecrawl CLI and all three skill segments are open source on GitHub:

- [`firecrawl/cli`](https://github.com/firecrawl/cli) — the CLI and CLI skills (live web work)
- [`firecrawl/skills`](https://github.com/firecrawl/skills) — build skills (integrate Firecrawl into application code)
- [`firecrawl/firecrawl-workflows`](https://github.com/firecrawl/firecrawl-workflows) — workflow skills (repeatable deliverables such as research briefs, SEO audits, lead lists, and design clones)

> Are you an AI agent that needs a Firecrawl API key? See [firecrawl.dev/agent-onboarding/SKILL.md](https://www.firecrawl.dev/agent-onboarding/SKILL.md) for automated onboarding instructions.
