Installation#
The official Ruby SDK is maintained in the Firecrawl monorepo at apps/ruby-sdk.
To install the Firecrawl Ruby SDK, add it to your project:
Add to your Gemfile:
Then run:
Usage#
- Get an API key from firecrawl.dev
- Set the API key as an environment variable named
FIRECRAWL_API_KEY, or pass it directly withFirecrawl::Client.new(api_key: ...)
Here is a quick example using the current SDK API surface:
Scraping a URL#
To scrape a single URL, use the scrape method.
JSON Extraction#
Extract structured JSON via the scrape endpoint by including a json format with a prompt and schema:
Crawling a Website#
To crawl a website and wait for completion, use crawl. It auto-polls until the job finishes.
Start a Crawl#
Start a job without waiting using start_crawl.
Checking Crawl Status#
Check crawl progress with get_crawl_status.
Cancelling a Crawl#
Cancel a running crawl with cancel_crawl.
Mapping a Website#
Discover links on a site using map.
Searching the Web#
Search with optional settings using search.
Batch Scraping#
Scrape multiple URLs in parallel using batch_scrape.
Agent#
Run an AI-powered agent with agent.
With a JSON schema for structured output:
Usage & Metrics#
Check concurrency and remaining credits:
Browser#
The Ruby SDK includes Browser Sandbox helpers.
Scrape-Bound Interactive Session#
Use a scrape job ID to run follow-up browser code in the same replayed context:
interact(...)runs code in the scrape-bound browser session (and initializes it on first use).stop_interactive_browser(...)explicitly stops the interactive session when you are done.
Configuration#
Firecrawl::Client.new supports the following options:
| Option | Type | Default | Description |
|---|---|---|---|
api_key | String | FIRECRAWL_API_KEY env var | Your Firecrawl API key |
api_url | String | https://api.firecrawl.dev (or FIRECRAWL_API_URL) | API base URL |
timeout | Integer | 300 | HTTP request timeout in seconds |
max_retries | Integer | 3 | Automatic retries for transient failures |
backoff_factor | Float | 0.5 | Exponential backoff factor in seconds |
Error Handling#
The SDK raises exceptions under the Firecrawl module.
Are you an AI agent that needs a Firecrawl API key? See firecrawl.dev/agent-onboarding/SKILL.md for automated onboarding instructions.

