Skip to main content

Firecrawl Rust Agent Quickstart

Canonical quickstart for external agents. Generated from SDK source (firecrawl crate) and the v2 OpenAPI spec. Method names and parameters match the SDK public API.

Install

Crate: firecrawl on crates.io.

Authenticate

Client::new(api_key) connects to https://api.firecrawl.dev. Client::new_selfhosted(api_url, api_key) connects to a self-hosted instance. An empty key falls back to the keyless free tier.

When To Use What

  • search: use when you start with a query and need discovery.
  • scrape: use when you already have a URL and want page content.
  • interact: use when the page needs clicks, forms, or post-scrape browser actions. Requires a scrapeId from a prior scrape.

Why use it

Discover relevant pages from a query, then pick URLs to scrape or interact with. Constrain results to a site with site: in the query.

Preferred SDK method

client.search(query, options)Result<SearchResponse, FirecrawlError>

Example

Results are in results.data.web, results.data.news, results.data.images.

Parameters

Scrape

Why use it

Get structured content from a URL in one or more formats.

Preferred SDK method

client.scrape(url, options)Result<Document, FirecrawlError>

Example

Parameters

Interact

Why use it

Control the browser session tied to a prior scrape. Use for clicks, form fills, code execution, or natural-language instructions.

Preferred SDK method

client.interact(job_id, options)Result<ScrapeExecuteResponse, FirecrawlError> At least one of code or prompt must be non-empty; otherwise returns FirecrawlError::Misuse.

Example

Parameters

Stop the session with client.stop_interaction(job_id).

Notes

  • Deprecated aliases: scrape_executeinteract, stop_interactive_browser / delete_scrape_browserstop_interaction.
  • All types are exported at crate root: use firecrawl::Client.
  • ScrapeOptions has dedicated sub-option structs: json_options, screenshot_options, change_tracking_options.
  • search_and_scrape(query, limit) is a convenience that calls search with default scrape options and returns Vec<Document>.

Source Of Truth

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