Skip to main content

Firecrawl Elixir Agent Quickstart

Canonical quickstart for external agents integrating with Firecrawl via the Elixir SDK. Generated from SDK source and the OpenAPI spec.

Install

Add to your mix.exs:

Authenticate

Set the API key in application config:
Or pass it per-request via the opts keyword list:
The default base URL is https://api.firecrawl.dev/v2. Override with:
No API key is required — scrape, search, and interact fall back to a keyless free tier (rate-limited per IP).

When To Use What

  • search_and_scrape: Start with a query and discover relevant pages. Returns URLs, titles, descriptions, and optionally scraped content.
  • scrape_and_extract_from_url: You already have a URL and want structured page content — markdown, HTML, screenshots, JSON extraction, etc.
  • interact_with_scrape_browser_session: The page needs post-scrape browser actions — clicking, typing, or executing code in a live browser session.

Why use it

Discover web pages matching a query. Optionally scrape each result for full content in one call.

Preferred SDK method

Firecrawl.search_and_scrape(params, opts \\ []) Bang variant: Firecrawl.search_and_scrape!(params, opts \\ [])

Example

Parameters

All parameters are passed as a keyword list (first argument). Validated at runtime via NimbleOptions.

Scrape

Why use it

Extract structured content from a single URL — markdown, HTML, screenshots, JSON extraction, audio, video, and more.

Preferred SDK method

Firecrawl.scrape_and_extract_from_url(params, opts \\ []) Bang variant: Firecrawl.scrape_and_extract_from_url!(params, opts \\ [])

Example

Parameters

Interact

Why use it

Continue interacting with a live browser session after scraping. Execute code in the browser to click buttons, fill forms, navigate, and extract dynamic content.

Preferred SDK method

Firecrawl.interact_with_scrape_browser_session(job_id, params, opts \\ []) Bang variant: Firecrawl.interact_with_scrape_browser_session!(job_id, params, opts \\ [])

Example

Parameters

The first argument is the job_id (string). The second argument is a keyword list of parameters. Call Firecrawl.stop_interactive_scrape_browser_session(job_id) to end the browser session when done.

Notes

  • OpenAPI-generated client: The Elixir SDK is auto-generated from the OpenAPI spec. Function names mirror the OpenAPI operation IDs.
  • No client constructor: There is no client object/struct. All functions are module-level on Firecrawl.
  • Keyword list parameters: All body parameters are passed as a keyword list using snake_case atoms (e.g. :only_main_content). They are auto-converted to camelCase JSON keys.
  • NimbleOptions validation: Parameters are validated at runtime before any HTTP request. Invalid params return {:error, %NimbleOptions.ValidationError{}}.
  • Bang variants: Every function has a ! variant (e.g. search_and_scrape!) that raises on error instead of returning {:error, _}.
  • Per-request overrides: Pass :api_key and :base_url in the trailing opts keyword list of any function.
  • No prompt for interact: Unlike the Node.js and Python SDKs, the Elixir SDK’s interact function only supports code, not natural-language prompt.
  • Req-based HTTP: The SDK uses Req for HTTP. Any Req option can be passed through via opts.

Source Of Truth

  • SDK source: firecrawl/apps/elixir-sdk/lib/firecrawl.ex
  • OpenAPI spec: firecrawl-docs/api-reference/v2-openapi.json