Skip to main content

Firecrawl Elixir Agent Quickstart

Canonical quickstart for external agents integrating Firecrawl with Elixir. Generated from SDK source (:firecrawl hex package) and the Firecrawl OpenAPI spec.

Install

Dependencies: req ~> 0.5, nimble_options ~> 1.1.

Authenticate

There is no client struct or constructor. Auth is configured via application config or per-request options. Application config:
Per-request override:
Additional options: All remaining opts in the second argument are passed through to Req.

When To Use What

  • search_and_scrape: Start with a query and discover relevant URLs and content from the web.
  • scrape_and_extract_from_url: You already have a URL and want page content as markdown, HTML, structured JSON, or other formats.
  • interact_with_scrape_browser_session: The page needs post-scrape browser interaction — clicks, form fills, or code execution.

Why use it

Search takes a natural-language query and returns web, news, or image results with optional scraping of each result page. Use it for discovery when you don’t have a specific URL.

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 extracts content from a known URL in your choice of formats — markdown, HTML, structured JSON, screenshots, and more. Use it when you have the URL and need the page content.

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

Interact runs code in the browser session of a scrape job. Use it after scraping a page when you need to click buttons, fill forms, navigate, or perform post-load browser actions.

Preferred SDK method

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

Example

Parameters

The first argument is the job_id (string). Remaining parameters are a keyword list. Note: The Elixir SDK does not support the prompt parameter for interact. Use code to execute browser commands directly.

Notes

  • Auto-generated from OpenAPI: The Elixir SDK is auto-generated from the Firecrawl OpenAPI spec. Function names follow the OpenAPI operation IDs exactly.
  • Keyword list parameters: All params are Elixir keyword lists, validated at runtime by NimbleOptions. Invalid keys are rejected with descriptive errors.
  • snake_case to camelCase: All Elixir parameters use snake_case. The SDK converts them to camelCase JSON keys automatically (e.g. only_main_contentonlyMainContent).
  • Atom values become strings: Atom values like :basic for proxy are converted to their string equivalents in JSON.
  • Origin auto-injected: Every request body includes "origin": "elixir-sdk@{version}" for telemetry.
  • Bang variants: Every function has a ! variant (e.g. scrape_and_extract_from_url!) that raises Firecrawl.Error on HTTP 4xx/5xx responses instead of returning {:error, ...}.
  • No prompt for interact: Unlike the Node.js, Python, and Rust SDKs, the Elixir SDK only accepts code for interact, not natural-language prompt.
  • No deprecated aliases: The auto-generated SDK has no deprecated function aliases.

Source Of Truth

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