Skip to main content

Advanced Scraping Guide

Configure scrape options, browser actions, crawl, map, and the agent endpoint with Firecrawl's full API surface.
10 min read

Reference for every option across Firecrawl's scrape, crawl, map, and agent endpoints.

Basic scraping#

To scrape a single page and get clean markdown content, use the /scrape endpoint.

Scraping PDFs#

Firecrawl supports PDFs. Use the parsers option (e.g., parsers: ["pdf"]) when you want to ensure PDF parsing. You can control the parsing strategy with the mode option:

  • auto (default) — attempts fast text-based extraction first, then falls back to OCR if needed.
  • fast — text-based parsing only (embedded text). Fastest, but skips scanned/image-heavy pages.
  • ocr — forces OCR parsing on every page. Use for scanned documents or when auto misclassifies a page.

{ type: "pdf" } and "pdf" both default to mode: "auto".

Scrape options#

When using the /scrape endpoint, you can customize the request with the following options.

Formats (formats)#

The formats array controls which output types the scraper returns. Default: ["markdown"].

String formats: pass the name directly (e.g. "markdown").

FormatDescription
markdownPage content converted to clean Markdown.
htmlProcessed HTML with unnecessary elements removed.
rawHtmlOriginal HTML exactly as returned by the server.
rawBase64Base64-encoded original HTTP response body, as a bare Base64 string. Must be the only format in the request. The MIME type is in metadata.contentType.
linksAll links found on the page.
imagesAll images found on the page.
summaryAn LLM-generated summary of the page content.
brandingExtracts brand identity (colors, fonts, typography, spacing, UI components).
productExtracts a structured product (title, price, availability, images, variants) from product pages via multi-source structured data.

Object formats: pass an object with type and additional options.

FormatOptionsDescription
jsonprompt?: string, schema?: objectExtract structured data using an LLM. Provide a JSON schema and/or a natural-language prompt (max 10,000 characters).
screenshotfullPage?: boolean, quality?: number, viewport?: { width, height }Capture a screenshot. Max one per request. Viewport max resolution is 7680×4320. Screenshot URLs expire after 24 hours.
changeTrackingmodes?: ("json" | "git-diff")[], tag?: string, schema?: object, prompt?: stringTrack changes between scrapes. Requires "markdown" to also be in the formats array.
attributesselectors: [{ selector: string, attribute: string }]Extract specific HTML attributes from elements matching CSS selectors.

Mobile scraping#

Set mobile: true to emulate a mobile device. This is useful when a responsive site hides content on desktop or serves a different layout to mobile browsers.

For region-specific sites, combine with location and a mobile screenshot to verify the rendered layout:

If the site still serves a desktop layout despite mobile: true, add a mobile User-Agent via headers:

Content filtering#

These parameters control which parts of the page appear in the output. When onlyMainContent is true (the default), boilerplate (nav, footer, etc.) is stripped. includeTags and excludeTags are applied against the original page DOM, not the post-filtered result, so your selectors should target elements as they appear in the source HTML. Set onlyMainContent: false to use the full page as the starting point for tag filtering.

ParameterTypeDefaultDescription
onlyMainContentbooleantrueReturn only the main content. Set false for the full page.
includeTagsarrayCSS selectors to include — tags, classes, IDs, or attribute selectors (e.g. ["h1", "p", ".main-content", "[data-testid=\"main\"]"]).
excludeTagsarrayCSS selectors to exclude — tags, classes, IDs, or attribute selectors (e.g. ["#ad", "#footer", "[role=\"banner\"]"]).

Timing and cache#

ParameterTypeDefaultDescription
waitForinteger (ms)0Extra wait time before scraping, on top of smart-wait. Use sparingly.
maxAgeinteger (ms)172800000Return a cached version if fresher than this value (default is 2 days). Set 0 to always fetch fresh.
timeoutinteger (ms)60000Max request duration before aborting (default is 60 seconds). Minimum is 1000 (1 second).

PDF parsing#

ParameterTypeDefaultDescription
parsersarray["pdf"]Controls PDF processing. [] to skip parsing and return base64 (1 credit flat).
PropertyTypeDefaultDescription
type"pdf"(required)Parser type.
mode"fast" | "auto" | "ocr""auto"fast: text-based extraction only. auto: fast with OCR fallback. ocr: force OCR.
maxPagesintegerCap the number of pages to parse.
pagesbooleanfalseAlso return physical per-page markdown in the document's pages field. No additional cost.
blocksbooleanfalseAlso return per-page typed layout blocks (normalized bounding boxes, block types, reading order, markdown character spans) in the document's blocks field. No additional cost.
pageMarkersbooleanfalseAnnotate page breaks in the document markdown with <!-- page N --> markers (between pages only; numbering may skip pages merged across a break — see Parse). No additional cost.

Actions#

Run browser actions before scraping. This is useful for dynamic content, navigation, or user-gated pages. You can include up to 50 actions per request, and the combined wait time across all wait actions and waitFor must not exceed 60 seconds.

ActionParametersDescription
waitmilliseconds?: number, selector?: stringWait for a fixed duration or until an element is visible (provide one, not both). When using selector, times out after 30 seconds.
clickselector: string, all?: booleanClick an element matching the CSS selector. Set all: true to click every match.
writetext: stringType text into the currently focused field. You must focus the element with a click action first.
presskey: stringPress a keyboard key (e.g. "Enter", "Tab", "Escape").
scrolldirection?: "up" | "down", selector?: stringScroll the page or a specific element. Direction defaults to "down".
screenshotfullPage?: boolean, quality?: number, viewport?: { width, height }Capture a screenshot. Max viewport resolution is 7680×4320.
scrape(none)Capture the current page HTML at this point in the action sequence.
executeJavascriptscript: stringRun JavaScript code in the page. Return values are available in the actions.javascriptReturns array of the response.
pdfformat?: string, landscape?: boolean, scale?: numberGenerate a PDF. Supported formats: "A0" through "A6", "Letter", "Legal", "Tabloid", "Ledger". Defaults to "Letter".

Action execution notes#

  • Write requires a preceding click to focus the target element.
  • Scroll accepts an optional selector to scroll a specific element instead of the page.
  • Wait accepts either milliseconds (fixed delay) or selector (wait until visible).
  • Actions run sequentially: each step completes before the next begins.
  • Actions are not supported for PDFs. If the URL resolves to a PDF the request will fail.

Advanced action examples#

Taking a screenshot:

cURL

Clicking multiple elements:

cURL

Generating a PDF:

cURL

Executing JavaScript (e.g. extracting embedded page data):

cURL

The return value of each executeJavascript action is captured in the actions.javascriptReturns array of the response.

Full scrape example#

The following request combines multiple scrape options:

cURL

This request returns markdown, HTML, raw HTML, links, and a full-page screenshot. It scopes content to <h1>, <p>, <a>, and .main-content while excluding #ad and #footer, waits 1 second before scraping, sets a 15 second timeout, and enables PDF parsing.

See the full Scrape API reference for details.

JSON extraction via formats#

Use the JSON format object in formats to extract structured data in one pass:

Agent endpoint#

Use the /v2/agent endpoint for autonomous, multi-page data extraction. The agent runs asynchronously: you start a job, then poll for results.

Agent is the canonical reference for this endpoint, including execution traces, webhooks, and the full parameter list.

Agent options#

ParameterTypeDefaultDescription
promptstring(required)Natural-language instructions describing what data to extract (max 10,000 characters).
urlsarrayURLs to constrain the agent to.
schemaobjectJSON schema to structure the extracted data.
maxCreditsnumber2500Maximum credits the agent can spend. The dashboard supports up to 2,500; for higher limits, set this via the API (values above 2,500 are always billed as paid requests).
strictConstrainToURLsbooleanfalseWhen true, the agent only visits the provided URLs.
modelstring"spark-2"AI model to use. Spark 1 models are deprecated and currently route to "spark-2".
effortstring(unset)Reasoning budget: "low", "medium", or "high". Every run executes on "spark-2", so you can send effort with or without model.

Check agent status#

Poll GET /v2/agent/{jobId} to check progress. The response status field will be "processing", "completed", or "failed".

cURL

The Python and Node SDKs also provide a convenience method (firecrawl.agent()) that starts the job and polls automatically until completion.

Crawling multiple pages#

To crawl multiple pages, use the /v2/crawl endpoint. The crawl runs asynchronously and returns a job ID. Use the limit parameter to control how many pages are crawled. If omitted, the crawl will process up to 10,000 pages.

cURL

Response#

Check crawl job#

Use the job ID to check the status of a crawl and retrieve its results.

cURL

If the content is larger than 10MB or the crawl job is still running, the response may include a next parameter, a URL to the next page of results.

Crawl prompt and params preview#

You can provide a natural-language prompt to let Firecrawl derive crawl settings. Preview them first:

cURL

Crawler options#

When using the /v2/crawl endpoint, you can customize crawling behavior with the following options.

Path filtering#

ParameterTypeDefaultDescription
includePathsarrayRegex patterns for URLs to include (pathname only by default).
excludePathsarrayRegex patterns for URLs to exclude (pathname only by default).
regexOnFullURLbooleanfalseMatch patterns against the full URL instead of just the pathname.
Warning

The starting URL is also checked against includePaths. If it does not match any of the patterns, the crawl may return 0 pages.

Crawl scope#

ParameterTypeDefaultDescription
maxDiscoveryDepthintegerMax link-depth for discovering new URLs.
limitinteger10000Max pages to crawl.
crawlEntireDomainbooleanfalseExplore siblings and parents to cover the entire domain.
allowExternalLinksbooleanfalseFollow links to external domains.
allowSubdomainsbooleanfalseFollow subdomains of the main domain.
delaynumber (s)Delay between scrapes. Setting this forces concurrency to 1.

Sitemap and deduplication#

ParameterTypeDefaultDescription
sitemapstring"include""include": use sitemap + link discovery. "skip": ignore sitemap. "only": crawl only sitemap URLs.
deduplicateSimilarURLsbooleantrueNormalize URL variants (www., https, trailing slashes, index.html) as duplicates.
ignoreQueryParametersbooleanfalseStrip query strings before deduplication (e.g. /page?a=1 and /page?a=2 become one URL).

Scrape options for crawl#

ParameterTypeDefaultDescription
scrapeOptionsobject{ formats: ["markdown"] }Per-page scrape config. Accepts all scrape options above.

Crawl example#

cURL

The /v2/map endpoint identifies URLs related to a given website.

cURL

Map options#

ParameterTypeDefaultDescription
searchstringFilter links by text match.
limitinteger100Max links to return.
sitemapstring"include""include", "skip", or "only".
includeSubdomainsbooleantrueInclude subdomains.

Here is the API Reference for it: Map Endpoint Documentation

Whitelisting Firecrawl#

Allowing Firecrawl to scrape your website#

  • User Agent: Allow FirecrawlAgent in your firewall or security rules.
  • IP addresses: Firecrawl does not use a fixed set of outbound IPs.

Allowing your application to call the Firecrawl API#

If your firewall blocks outbound requests from your application to external services, you need to whitelist Firecrawl's API server IP address so your application can reach the Firecrawl API (api.firecrawl.dev):

  • IP Address: 35.245.250.27

Add this IP to your firewall's outbound allowlist so your backend can send scrape, crawl, map, and agent requests to Firecrawl.