Skip to main content

Firecrawl Node.js Agent Quickstart

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

Install

Requires Node.js >= 22.

Authenticate

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:, for example site:docs.firecrawl.dev crawl webhooks.

Preferred SDK method

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

Example

Wrong turn to avoid: search() does not return { data: [...] }. Web results are in result.web, news in result.news, images in result.images.

Parameters

Scrape

Why use it

Fetch structured content from a URL in one or more formats. Use when you already have the URL.

Preferred SDK method

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

Example

Parameters

Format options: String formats: "markdown", "html", "rawHtml", "links", "images", "screenshot", "summary", "changeTracking", "attributes", "branding", "audio", "video". Object formats:
  • { type: "json", prompt?: string, schema?: object } — at least one of prompt or schema required.
  • { type: "question", question: string } — question-answer extraction.
  • { type: "highlights", query: string } — relevant source-text extraction.
  • { type: "screenshot", fullPage?: boolean, quality?: number, viewport?: { width, height } }
  • { type: "changeTracking", modes: ("git-diff" | "json")[], schema?, prompt?, tag? }modes required.
  • { type: "attributes", selectors: { selector: string, attribute: string }[] }

Interact

Why use it

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

Preferred SDK method

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

Example

Parameters

At least one of code or prompt must be provided. Stop session: client.stopInteraction(jobId) ends the browser session. Returns { success, sessionDurationMs?, creditsBilled?, error? }.

Notes

  • Deprecated aliases: scrapeExecuteinteract; stopInteractiveBrowser / deleteScrapeBrowserstopInteraction.
  • The default Firecrawl export is the v2 client; v1 remains under client.v1.
  • Zod schemas passed in formats (for json or changeTracking) are auto-converted to JSON Schema by the SDK, and the return type narrows accordingly.
  • The SDK auto-resumes scrapes for large documents (PDFs) that outlive the request window (up to 5 retries / 20 minutes).
  • The package declares Node.js >= 22 in engines.

Source Of Truth

  • firecrawl/apps/js-sdk/firecrawl/package.json
  • 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