Firecrawl Elixir Agent Quickstart
This file is the canonical quickstart for external agents integrating Firecrawl with Elixir. Generated from SDK source (firecrawl hex package v1.9) and the Firecrawl OpenAPI spec.
The Elixir SDK is auto-generated from the Firecrawl OpenAPI spec. Function names match OpenAPI operation IDs.
Install
Add to yourmix.exs:
Authenticate
Configure the API key globally in your application config:
A nil API key is allowed — 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, discover relevant pages. Returns search results with optional scraping of each result.scrape_and_extract_from_url: Start with a URL, get page content in markdown, HTML, or other formats.interact_with_scrape_browser_session: Execute code in a browser session from a prior scrape. Use for post-scrape browser automation.
Search
Why use it
Usesearch_and_scrape when you have a query and want to discover relevant web pages. Optionally scrape each result to get full page content.
Preferred SDK function
Firecrawl.search_and_scrape!(params, opts) raises on error.
Example
Parameters
Parameters are passed as a keyword list. Validated at call time via NimbleOptions.
Return type:
{:ok, %Req.Response{}} or {:error, exception}. The response body is a decoded JSON map.
Scrape
Why use it
Usescrape_and_extract_from_url when you already have a URL and want page content as markdown, HTML, screenshots, structured JSON, or other formats.
Preferred SDK function
Firecrawl.scrape_and_extract_from_url!(params, opts) raises on error.
Example
Parameters
Parameters are passed as a keyword list.
Return type:
{:ok, %Req.Response{}}. The response body data field is a map with "markdown", "html", "metadata", "links", etc.
Interact
Why use it
Useinteract_with_scrape_browser_session to execute code in the browser session from a prior scrape. The scrape must have returned a job ID. Use it for post-scrape automation.
Preferred SDK function
Firecrawl.interact_with_scrape_browser_session!(job_id, params, opts) raises on error.
Example
Parameters
The first argument isjob_id (string). Remaining parameters are passed as a keyword list.
Return type:
{:ok, %Req.Response{}}. Body contains "success", "stdout", "result", "stderr", "exitCode", "killed", "error".
Stop a session
Notes
- Auto-generated from OpenAPI: Function names match OpenAPI operation IDs and are verbose (e.g.
scrape_and_extract_from_urlinstead ofscrape). - snake_case in, camelCase out: Pass snake_case keywords (e.g.
only_main_content: true). They are automatically converted to camelCase JSON keys. - NimbleOptions validation: Parameters are validated at call time. Passing an unrecognized key or wrong type returns
{:error, %NimbleOptions.ValidationError{}}immediately. - Bang variants: Every function
foo/nhas afoo!/nthat raisesFirecrawl.Errorinstead of returning{:error, _}. - No client struct: Unlike other SDKs, there is no connection object to create upfront. A fresh
Reqclient is built per call. - Response bodies are raw JSON maps: No typed response structs — access data via map keys like
response.body["data"]["markdown"]. - No deprecated aliases: The generated client has one function per operation.
- Keyless free tier: Works without an API key (rate-limited per IP).
- Batch scraping:
Firecrawl.scrape_and_extract_from_urls/2is available for batch operations.
Source Of Truth
/firecrawl/apps/elixir-sdk/lib/firecrawl.ex/firecrawl/apps/elixir-sdk/mix.exs/firecrawl-docs/api-reference/v2-openapi.json

