Skip to main content

Firecrawl Rust Agent Quickstart

This is the canonical quickstart for external agents integrating with Firecrawl using the official Rust SDK. Generated from SDK source and OpenAPI spec.

Install

Add to your Cargo.toml:

Authenticate

Client::new requires an API key. Client::new_selfhosted allows an optional key for keyless free-tier usage.

When To Use What

  • search — Use when you start with a query and need to discover relevant pages. Returns search results grouped by source type, optionally with scraped content.
  • scrape — Use when you already have a URL and want its content. Returns markdown, HTML, structured data, screenshots, or other formats.
  • interact — Use when the page needs post-scrape browser actions like clicking, filling forms, or executing code in the browser sandbox.

Why use it

Search the web and optionally scrape each result in one call. Start here when you have a question or topic but not a specific URL.

Preferred SDK method

Example

Parameters

All fields on SearchOptions are Option and default to None. A convenience method search_and_scrape(query, limit) is also available. It searches with default scrape options and returns Vec<Document> directly.

Scrape

Why use it

Fetch and extract content from a single URL. Use when you have a specific page to read.

Preferred SDK method

Example

Parameters

All fields on ScrapeOptions are Option and default to None. A convenience method scrape_with_schema(url, schema, prompt) is also available for JSON extraction.

Interact

Why use it

Execute code or natural-language prompts in the browser sandbox associated with a scrape job. Use after a scrape to click buttons, fill forms, navigate, or extract additional data.

Preferred SDK method

Example

Parameters

All fields on ScrapeExecuteOptions are Option and default to None. At least one of code or prompt must be provided or the client returns FirecrawlError::Misuse.
Stops the interactive browser session and returns billing info.

Notes

  • Naming style: All struct fields use snake_case. Serialization to camelCase is handled internally by serde.
  • Deprecated aliases:
    • scrape_execute() → use interact() instead.
    • stop_interactive_browser() and delete_scrape_browser() → use stop_interaction() instead.
  • Async: All methods are async and return Result<T, FirecrawlError>.
  • Origin auto-set: The SDK automatically sets origin to "rust-sdk@{version}" if not explicitly provided.

Source Of Truth

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