* docs(sdks): mark the GitHub search method removed The research index GitHub search endpoint was removed after 2026-11-03. Each SDK's GitHub search method now says so in its deprecation marker and docs, and names that SDK's developer search method. Python's FutureWarning carries the same wording. The methods and types stay until each SDK's next major release. The READMEs point to developer search instead of the old method, and the github search category is documented as removed where the JS, Python, Java and Rust docs listed it. Patch releases: JS 4.51.1, Python 4.54.1, Go 1.16.10, Java 1.18.8, PHP 1.16.7, Ruby 1.17.8, Rust 2.21.9, .NET 1.15.2, Elixir 1.12.7. * docs(python-sdk): say search_github now raises FirecrawlError * docs(sdks): tighten the GitHub search removal wording The Rust and Elixir deprecation notes now use the same removal sentence as the other SDKs, and the Elixir bang variant's docs give the same reason. Python's search_github docstrings say the call always raises FirecrawlError with the API's 410. The Java and Rust category docs say github was removed and name the replacement, and the JS score breakdown docs drop a stale note. The PHP and Rust changelog entries move under Changed. The JS and Python READMEs drop their removal callouts and carry the same Developer search note as the other seven.
6.9 KiB
Firecrawl Ruby SDK
Ruby SDK for Firecrawl, the context API for AI agents. Search, scrape, parse, crawl, map, and interact with the web, and run Agent and Monitor jobs on the v2 API.
Prerequisites
- Ruby >= 3.0
Installation
Add to your Gemfile:
gem "firecrawl-sdk", "~> 1.5"
Or install directly:
gem install firecrawl-sdk
Quick Start
require "firecrawl"
# Create a client
client = Firecrawl::Client.new(api_key: "fc-your-api-key")
# Or load from FIRECRAWL_API_KEY environment variable
client = Firecrawl::Client.from_env
# Scrape a single page
doc = client.scrape("https://example.com")
puts doc.markdown
Environment Setup
export FIRECRAWL_API_KEY="fc-your-api-key"
# Optional: custom API URL
export FIRECRAWL_API_URL="http://localhost:3002"
API Reference
Scrape
# Basic scrape
doc = client.scrape("https://example.com")
puts doc.markdown
# Scrape with options
doc = client.scrape("https://example.com",
Firecrawl::Models::ScrapeOptions.new(
formats: ["markdown", "html"],
only_main_content: true,
wait_for: 1000
))
puts doc.html
Video Extraction
Use the video format on supported video URLs, including YouTube and TikTok. The returned video field is a signed URL to the extracted video file.
doc = client.scrape("https://www.youtube.com/watch?v=dQw4w9WgXcQ",
Firecrawl::Models::ScrapeOptions.new(formats: ["video"]))
puts doc.video
Product Extraction
Use the product format on product pages to get structured product data
(title, brand, category, and per-variant price, availability, and images).
It is the deterministic counterpart to the LLM-based json format. The
returned product field contains the extracted fields.
doc = client.scrape("https://example.com/products/widget",
Firecrawl::Models::ScrapeOptions.new(formats: ["product"]))
puts doc.product
Menu Extraction
Use the menu format on restaurant/merchant menu pages to get structured
menu data (merchant profile plus ordered sections, each holding items with
per-item price, availability, images, and dietary information). It is the
deterministic counterpart to the LLM-based json format. The returned menu
field contains the extracted fields.
doc = client.scrape("https://example.com/menu",
Firecrawl::Models::ScrapeOptions.new(formats: ["menu"]))
puts doc.menu
Parse
Upload a local file (html, pdf, docx, etc.) via multipart form data and
parse it synchronously. Parse options intentionally exclude browser-only
features such as change tracking, screenshot, branding, audio, video, product, actions,
wait_for, location, and mobile. The proxy option only accepts "auto" or "basic".
# From disk
file = Firecrawl::Models::ParseFile.from_path("./document.pdf")
# Or from memory
file = Firecrawl::Models::ParseFile.new(
filename: "upload.html",
content: "<html>hi</html>",
content_type: "text/html"
)
doc = client.parse(file,
Firecrawl::Models::ParseOptions.new(formats: ["markdown"]))
puts doc.markdown
List the file formats the parse endpoint accepts. available is false for
formats the deployment can't currently handle (e.g. images when OCR is off).
client.get_parse_formats.each do |f|
puts "#{f.format} (#{f.kind}) #{f.extensions.join(", ")} #{f.mime_types.join(", ")} available=#{f.available}"
end
Crawl
# Crawl with auto-polling (blocks until complete)
job = client.crawl("https://example.com",
Firecrawl::Models::CrawlOptions.new(limit: 50))
job.data.each { |doc| puts doc.markdown }
# Async crawl
response = client.start_crawl("https://example.com",
Firecrawl::Models::CrawlOptions.new(limit: 10))
puts response.id
# Check status
status = client.get_crawl_status(response.id)
puts status.status
# Cancel
client.cancel_crawl(response.id)
Batch Scrape
urls = ["https://example.com/page1", "https://example.com/page2"]
# Batch scrape with auto-polling
job = client.batch_scrape(urls,
Firecrawl::Models::BatchScrapeOptions.new(
options: Firecrawl::Models::ScrapeOptions.new(formats: ["markdown"])
))
job.data.each { |doc| puts doc.markdown }
Map
# Discover URLs on a website
result = client.map("https://example.com")
result.links.each { |link| puts link["url"] }
# With options
result = client.map("https://example.com",
Firecrawl::Models::MapOptions.new(limit: 100, search: "blog"))
Search
# Web search
results = client.search("firecrawl web scraping")
results.web&.each { |r| puts r["url"] }
# With options
results = client.search("latest news",
Firecrawl::Models::SearchOptions.new(limit: 5, location: "US"))
Developer Search
Search public repositories, GitHub issues, merged pull requests, READMEs and code documentation. It replaces the research index GitHub search, which was removed after 2026-11-03.
response = client.developer_search(
"retry an http request with exponential backoff",
Firecrawl::Models::DeveloperSearchOptions.new(
k: 5,
types: ["issue", "pull_request"],
repos: ["square/okhttp"]
)
)
response.results.each do |result|
puts "#{result.title} #{result.url}"
end
Agent
# Run an AI agent task (blocks until complete)
status = client.agent(
Firecrawl::Models::AgentOptions.new(
prompt: "Find the pricing information",
urls: ["https://example.com"]
))
puts status.data
# Use Alexandria data providers connected in the dashboard
status = client.agent(
Firecrawl::Models::AgentOptions.new(
prompt: "Find the work email of the CEO of example.com",
exchange: Firecrawl::Models::AgentExchangeOptions.new(
enabled: true,
toolkits: ["apollo"]
)
))
puts status.exchange&.paid_calls
Usage & Metrics
# Check concurrency
concurrency = client.get_concurrency
puts concurrency.concurrency
# Check credit usage
usage = client.get_credit_usage
puts usage.remaining_credits
Configuration
client = Firecrawl::Client.new(
api_key: "fc-your-api-key",
api_url: "https://api.firecrawl.dev", # custom API URL
timeout: 300, # HTTP timeout in seconds
max_retries: 3, # automatic retries
backoff_factor: 0.5 # exponential backoff factor
)
Error Handling
begin
doc = client.scrape("https://example.com")
rescue Firecrawl::AuthenticationError => e
puts "Invalid API key: #{e.message}"
rescue Firecrawl::RateLimitError => e
puts "Rate limited: #{e.message}"
rescue Firecrawl::JobTimeoutError => e
puts "Job #{e.job_id} timed out after #{e.timeout_seconds}s"
rescue Firecrawl::FirecrawlError => e
puts "Error (#{e.status_code}): #{e.message}"
end
Development
Building from Source
cd apps/ruby-sdk
bundle install
Running Tests
# Unit tests
bundle exec rake test
# With API key for E2E tests
FIRECRAWL_API_KEY=fc-your-key bundle exec rake test
License
MIT License - see LICENSE.