Skip to main content

Firecrawl Elixir Agent Quickstart

Canonical quickstart for external agents. Generated from SDK source (:firecrawl v1.11.0) and the v2 OpenAPI spec.

Install

Add to mix.exs:

Authenticate

Every function accepts a trailing opts keyword list supporting :api_key (override the global key) and :base_url (override the default https://api.firecrawl.dev/v2). Omitting api_key uses the keyless free tier.

When To Use What

  • search — start with a query and need discovery. Returns ranked results you can then scrape.
  • scrape — you already have a URL and want page content in one or more formats.
  • interact — the page needs clicks, forms, or post-scrape browser actions. Requires a scrape job ID from a prior scrape.

Why use it

Discover relevant pages from a query. Constrain to a site with site: in the query string (e.g. site:docs.firecrawl.dev crawl webhooks).

Preferred SDK method

Firecrawl.search_and_scrape(params \\ [], opts \\ []) → {:ok, Req.Response.t()} | {:error, Exception.t()}

Example

Parameters

All parameters are keyword list entries. The SDK validates them at compile time via NimbleOptions and converts snake_case keys to camelCase JSON.

Scrape

Why use it

Get structured content from a URL in one or more formats — markdown, HTML, JSON extraction, screenshots, and more.

Preferred SDK method

Firecrawl.scrape_and_extract_from_url(params \\ [], opts \\ []) → {:ok, Req.Response.t()} | {:error, Exception.t()}

Example

Parameters

Interact

Why use it

Run code in the browser session tied to a scrape job. The Elixir SDK exposes code-based interactions only (no prompt parameter — use the Node.js, Python, or Rust SDK for natural-language browser control).

Preferred SDK method

Firecrawl.interact_with_scrape_browser_session(job_id, params \\ [], opts \\ []) → {:ok, Req.Response.t()} | {:error, Exception.t()}

Example

Parameters

Stop session: Firecrawl.stop_interactive_scrape_browser_session(job_id, opts \\ []) — issues DELETE /scrape/{jobId}/interact.

Notes

  • The Elixir client is auto-generated from the OpenAPI spec. Function names and parameter keys are generated, not hand-written.
  • All parameters use snake_case keyword lists. The SDK converts to camelCase JSON automatically.
  • Every function has a bang (!) variant that raises on error instead of returning {:error, _} (e.g. Firecrawl.scrape_and_extract_from_url!).
  • No struct-based client — a fresh Req HTTP client is built per request.
  • SDK auto-injects "origin": "elixir-sdk@1.11.0" into all request bodies.
  • Atom values (like :node, :basic) are automatically converted to strings before JSON serialization.
  • Nested keyword lists are recursively converted to camelCased maps.

Source Of Truth

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