Skip to main content

Firecrawl Elixir Agent Quickstart

This file is the canonical quickstart for external agents integrating Firecrawl with Elixir. It is generated from SDK source (:firecrawl hex package v1.10.0) and the Firecrawl OpenAPI spec. The Elixir client is auto-generated from the OpenAPI spec. Function names follow the OpenAPI operation IDs rather than short aliases.

Install

Add to your mix.exs dependencies:

Authenticate

Per-request options override the application config. The API key is optional: scrape, search, and interact fall back to the keyless free tier (rate-limited per IP). All functions accept a trailing keyword list opts that can include:
  • :api_key — override the API key per-request.
  • :base_url — override the base URL (default: "https://api.firecrawl.dev/v2").
  • Any other keys are passed through to Req.

When To Use What

  • search_and_scrape: Use when you start with a query and need discovery. Returns web, news, and/or image results, optionally with scraped content.
  • scrape_and_extract_from_url: Use when you already have a URL and want page content in markdown, HTML, JSON, or other formats.
  • interact_with_scrape_browser_session: Use when the page needs clicks, form fills, or post-scrape browser actions. Runs code in a browser sandbox tied to a scrape job.

Why use it

Search the web programmatically and optionally scrape each result page in a single call. Use it for discovery when you do not yet have specific URLs.

Preferred SDK function

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

Example

Parameters

Passed as a keyword list. The query key is required.

Response

Returns {:ok, %Req.Response{}} with body["data"] containing:
  • "web": list of web results (with full document fields when scrape_options provided).
  • "news": list of news results.
  • "images": list of image results.

Scrape

Why use it

Retrieve page content from a known URL. Returns markdown by default, with options for HTML, JSON extraction, screenshots, and more.

Preferred SDK function

Example

Parameters

Passed as a keyword list. The url key is required.

Response

Returns {:ok, %Req.Response{}} with body["data"] containing document fields matching the requested formats.

Interact

Why use it

Run code in the browser sandbox of an existing scrape job. Use it for post-scrape browser automation: filling forms, clicking buttons, extracting dynamic content.

Preferred SDK function

Example

Parameters

The first argument is the job_id (String). Remaining parameters are passed as a keyword list.

Response

Returns {:ok, %Req.Response{}} with body containing:
  • "success": boolean
  • "cdpUrl": CDP WebSocket URL.
  • "liveViewUrl": read-only live view URL.
  • "interactiveLiveViewUrl": interactive live view URL.
  • "stdout", "result": standard output.
  • "stderr": standard error.
  • "exitCode": process exit code.
  • "killed": whether killed due to timeout.
  • "error": error message.

Companion function

Stops the browser session (sends DELETE /scrape/{jobId}/interact).

Notes

  • OpenAPI-shaped client: The Elixir client is auto-generated from the OpenAPI spec. Function names follow the operationId (e.g. search_and_scrape, scrape_and_extract_from_url, interact_with_scrape_browser_session).
  • Naming: All parameter keys use snake_case atoms (e.g. :only_main_content, :include_tags). The SDK converts to camelCase JSON keys.
  • No prompt support: Unlike the JS, Python, and Rust SDKs, the Elixir SDK interact_with_scrape_browser_session requires code and does not support a prompt parameter for natural-language browser agent instructions.
  • Bang variants: Every function has a ! variant that raises Firecrawl.Error instead of returning {:error, ...}.
  • NimbleOptions validation: All parameters are validated at the SDK level before the request is sent.

Source Of Truth

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