Skip to main content

Installation

The official Rust SDK lets you search, scrape, parse, crawl, map, and run agents against the web from Rust. It is maintained in the Firecrawl monorepo at apps/rust-sdk. To install the Firecrawl Rust SDK, add the dependency from crates.io:
Or install via Cargo:
Requires Rust 1.70 or later.

Usage

  1. Get an API key from firecrawl.dev
  2. Set the API key as an environment variable named FIRECRAWL_API_KEY, or pass it directly to Client::new(...)
Scrape a page and print its markdown:
The sections below cover crawling, mapping, searching, and the other SDK methods.

Scraping a URL

To scrape a single URL, use the scrape method.

JSON Extraction

Extract structured JSON using scrape_with_schema:
Or configure JSON extraction via ScrapeOptions directly:

Parsing uploaded files

Use parse to upload a local file (.html, .htm, .pdf, .docx, .doc, .odt, .rtf, .xlsx, .xls) as multipart form data to /v2/parse. The endpoint returns a Document with the requested formats. ParseOptions intentionally omits scrape-only fields that /v2/parse rejects (such as actions, waitFor, location, mobile, screenshot, branding, and changeTracking). Build a ParseFile from in-memory bytes or directly from a path:
Or read the file from disk and omit the options:

ParseFile

ParseOptions

Supported fields (all optional, camelCase on the wire):
  • formats: Vec<ParseFormat> — any of Markdown, Html, RawHtml, Links, Images, Summary, Json, Attributes
  • only_main_content: bool
  • include_tags: Vec<String> / exclude_tags: Vec<String>
  • headers: HashMap<String, String>
  • timeout: u32 (ms)
  • parsers: Vec<ParserConfig> (e.g. PDF parser config)
  • skip_tls_verification: bool
  • remove_base64_images: bool
  • fast_mode: bool
  • block_ads: bool
  • proxy: ParseProxyType (Basic or Auto)
  • json_options: JsonOptions
  • attribute_selectors: Vec<AttributeSelector>
  • zero_data_retention: bool
  • integration: String, origin: String, use_mock: String

Crawling a Website

To crawl a website and wait for completion, use crawl.

Start a Crawl

Start a job without waiting using start_crawl.

Checking Crawl Status

Check crawl progress with get_crawl_status.

Cancelling a Crawl

Cancel a running crawl with cancel_crawl.

Checking Crawl Errors

Retrieve errors from a crawl job with get_crawl_errors.

Mapping a Website

Discover links on a site using map.
For a simpler result with just URLs, use map_urls:

Searching the Web

Search with optional settings using search.
For a convenience method that returns scraped documents directly:

Alexandria Data Tools

Alexandria is the Firecrawl catalogue of third-party data providers. Use find_tools to browse providers and read tool contracts for free. Then run a tool with scrape_alexandria.
Examine error on each result, because one call can fail when the request succeeds. To retry after an uncertain result, pass the same AlexandriaOptions.request_id with the same calls. search with SearchSource::Alexandria in sources also returns matching tools in data.tools.

Batch Scraping

Scrape multiple URLs in parallel using batch_scrape.

Agent

Run an AI-powered agent with agent.
With a JSON schema for structured output:

Scrape-Bound Interactive Session

Use a scrape job ID to run follow-up browser code in the same context:
  • interact(...) runs code or prompts in the scrape-bound browser session.
  • stop_interaction(...) stops the interactive session when you are done.

Configuration

Client::new(...) and Client::new_selfhosted(...) create the client.

Environment Variable

Set the FIRECRAWL_API_KEY environment variable instead of passing the key directly:

Poll Intervals

Synchronous methods (crawl, batch_scrape, agent) poll until completion. You can customize the poll interval via the options struct:

Error Handling

The SDK uses the FirecrawlError enum, which implements Error, Debug, and Display. All methods return Result<T, FirecrawlError>.
Are you an AI agent that needs a Firecrawl API key? See firecrawl.dev/agent-onboarding/SKILL.md for automated onboarding instructions.