Skip to main content

Firecrawl Elixir Agent Quickstart

Canonical quickstart for external agents integrating with Firecrawl using the Elixir SDK. Generated from SDK source and OpenAPI spec.

Install

Add to your mix.exs dependencies:
Then run:

Authenticate

Configure the API key in your application config:
Or pass the API key per-call via the opts keyword list:
The API key is sent as a Bearer token. A nil or empty key falls back to the keyless free tier (rate-limited per IP). You can also override the base URL per-call:

When To Use What

  • search_and_scrape: You start with a query and need to discover relevant URLs and their content. Use when you don’t have a specific URL yet.
  • scrape_and_extract_from_url: You already have a URL and want its page content as markdown, HTML, or structured JSON. Use for targeted extraction.
  • interact_with_scrape_browser_session: The page needs clicks, form fills, or other browser actions after an initial scrape. Use for multi-step browser automation.

Why use it

Search the web for a query and optionally scrape the results. Returns structured results grouped by source type (web, news, images). Use this when you need to discover relevant pages before extracting content.

Preferred SDK method

Bang variant search_and_scrape!/2 raises on error instead of returning {:error, ...}.

Example

Parameters

All parameters are passed as a keyword list. Required parameters are marked.

Scrape

Why use it

Scrape a single URL and get its content as markdown, HTML, screenshots, structured JSON, or other formats. The primary tool for extracting page content when you already know the URL.

Preferred SDK method

Bang variant scrape_and_extract_from_url!/2 raises on error.

Example

Parameters

Interact

Why use it

Execute code in the browser session created by a prior scrape. Use this for multi-step workflows: scrape a page first to get a job ID, then interact with the live browser to click buttons, fill forms, or run JavaScript.

Preferred SDK method

Bang variant interact_with_scrape_browser_session!/3 raises on error.

Example

Parameters

The response body includes: Call Firecrawl.stop_interactive_scrape_browser_session(job_id) to end the session.

Notes

  • The Elixir SDK is auto-generated from the OpenAPI spec via mix run generate.exs. Function names match the OpenAPI operation IDs converted to snake_case.
  • Function names are longer than other SDKs because they follow the OpenAPI operation IDs: scrape_and_extract_from_url (not scrape), search_and_scrape (not search), interact_with_scrape_browser_session (not interact).
  • All parameters use snake_case in Elixir. The SDK converts to camelCase for the API wire format.
  • Enum values are passed as atoms: proxy: :auto, language: :node.
  • All functions return {:ok, %Req.Response{}} or {:error, exception}. Use bang variants (!) to raise instead.
  • HTTP 4xx/5xx responses are wrapped in Firecrawl.Error with status and body fields.
  • Parameters are validated at runtime via NimbleOptions. Invalid params return {:error, %NimbleOptions.ValidationError{}}.
  • The Elixir SDK’s interact_with_scrape_browser_session does not support a prompt parameter (unlike Node.js, Python, and Rust). Use code with the appropriate language.
  • There are no deprecated aliases in the Elixir SDK.

Source Of Truth

  • SDK: firecrawl/apps/elixir-sdk/lib/firecrawl.ex
  • OpenAPI: firecrawl-docs/api-reference/v2-openapi.json