Skip to main content

Firecrawl Node.js Agent Quickstart

Canonical quickstart for external agents. Generated from SDK source (firecrawl JS SDK) and the v2 OpenAPI spec. Method names and parameters match the SDK public API.

Install

Authenticate

Constructor options: apiKey (falls back to FIRECRAWL_API_KEY env var), apiUrl (falls back to FIRECRAWL_API_URL or https://api.firecrawl.dev), timeoutMs, maxRetries, backoffFactor.

When To Use What

  • search: use when you start with a query and need discovery.
  • scrape: use when you already have a URL and want page content.
  • interact: use when the page needs clicks, forms, or post-scrape browser actions. Requires a scrapeId from a prior scrape.

Why use it

Discover relevant pages from a query, then pick URLs to scrape or interact with. Constrain results to a site with site: in the query.

Preferred SDK method

client.search(query, options?)Promise<SearchData>

Example

Important: search() does not return { data: [...] }. Results are in results.web, results.news, results.images.

Parameters

Scrape

Why use it

Get structured content from a URL in one or more formats.

Preferred SDK method

client.scrape(url, options?)Promise<Document>

Example

Parameters

Interact

Why use it

Control the browser session tied to a prior scrape. Use for clicks, form fills, code execution, or natural-language instructions. Requires a scrapeId from document.metadata.scrapeId.

Preferred SDK method

client.interact(jobId, args)Promise<ScrapeExecuteResponse>

Example

Parameters

Stop the session with client.stopInteraction(jobId).

Notes

  • Deprecated aliases: scrapeUrlscrape, scrapeExecuteinteract, stopInteractiveBrowser / deleteScrapeBrowserstopInteraction.
  • The default Firecrawl export is the v2 client. V1 remains under client.v1.
  • Plain string "json" in formats is rejected by the SDK — use { type: "json", prompt: "..." }.
  • search() returns SearchData with .web, .news, .images — not .data.

Source Of Truth

  • firecrawl/apps/js-sdk/firecrawl/src/index.ts
  • firecrawl/apps/js-sdk/firecrawl/src/v2/client.ts
  • firecrawl/apps/js-sdk/firecrawl/src/v2/types.ts
  • firecrawl-docs/api-reference/v2-openapi.json