Skip to main content

Firecrawl Elixir Agent Quickstart

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

Install

Add to your mix.exs dependencies:
Then run:

Authenticate

Set the API key in application config:
Or pass it per-request:
Omitting the key uses the keyless free tier (rate-limited per IP). Per-request options (second keyword list):

When To Use What

  • search_and_scrape: Use when you start with a query and need to discover relevant pages. Returns ranked results with optional scraping.
  • scrape_and_extract_from_url: Use when you already have a URL and want its content in markdown, HTML, JSON, or other formats.
  • interact_with_scrape_browser_session: Use when a page needs post-scrape browser actions — clicking, filling forms, running code in the browser sandbox.

Why use it

Search the web for a query and get back ranked results. Optionally scrape each result page inline by passing scrape_options.

Preferred SDK method

Bang variant search_and_scrape!/2 raises on error.

Example

Parameters

All parameters are passed as a keyword list. All are optional except query. Returns: {:ok, Req.Response.t()} or {:error, Exception.t()}. The response body contains "data" with "web", "news", and "images" lists.

Scrape

Why use it

Scrape a single URL and get its content as markdown, HTML, structured JSON, screenshots, or other formats.

Preferred SDK method

Bang variant scrape_and_extract_from_url!/2 raises on error.

Example

Parameters

All parameters are passed as a keyword list. All are optional except url. Returns: {:ok, Req.Response.t()} or {:error, Exception.t()}. The response body contains "data" with "markdown", "html", "links", "metadata", etc.

Interact

Why use it

Execute code in the browser session of a previous scrape job. Use this for clicking buttons, filling forms, navigating multi-step flows, or running arbitrary JavaScript/Python/Bash in the browser sandbox.

Preferred SDK method

Bang variant interact_with_scrape_browser_session!/3 raises on error.

Example

Parameters

Returns: {:ok, Req.Response.t()} with body containing "success", "stdout", "stderr", "result", "exitCode", "killed", "error". Stop the session:

Notes

  • All parameter names use snake_case (e.g. only_main_content, skip_tls_verification). The SDK converts them to camelCase JSON keys internally.
  • Parameters are passed as keyword lists, not maps.
  • The SDK is auto-generated from the OpenAPI spec. Function names match the OpenAPI operation IDs closely.
  • The interact_with_scrape_browser_session function only supports code, not prompt (natural-language browser instruction). Use code to execute scripts directly.
  • Proxy values are atoms (:basic, :enhanced, :auto), not strings.
  • Every function has a bang variant (!) that raises instead of returning {:error, ...}.
  • There are no deprecated aliases in the Elixir SDK.

Source Of Truth

  • firecrawl/apps/elixir-sdk/lib/firecrawl.ex
  • firecrawl/apps/elixir-sdk/mix.exs
  • firecrawl-docs/api-reference/v2-openapi.json