Skip to main content

Firecrawl Elixir Agent Quickstart

This file is the canonical quickstart for external agents integrating with Firecrawl via the official Elixir SDK. It is generated from SDK source and the OpenAPI spec. The Elixir SDK is auto-generated from the OpenAPI spec and uses function names that mirror operation IDs.

Install

Add to your mix.exs dependencies:

Authenticate

Configure in config/config.exs:
Or pass api_key as an option to any function call:

When To Use What

  • search_and_scrape — Use when you start with a query and need to discover relevant pages. Returns web results, news, images, and optionally scraped page content.
  • scrape_and_extract_from_url — Use when you already have a URL and want structured page content (markdown, HTML, JSON extraction, screenshots, etc.).
  • interact_with_scrape_browser_session / execute_browser_code — Use when a page needs browser automation — clicks, form fills, or post-scrape dynamic content extraction.

Why use it

Search the web for a query and get results with titles, URLs, descriptions, and optionally full page content. Supports filtering by domain, time range, category, and source type.

Preferred SDK function

Example

Parameters

All parameters are passed as a keyword list. Keys use snake_case and are automatically mapped to camelCase for the API.

Bang variant

Firecrawl.search_and_scrape!(params, opts) — raises on error instead of returning {:error, ...}.

Scrape

Why use it

Scrape a URL and get its content in your chosen format — markdown, HTML, JSON (with schema-based extraction), screenshots, and more. Supports browser actions, caching, proxies, and PDF parsing.

Preferred SDK function

Example

Parameters

Bang variant

Firecrawl.scrape_and_extract_from_url!(params, opts) — raises on error.

Interact

Why use it

The Elixir SDK supports two interact patterns:
  1. Post-scrape interaction — After scraping a page, interact with its browser session using interact_with_scrape_browser_session/3.
  2. Standalone browser session — Create an independent browser session with create_browser_session/2, then execute code with execute_browser_code/3.

Preferred SDK functions

Post-scrape interaction:
Standalone browser session:

Example — Post-scrape interaction

Example — Standalone browser session

Post-scrape interaction parameters

Standalone browser session parameters

create_browser_session: execute_browser_code:

Stopping sessions

  • Post-scrape: Firecrawl.stop_interactive_scrape_browser_session(job_id)
  • Standalone: Firecrawl.delete_browser_session(session_id)

Notes

  • No deprecated aliases exist in the Elixir SDK.
  • Naming style: All parameters use snake_case. The SDK auto-maps to camelCase for the API.
  • Function names are OpenAPI-derived. They mirror operation IDs exactly (e.g. scrape_and_extract_from_url, not scrape).
  • Return type: All functions return {:ok, Req.Response.t()} | {:error, Exception.t()}. Use bang variants (!) to raise on error.
  • Package name: :firecrawl (Hex.pm).
  • Base URL: Defaults to https://api.firecrawl.dev/v2. Override with base_url option.
  • Dependencies: req ~> 0.5, nimble_options ~> 1.1.

Source Of Truth

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