Skip to main content

Firecrawl Elixir Agent Quickstart

This is the canonical quickstart for external agents using the Firecrawl Elixir SDK. It covers search, scrape, and interact — the three endpoints agents need most. Generated from SDK source (:firecrawl hex package v1.x) and the Firecrawl OpenAPI spec. The Elixir SDK is auto-generated from the OpenAPI spec. Function names map directly to the API operations. Every function has a bang (!) variant that raises on error instead of returning {:error, ...} tuples.

Install

Add :firecrawl to your dependencies in mix.exs:
Configure your API key in config/config.exs:

Authenticate

The API key is read from application config by default. You can also pass it per-request:
For self-hosted instances, set base_url:
A nil or empty API key is allowed — scrape, search, and interact fall back to a keyless free tier (rate-limited per IP).

When To Use What

  • search_and_scrape — Start here when you have a query and need to discover relevant URLs and content from the web.
  • scrape_and_extract_from_url — Use when you already have a specific URL and want its page content as markdown, HTML, structured JSON, or other formats.
  • interact_with_scrape_browser_session — Use after a scrape when the page needs further browser actions: running code in the live browser session.

Why use it

Search the web with a natural-language query and get back structured results with URLs, titles, descriptions, and optionally full scraped content for each result.

Preferred SDK method

Example

Parameters

Parameters are passed as a keyword list. All use snake_case. Return type: {:ok, %Req.Response{}} with body containing "data" map with "web", "news", "images", "tools" keys.

Scrape

Why use it

Fetch a single URL and get back clean markdown, HTML, structured JSON, screenshots, or other formats.

Preferred SDK method

Example

Parameters

Parameters are passed as a keyword list. All use snake_case.

Interact

Why use it

Continue interacting with the same browser state from a previous scrape. Execute code in the live browser session — useful for clicking buttons, filling forms, navigating SPAs, or extracting data that requires interaction.

Preferred SDK method

Example

Parameters

Stop method: Firecrawl.stop_interactive_scrape_browser_session(job_id) — call this to end the browser session when done.

Notes

  • The Elixir SDK is auto-generated from the OpenAPI spec. Function names are verbose and map directly to API operations.
  • All parameters use snake_case (e.g. only_main_content, include_tags, scrape_options).
  • Parameters are validated at runtime with NimbleOptions — you get clear errors for typos and invalid options before any request is made.
  • Every function returns {:ok, %Req.Response{}} or {:error, exception}. Use bang variants (!) to raise on error.
  • The interact_with_scrape_browser_session function takes code as a required parameter. Unlike JS/Python/Rust, there is no separate prompt parameter in the generated SDK — to use the AI browser agent with a natural-language prompt, use the API directly or pass prompt via a raw map.
  • Any Req options not consumed by :api_key or :base_url are passed through to the underlying HTTP request.
  • An origin field ("elixir-sdk@{version}") is injected into every request body for SDK telemetry.

Source Of Truth

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