Skip to main content

Firecrawl Elixir Agent Quickstart

This file is the canonical quickstart for external agents integrating Firecrawl via the Elixir SDK. It is generated from SDK source (:firecrawl hex package v1.11.0) and the Firecrawl OpenAPI spec. The Elixir SDK is auto-generated from the OpenAPI spec, so function names are OpenAPI-shaped rather than shorthand.

Install

Add to your mix.exs dependencies:

Authenticate

Per-call option

Omit the key entirely for the free tier (rate-limited per IP). For self-hosted instances, override base_url:

When To Use What

  • scrape_and_extract_from_url: Already have a URL and want to extract page content (markdown, HTML, structured JSON, screenshots, etc.).
  • search_and_scrape: Start with a text query and need to discover relevant URLs and content across the web.
  • interact_with_scrape_browser_session: The page needs post-scrape browser actions — clicking buttons, filling forms, executing code in the live browser session.

Why use it

Search lets you find relevant web pages, news, or images from a query string. Optionally scrape each result in the same call.

Preferred SDK method

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

Example

Parameters

All parameters are passed as a keyword list. Only query is required.

Response shape

Returns {:ok, %Req.Response{}} where response.body contains:

Scrape

Why use it

Scrape fetches a single URL and returns its content in one or more formats: markdown, HTML, structured JSON, screenshots, audio/video extraction, and more.

Preferred SDK method

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

Example

Parameters

All parameters are passed as a keyword list. Only url is required.

Interact

Why use it

Interact lets you execute code in a live browser session tied to a previous scrape job. Use it for clicking elements, filling forms, navigating multi-step flows, or extracting dynamic content.

Preferred SDK method

Bang variant: Firecrawl.interact_with_scrape_browser_session!(job_id, params, opts) To end the session:

Example

Parameters

Response

Returns {:ok, %Req.Response{}} where response.body contains:

Notes

  • Auto-generated SDK: The Elixir SDK is auto-generated from the OpenAPI spec via generate.exs. Function names mirror the OpenAPI operation IDs rather than being shortened.
  • Naming style: Parameters use snake_case in Elixir keyword lists (e.g. only_main_content, include_tags). These are converted to camelCase JSON keys automatically.
  • Return type: All functions return {:ok, %Req.Response{}} or {:error, exception}. Bang variants (!) raise on error.
  • Response data: Access response data via response.body — it is a decoded JSON map, not a struct.
  • Error handling: HTTP 4xx/5xx responses raise Firecrawl.Error (with :status and :body fields) in bang variants, or return {:error, %Firecrawl.Error{}} in non-bang variants.
  • Interact code-only: The Elixir SDK interact_with_scrape_browser_session only accepts code, not prompt, at the time of this writing.

Source Of Truth

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