Skip to main content

Firecrawl Elixir Agent Quickstart

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

Install

Add to your mix.exs:

Authenticate

The Elixir SDK is a flat module of stateless functions — there is no client struct to construct. Configure the API key globally or pass it per request. Global config (in config.exs):
Per-request override:
All functions accept trailing opts for :api_key and :base_url (defaults to https://api.firecrawl.dev/v2).

When To Use What

  • search_and_scrape — Use when you start with a query and need to discover relevant pages. Returns structured results grouped by source type. Optionally scrapes each result.
  • scrape_and_extract_from_url — Use when you already have a URL and want page content in one or more formats (markdown, HTML, JSON extraction, etc.).
  • interact_with_scrape_browser_session — Use when the page needs post-scrape browser actions: running code in a live browser session tied to a previous scrape job.

Why use it

Search the web for a query and optionally scrape each result. Returns results grouped by source type. Use this as the starting point when you do not yet have a specific URL.

Preferred SDK method

Bang variant: Firecrawl.search_and_scrape!(params, opts) raises on error.

Example

Parameters

Parameters are passed as a keyword list. All are optional except query.

Return shape

{:ok, %Req.Response{}} — the response body contains results grouped by source type.

Scrape

Why use it

Scrape a single URL and get its content in one or more formats. Use this when you have the exact URL you want content from.

Preferred SDK method

Bang variant: Firecrawl.scrape_and_extract_from_url!(params, opts) raises on error.

Example

Parameters

Parameters are passed as a keyword list. All are optional except url.

Interact

Why use it

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

Preferred SDK method

Bang variant: Firecrawl.interact_with_scrape_browser_session!(job_id, params, opts) raises on error.

Example

Parameters

The first argument is the job_id (path parameter). Remaining parameters are passed as a keyword list.
  • Firecrawl.stop_interactive_scrape_browser_session(job_id, opts) — Stop the browser session (DELETE /scrape/{jobId}/interact).

Notes

  • The SDK is auto-generated from the OpenAPI spec. Function names map 1:1 to OpenAPI operations.
  • Parameter names use snake_case in Elixir. They are converted to camelCase for the JSON wire format automatically.
  • All functions return {:ok, %Req.Response{}} | {:error, Exception.t() | Firecrawl.Error.t()}.
  • Bang variants (e.g. search_and_scrape!) raise on error instead of returning an error tuple.
  • There is no client struct — the module is a flat namespace of stateless functions.
  • HTTP errors (4xx/5xx) are wrapped in Firecrawl.Error with :status and :body fields.
  • Batch scraping is available via Firecrawl.scrape_and_extract_from_urls/2 (POST /batch/scrape).

Source Of Truth

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