Firecrawl Elixir Agent Quickstart
Canonical quickstart for external agents integrating with Firecrawl via the Elixir SDK. Generated from SDK source and OpenAPI spec.Install
Add to yourmix.exs deps:
Authenticate
Set the API key globally via application config:opts keyword list also supports :base_url to override the default https://api.firecrawl.dev/v2 for self-hosted instances.
If no API key is configured, the client operates in keyless free tier mode (rate-limited per IP).
When To Use What
search_and_scrape: Start with a query and discover relevant URLs and content across the web.scrape_and_extract_from_url: You already have a URL and want its page content in a structured format.interact_with_scrape_browser_session: The page needs clicks, form fills, or post-scrape browser actions within an active browser session.
Search
Why use it
Search the web for a query and get structured results grouped by source type. Optionally scrape each result page in the same call by passingscrape_options.
Preferred SDK method
Example
Parameters
Passed as a keyword list. All parameters exceptquery are optional.
Returns
{:ok, %Req.Response{}} or {:error, exception}. The bang variant search_and_scrape! returns %Req.Response{} directly or raises.
Response body is a decoded JSON map. Access results via response.body["data"]["web"], response.body["data"]["news"], response.body["data"]["images"].
Scrape
Why use it
Scrape a single URL and get its content as markdown, HTML, structured JSON, screenshots, or other formats.Preferred SDK method
Example
Parameters
Passed as a keyword list. Onlyurl is required.
Returns
{:ok, %Req.Response{}} or {:error, exception}. Access scraped data via response.body["data"].
Interact
Why use it
Execute code in the browser session associated with a scrape job. Use for post-scrape interactions like clicking buttons, filling forms, or navigating.Preferred SDK method
Example
Parameters
job_id is the first argument (string). Remaining parameters are a keyword list.
Returns
{:ok, %Req.Response{}} or {:error, exception}. Response body contains "success", "stdout", "stderr", "result", "exitCode", "killed", "error".
Call Firecrawl.stop_interactive_scrape_browser_session(job_id) when done to end the browser session.
Notes
- Auto-generated from OpenAPI: The entire Elixir SDK is generated from the OpenAPI spec. Function names are verbose operation-ID-derived names, not hand-crafted Elixir conventions.
- Function name mapping:
scrape->scrape_and_extract_from_urlsearch->search_and_scrapeinteract->interact_with_scrape_browser_sessionstop interaction->stop_interactive_scrape_browser_session
- No struct types in responses: The SDK returns raw
Req.Responsestructs. Work directly with the decoded JSON map viaresponse.body. - NimbleOptions validation: Parameters are validated locally before the HTTP call. Invalid params return
{:error, %NimbleOptions.ValidationError{}}. - Atoms for enums: Enum values can be passed as atoms (e.g.
proxy: :enhanced,language: :python). They are stringified for JSON. - Keyword-list nesting: Nested objects (like
scrape_options,location,profile) are passed as keyword lists and auto-converted to camelCase JSON maps. - Bang variants: Every function has a
!variant that raises on error and returns the response directly. interacthas nopromptparameter: Unlike the JS, Python, and Rust SDKs, the Elixir SDK’s interact function only acceptscode, not natural-language prompts.searchhas a separatecountryparameter: Unlike other SDKs where country is part of a location object, the Elixir SDK exposescountryas a standalone search parameter.- No deprecated aliases: The Elixir SDK has no deprecated function names since all names are generated from OpenAPI operation IDs.
Source Of Truth
firecrawl/apps/elixir-sdk/lib/firecrawl.exfirecrawl/apps/elixir-sdk/mix.exsfirecrawl-docs/api-reference/v2-openapi.json

