Skip to main content

Firecrawl Rust Agent Quickstart

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

Install

Requires an async runtime (Tokio).

Authenticate

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 scrape job ID 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:, for example site:docs.firecrawl.dev crawl webhooks.

Preferred SDK method

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

Example

Parameters

Scrape

Why use it

Fetch structured content from a URL in one or more formats. Use when you already have the URL.

Preferred SDK method

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

Example

Parameters

Format enum values: Simple: Markdown, Html, RawHtml, Links, Images, Screenshot, Summary, ChangeTracking, Json, Attributes, Branding, Product, Menu, Audio, Video. Object variants: Question(QuestionFormat { question }), Highlights(HighlightsFormat { query }).

Interact

Why use it

Control the browser session tied to a scrape job. Use for code execution or natural-language instructions after a scrape creates a session.

Preferred SDK method

client.interact(job_id, options)Result<ScrapeExecuteResponse, FirecrawlError>

Example

Parameters

At least one of code or prompt must be non-empty (SDK returns FirecrawlError::Misuse otherwise). Stop session: client.stop_interaction(job_id) ends the browser session.

Notes

  • Deprecated aliases: scrape_executeinteract; stop_interactive_browser / delete_scrape_browserstop_interaction.
  • All option structs derive Default; use struct-update syntax: ScrapeOptions { formats: Some(vec![...]), ..Default::default() }.
  • The options parameter on scrape and search accepts impl Into<Option<T>>, so you can pass None or a bare struct.
  • All methods are async and require a Tokio runtime.
  • search_and_scrape(query, limit) is a convenience helper that returns Vec<Document>.
  • All serialization uses camelCase for the API wire format.

Source Of Truth

  • firecrawl/apps/rust-sdk/Cargo.toml
  • firecrawl/apps/rust-sdk/src/lib.rs
  • 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