Skip to main content

Firecrawl Elixir Agent Quickstart

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

Install

Add to your mix.exs:
Then run:

Authenticate

Configure via application config:
Or pass the API key per-request via the opts keyword:
For self-hosted instances, set the base URL:
The default base URL is "https://api.firecrawl.dev/v2". Omitting the API key enables the keyless free tier (rate-limited per IP).

When To Use What

  • search_and_scrape — Use when you start with a query and need to discover relevant URLs and their content. Returns categorized results from web, news, and images.
  • scrape_and_extract_from_url — Use when you already have a URL and want to extract page content in structured formats (markdown, HTML, JSON, screenshots, etc.).
  • interact_with_scrape_browser_session — Use when the page needs post-scrape browser actions: running code in the live browser session.

Why use it

Search finds relevant pages across the web for a given query, optionally scraping the results. It returns results grouped by source type.

Preferred SDK function

Example

The bang variant raises Firecrawl.Error on failure:

Parameters

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

Scrape

Why use it

Scrape extracts content from a single URL and returns it in one or more formats: markdown, HTML, raw HTML, JSON (via schema), screenshots, links, images, audio, video, and more.

Preferred SDK function

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 that was opened by a prior scrape call. Use it for clicking buttons, filling forms, navigating multi-step flows, or extracting dynamic content.

Preferred SDK function

Example

Parameters

The job_id is passed as the first positional argument. Remaining parameters are a keyword list.

Stopping a session

Notes

  • Naming style: Function names and parameters use snake_case, matching Elixir conventions. The SDK converts to camelCase for the API 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 rather than just scrape).
  • Return values: Regular functions return {:ok, response} or {:error, %Firecrawl.Error{}}. Bang variants (!) return the response directly or raise.
  • No deprecated aliases: The Elixir SDK does not have deprecated method aliases.
  • Per-request options: The trailing opts keyword list can include api_key: and base_url: to override the application config for a single request.
  • Origin: The SDK automatically injects "elixir-sdk@{version}" as the origin in 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