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
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 ascrapeIdfrom a prior scrape.
Search
Why use it
Discover relevant pages from a query, then pick URLs to scrape or interact with. Constrain results to a site withsite:, for example site:docs.firecrawl.dev crawl webhooks.
Preferred SDK method
client.search(query, options?) → Promise<SearchData>
Example
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 ofpromptorschemarequired.{ 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? }—modesrequired.{ 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. RequiresscrapeId 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:
scrapeExecute→interact;stopInteractiveBrowser/deleteScrapeBrowser→stopInteraction. - The default
Firecrawlexport is the v2 client; v1 remains underclient.v1. - Zod schemas passed in
formats(forjsonorchangeTracking) 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.jsonfirecrawl/apps/js-sdk/firecrawl/src/index.tsfirecrawl/apps/js-sdk/firecrawl/src/v2/client.tsfirecrawl/apps/js-sdk/firecrawl/src/v2/types.tsfirecrawl-docs/api-reference/v2-openapi.json

