Skip to main content

Firecrawl Rust Agent Quickstart

This file is the canonical quickstart for external agents integrating Firecrawl via the Rust SDK. It is generated from SDK source and the OpenAPI spec.

Install

Add to your Cargo.toml:

Authenticate

For self-hosted instances:
An empty or omitted API key is allowed — scrape, search, and interact fall back to a keyless free tier (rate-limited per IP).

When To Use What

  • search — Use when you start with a query and need discovery. Returns web, news, and image results with optional scraping of each result.
  • scrape — Use when you already have a URL and want page content (markdown, HTML, screenshots, structured JSON, etc.).
  • interact — Use when the page needs clicks, form fills, or post-scrape browser actions. Runs code or a prompt against an active browser session.

Why use it

Search the web with a query and get back structured results. Optionally scrape each result page inline. Useful for discovery, research, and finding relevant URLs before scraping them in detail.

Preferred SDK method

Example

Results are grouped under .data.web, .data.news, and .data.images.

Parameters

SearchOptions fields (all Option, derives Default):

Convenience method

Searches and scrapes all results, returning Vec<Document>.

Scrape

Why use it

Fetch a single URL and get back structured page data — markdown, HTML, screenshots, extracted JSON, and more. The workhorse endpoint for turning a known URL into usable content.

Preferred SDK method

Example

Pass None instead of ScrapeOptions to use all defaults.

Parameters

ScrapeOptions fields (all Option, derives Default):

Convenience method

Scrapes with JSON extraction using a JSON Schema value.

Interact

Why use it

Run code or a natural-language prompt against an active browser session tied to a scrape job. Use it for clicking buttons, filling forms, navigating multi-step flows, or extracting data that requires browser interaction after the initial scrape.

Preferred SDK method

Example

Parameters

ScrapeExecuteOptions fields (all Option, derives Default):

Stopping a session

Notes

  • Async only — All methods are async and require a tokio runtime (#[tokio::main]).
  • Option wrapping — All options structs use Option<T> for every field and derive Default. Use struct update syntax: ScrapeOptions { formats: Some(vec![...]), ..Default::default() }.
  • No builder pattern — Options are plain structs with public fields, not builders.
  • impl Into<Option<...>>scrape() and search() accept impl Into<Option<ScrapeOptions/SearchOptions>>, so you can pass None directly or pass the struct without wrapping in Some().
  • impl AsRef<str> — URL, query, and job_id parameters accept impl AsRef<str>, so &str, String, etc. all work.
  • snake_case fields — Rust fields use snake_case (e.g. only_main_content). The SDK handles serde camelCase conversion for the API wire format.
  • Deprecated aliasesscrape_execute() maps to interact(). stop_interactive_browser() and delete_scrape_browser() map to stop_interaction(). Always use the preferred names.

Source Of Truth

  • firecrawl/apps/rust-sdk/src/v2/client.rs
  • firecrawl/apps/rust-sdk/src/v2/search.rs
  • firecrawl/apps/rust-sdk/src/v2/scrape.rs
  • firecrawl/apps/rust-sdk/Cargo.toml
  • firecrawl-docs/api-reference/v2-openapi.json