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 and OpenAPI spec.

Install

Add to mix.exs:
Then run:

Authenticate

Set the API key globally in your config:
Or pass it per-request:
All functions accept an optional trailing keyword list (opts) that supports :api_key and :base_url (for self-hosted instances, default "https://api.firecrawl.dev/v2").

When To Use What

  • search_and_scrape: Use when you start with a query and need to discover relevant URLs and their content.
  • scrape_and_extract_from_url: Use when you already have a specific URL and want its page content in markdown, HTML, JSON, or other formats.
  • interact_with_scrape_browser_session: Use when the page needs post-scrape browser actions like clicking, typing, scrolling, or executing code in a live browser session.

Why use it

Search the web for a query and optionally scrape the results. Returns categorized results from web, news, and image sources with optional content extraction.

Preferred SDK method

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

Example

Parameters

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

Scrape

Why use it

Scrape a single URL and get its content in one or more formats. Supports browser automation, LLM extraction, screenshots, and more.

Preferred SDK method

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

Example

Parameters

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

Interact

Why use it

Execute code in a live browser session tied to a scrape job. Use 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 (string). Remaining parameters are passed as a keyword list. Use Firecrawl.stop_interactive_scrape_browser_session(job_id) to end the browser session.

Notes

  • Naming style: Parameters use snake_case atom keys. The SDK converts them to camelCase JSON keys automatically.
  • OpenAPI-generated: The Elixir SDK is auto-generated from the OpenAPI spec. Function names match the OpenAPI operation IDs directly (e.g. scrape_and_extract_from_url, not scrape).
  • Return type: All functions return {:ok, %Req.Response{}} or {:error, exception}. The bang variants (!) raise on error and return Req.Response.t() directly. HTTP 4xx/5xx responses raise Firecrawl.Error with :status and :body fields.
  • No prompt support: Unlike JS/Python/Rust, the Elixir SDK interact_with_scrape_browser_session only accepts code, not a natural-language prompt.
  • Origin auto-injection: The SDK automatically injects "origin": "elixir-sdk@{version}" into every request body.

Source Of Truth

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