Skip to main content

Firecrawl Node.js Agent Quickstart

Canonical quickstart for external agents integrating with Firecrawl via the Node.js SDK. Generated from SDK source and the OpenAPI spec.

Install

Requires Node.js 22+.

Authenticate

Or use the FIRECRAWL_API_KEY environment variable:
Constructor accepts a string (API key) or an options object:

When To Use What

  • search: Start with a query and discover relevant pages. Returns URLs, titles, descriptions, and optionally scraped content.
  • scrape: You already have a URL and want structured page content — markdown, HTML, screenshots, JSON extraction, etc.
  • interact: The page needs post-scrape browser actions — clicking, typing, executing code, or natural-language browser instructions.

Why use it

Discover web pages matching a query. Optionally scrape each result for full content in one call.

Preferred SDK method

firecrawl.search(query, options?)

Example

Parameters

Results are grouped by source: results.web, results.news, results.images, results.developer.

Scrape

Why use it

Extract structured content from a single URL — markdown, HTML, screenshots, JSON extraction, audio, video, and more.

Preferred SDK method

firecrawl.scrape(url, options?)

Example

Parameters

Interact

Why use it

Continue interacting with a live browser session after scraping. Execute code or send natural-language prompts to control the page — click buttons, fill forms, navigate, and extract dynamic content.

Preferred SDK method

firecrawl.interact(jobId, args)

Example

Parameters

Call firecrawl.stopInteraction(jobId) to end the browser session when done.

Notes

  • camelCase parameters: All options use camelCase (e.g. onlyMainContent, includeTags, scrapeOptions).
  • Zod schema inference: When using { type: "json", schema: zodSchema } in formats, TypeScript narrows the json return type to z.infer<typeof zodSchema>.
  • SearchData structure: Access results via results.web, results.news, results.images, or results.developer. Accessing results.data throws an error.
  • Timeout arithmetic: The SDK adds 5000ms to the provided timeout for the HTTP request. For interact, timeout is in seconds (converted to ms internally).
  • Deprecated aliases: scrapeExecute -> interact, stopInteractiveBrowser / deleteScrapeBrowser -> stopInteraction, scrapeUrl -> scrape.

Source Of Truth

  • SDK source: firecrawl/apps/js-sdk/firecrawl/src/v2/client.ts, firecrawl/apps/js-sdk/firecrawl/src/v2/types.ts
  • OpenAPI spec: firecrawl-docs/api-reference/v2-openapi.json