Skip to main content

Firecrawl Elixir Agent Quickstart

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

Install

Add to your mix.exs dependencies:
Then run:

Authenticate

Pass the API key as a runtime option on each call:
To use a self-hosted instance:

When To Use What

  • search_and_scrape: Use when you start with a query and need to discover relevant pages across the web.
  • scrape_and_extract_from_url: Use when you already have a URL and want its content (markdown, HTML, structured data, screenshots, etc.).
  • interact_with_scrape_browser_session: Use when a page needs post-scrape browser actions — clicking, filling forms, executing code in a live browser session.

Why use it

Search the web for a query and optionally scrape each result in one call. Returns results grouped by source type (web, news, images).

Preferred SDK function

The bang variant (!) raises on error instead of returning {:error, ...}.

Example

Parameters

Parameters are a keyword list (first argument).

Return type

{:ok, %Req.Response{}} or {:error, exception}. The response body contains "data" with "web", "news", "images" arrays.

Scrape

Why use it

Scrape a single URL and get back clean markdown, HTML, structured JSON, screenshots, or other formats. Supports browser actions, location targeting, and caching.

Preferred SDK function

Example

Parameters

Parameters are a keyword list (first argument).

Return type

{:ok, %Req.Response{}} or {:error, exception}. The response body "data" contains the scraped document fields.

Interact

Why use it

Run code in the live browser session of an existing scrape job. Use it for clicks, form fills, navigation, or any post-scrape browser automation.

Preferred SDK function

Example

Parameters

Return type

{:ok, %Req.Response{}} or {:error, exception}. The response body contains .success, .stdout, .result, .stderr, .exitCode, .error.

Stopping a session

Notes

  • Naming style: All parameters use snake_case atoms in keyword lists. The SDK serializes to camelCase for the API.
  • OpenAPI-generated: The Elixir SDK is generated from the OpenAPI spec. Function names reflect the API operation IDs rather than shortened aliases.
  • Function naming:
    • Search: search_and_scrape (not search)
    • Scrape: scrape_and_extract_from_url (not scrape)
    • Interact: interact_with_scrape_browser_session (not interact)
    • Stop interaction: stop_interactive_scrape_browser_session
  • Bang variants: Every function has a ! variant that raises Firecrawl.Error on non-2xx responses instead of returning {:error, ...}.
  • Req-based: The SDK uses the Req HTTP library. Runtime options (second or third argument) accept :api_key, :base_url, and any Req option.
  • No deprecated aliases: The Elixir SDK has no deprecated function names.

Source Of Truth

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