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 OpenAPI spec.

Install

Add to Cargo.toml:

Authenticate

For self-hosted instances:
The API key is optional for new_selfhosted. If omitted, the client falls back to keyless free tier (rate-limited per IP).

When To Use What

  • search: Use when you start with a query and need to discover relevant URLs and their content. Returns results from web, news, and image sources.
  • scrape: Use when you already have a specific URL and want its page content in markdown, HTML, JSON, or other formats.
  • interact: Use when the page needs post-scrape browser actions like clicking, typing, scrolling, or executing code in a live browser session.

Why use it

Search the web for a query and optionally scrape the results. Returns categorized results from web, news, and image sources with optional content extraction.

Preferred SDK method

Example

Parameters

All fields on SearchOptions are Option<T> and default to None via #[derive(Default)].

Convenience method

Sets scrape_options to defaults and returns Vec<Document> directly, filtering out non-document results.

Scrape

Why use it

Scrape a single URL and get its content in one or more formats. Supports browser automation, LLM extraction, screenshots, and more.

Preferred SDK method

Example

Parameters

All fields on ScrapeOptions are Option<T> and default to None via #[derive(Default)].

Actions (enum variants)

Convenience method

Extracts structured JSON using a JSON Schema and optional prompt. Returns serde_json::Value.

Interact

Why use it

Execute code or send natural-language prompts in a live browser session tied to a scrape job. Use for post-scrape interactions like clicking buttons, filling forms, or running scripts.

Preferred SDK method

Example

Parameters

All fields on ScrapeExecuteOptions are Option<T> and default to None. At least one of code or prompt must be a non-empty string, or a FirecrawlError::Misuse is returned before any HTTP call. Use client.stop_interaction(job_id).await? to end the browser session.

Notes

  • Naming style: All struct fields use snake_case. Serde handles the camelCase conversion for the API.
  • Deprecated aliases: scrape_execute() is deprecated in favor of interact(). stop_interactive_browser() and delete_scrape_browser() are deprecated in favor of stop_interaction().
  • Async: All methods are async and require a tokio runtime.
  • Error handling: All methods return Result<T, FirecrawlError>.

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-docs/api-reference/v2-openapi.json