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:- Bundler
- Gem install
Add to your Then run:
Gemfile:Requires Ruby 3.0 or later.
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: ...)
Scraping a URL
To scrape a single URL, use thescrape method.
JSON Extraction
Extract structured JSON via thescrape endpoint by including a json format with a prompt and schema:
Crawling a Website
To crawl a website and wait for completion, usecrawl. It auto-polls until the job finishes.
Start a Crawl
Start a job without waiting usingstart_crawl.
Checking Crawl Status
Check crawl progress withget_crawl_status.
Cancelling a Crawl
Cancel a running crawl withcancel_crawl.
Mapping a Website
Discover links on a site usingmap.
Searching the Web
Search with optional settings usingsearch.
Batch Scraping
Scrape multiple URLs in parallel usingbatch_scrape.
Agent
Run an AI-powered agent withagent.
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:
Error Handling
The SDK raises exceptions under theFirecrawl module.
Are you an AI agent that needs a Firecrawl API key? See firecrawl.dev/agent-onboarding/SKILL.md for automated onboarding instructions.

