firecrawl-py / firecrawl 4.22.1) and the v2 OpenAPI spec. Method names, parameters, and return types match the v2 client in firecrawl/v2/client.py unless noted.
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.
Search
Why use it
Use search to discover relevant pages from a query, then pick URLs to scrape or interact with. You can constrain results to a site withsite:, for example site:docs.firecrawl.dev crawl webhooks.
Preferred SDK method
client.search(query, **options) → SearchData (firecrawl.v2.types)
Return value
Returns aSearchData model with optional lists:
web— web hits (SearchResultWebor fullDocumentwhenscrape_optionshydrates content)news— news hits (SearchResultNewsorDocument)images— image hits (SearchResultImagesorDocument)
None when the API did not return that key.
Simple Example
Complex Example
Parameters
-
query- Type: str
- Use when: you need a search query.
- Notes: use
site:example.comto limit results to a domain.
-
sources- Type: list of source names or
Sourceobjects - Use when: you want to control which sources are searched.
- Confirmed values:
"web": web index results"news": news results"images": image resultsSource(type="web" | "news" | "images"): typed source object form
- Type: list of source names or
-
categories- Type: list of category names or
Categoryobjects - Use when: you want to filter results by category.
- Confirmed values:
"github": GitHub-focused results"research": research and academic results"pdf": PDF-focused resultsCategory(type="github" | "research" | "pdf"): typed category object form
- Type: list of category names or
-
limit- Type: int
- Use when: you want to cap results.
- Notes: defaults to
5in the SDK model.
-
tbs- Type: str
- Use when: you need a time-based filter (for example
qdr:d,qdr:w,sbd:1,qdr:m).
-
location- Type: str
- Use when: you want localized results.
-
ignore_invalid_urls- Type: bool
- Use when: you want to drop URLs that cannot be scraped by other endpoints.
-
timeout- Type: int
- Use when: you need a request timeout in milliseconds.
- Notes: defaults to
300000in the SDK model.
-
scrape_options- Type:
ScrapeOptions - Use when: you want to scrape each search result (see Scrape parameters for fields).
- Type:
Scrape
Why use it
Use scrape when you already have a URL and want structured content in one or more formats.Preferred SDK method
client.scrape(url, **options) → Document (firecrawl.v2.types)
Simple Example
Complex Example
Parameters
-
url- Type: str
- Use when: you want to scrape a specific page.
-
formats- Type: list of format strings or format objects
- Use when: you want multiple output formats.
- Confirmed format strings:
"markdown": markdown content"html": cleaned HTML"rawHtml"or"raw_html": raw HTML"links": page links"images": image URLs"screenshot": screenshot output"summary": summary output"changeTracking"or"change_tracking": change tracking output"attributes": attribute extraction"branding": branding profile output"audio": audio extraction
- Object-only format types:
{"type": "json", ...}: JSON extraction. Use an object, not the plain string"json".{"type": "query", "prompt": "..."}: question-answer output. Use an object, not the plain string"query".
- Format object fields:
type: one of the format strings above, or"json"/"query"for object-only formatsprompt: fortype: "query"and optional fortype: "json"schema: JSON schema fortype: "json"or for change tracking JSON modemodes: array of"git-diff"or"json"fortype: "changeTracking"tag: change tracking tag fortype: "changeTracking"full_page,quality,viewport: screenshot options fortype: "screenshot"selectors: array of{selector, attribute}fortype: "attributes"
-
headers- Type: dict of str to str
- Use when: you need custom request headers.
-
include_tags- Type: list of str
- Use when: you want to include only specific HTML tags.
-
exclude_tags- Type: list of str
- Use when: you want to exclude specific HTML tags.
-
only_main_content- Type: bool
- Use when: you want to strip nav, footer, and other boilerplate.
-
timeout- Type: int
- Use when: you need a timeout in milliseconds.
-
wait_for- Type: int
- Use when: you need to wait for the page to render (milliseconds).
-
mobile- Type: bool
- Use when: you want a mobile viewport.
-
parsers- Type: list of parser names or parser objects
- Use when: you need file parsing controls (for example PDF parsing).
- Confirmed values:
"pdf": enable PDF parsing{ "type": "pdf", "mode": "fast" | "auto" | "ocr", "max_pages": int }: PDF parser options
-
actions- Type: list of action objects
- Use when: you need lightweight pre-scrape actions.
- Confirmed action types:
wait:millisecondsorselectorrequiredscreenshot:full_page,quality,viewportoptionalclick:selectorrequiredwrite:textrequired (click to focus the input first)press:keyrequiredscroll:direction(upordown) required,selectoroptionalscrape: no additional fieldsexecuteJavascript:scriptrequiredpdf:format(A0, A1, A2, A3, A4, A5, A6, Letter, Legal, Tabloid, Ledger),landscape,scaleoptional
-
location- Type: dict with
countryandlanguages - Use when: you need geo or language-aware scraping.
- Type: dict with
-
skip_tls_verification- Type: bool
- Use when: you need to skip TLS verification.
-
remove_base64_images- Type: bool
- Use when: you want to drop base64 images from markdown output.
-
fast_mode- Type: bool
- Use when: you want faster scrapes with reduced fidelity.
-
block_ads- Type: bool
- Use when: you want ad and cookie popup blocking.
-
proxy- Type: str
- Use when: you need proxy control.
- Confirmed values:
"basic","stealth","enhanced","auto"
-
max_age- Type: int
- Use when: you want cached data up to a maximum age (milliseconds).
-
min_age- Type: int
- Use when: you want cached data only if it is at least this old (milliseconds).
- Notes: only on
ScrapeOptionspassed asscrape_optionstoclient.search. Theclient.scrapemethod does not acceptmin_age.
-
store_in_cache- Type: bool
- Use when: you want Firecrawl to cache the result.
-
profile- Type: dict with
nameand optionalsave_changesorsaveChanges - Use when: you want a persistent browser profile shared across scrapes and interactions.
- Type: dict with
Interact
Why use it
Use interact when a page requires browser actions or code execution after a scrape starts.Preferred SDK method
client.interact(job_id, code=None, *, prompt=None, language="node", timeout=None)
prompt is keyword-only: call client.interact(job_id, prompt="...") or client.interact(job_id, code="..."). At least one of code or prompt must be non-empty (validated in firecrawl/v2/methods/scrape.py).
Simple Example
Complex Example
Stop session
client.stop_interaction(job_id) ends the scrape-bound browser session. Returns BrowserDeleteResponse (success, optional session_duration_ms, credits_billed, error).
Parameters
-
job_id- Type: str
- Use when: you have a scrape job ID from
document.metadata.scrape_id.
-
code- Type: str
- Use when: you want to run code in the browser session (optional if
promptis set).
-
prompt- Type: str
- Use when: you want the browser agent to follow a natural-language instruction (optional if
codeis set).
-
language- Type: str
- Use when: you need a specific runtime.
- Confirmed values:
"python","node","bash" - Notes: defaults to
"node"in the SDK.
-
timeout- Type: int
- Use when: you need an execution timeout in seconds.
Return value
ReturnsBrowserExecuteResponse: success, optional live_view_url, interactive_live_view_url, output, stdout, result, stderr, exit_code, killed, error (API camelCase is normalized to snake_case on the model).
Notes
- Deprecated aliases:
scrape_execute→interact;stop_interactive_browseranddelete_scrape_browser→stop_interaction. - The top-level
Firecrawlclient exposes v2 methods directly; v1 remains underclient.v1. - The bundled v2 OpenAPI snippet for
POST /v2/scrape/{jobId}/interactmay only documentcode; the Python SDK and server accept eithercodeorpromptfor this endpoint.
Source Of Truth
firecrawl/apps/python-sdk/pyproject.tomlfirecrawl/apps/python-sdk/firecrawl/__init__.pyfirecrawl/apps/python-sdk/firecrawl/client.pyfirecrawl/apps/python-sdk/firecrawl/v2/client.pyfirecrawl/apps/python-sdk/firecrawl/v2/types.pyfirecrawl/apps/python-sdk/firecrawl/v2/methods/search.pyfirecrawl/apps/python-sdk/firecrawl/v2/methods/scrape.pyfirecrawl/apps/python-sdk/firecrawl/v2/utils/validation.pyfirecrawl-docs/api-reference/v2-openapi.json

