/interact to start taking actions in that page - click buttons, fill forms, extract dynamic content, or navigate deeper. Just describe what you want, or write code if you need full control.
AI prompts
Describe what action you want to take in the page
Code execution
Interact via code execution securely with playwright, agent-browser
Live view
Watch or interact with the browser in real time via embeddable stream
How It Works
- Scrape a URL with
POST /v2/scrape. The response includes ascrapeIdindata.metadata.scrapeId. Optionally pass aprofileto persist browser state across sessions. - Interact by calling
POST /v2/scrape/{scrapeId}/interactwith apromptor with playwrightcode. On the first call, the scraped session is resumed and you can start interacting with the page. - Stop the session with
DELETE /v2/scrape/{scrapeId}/interactwhen you’re done.
Quick Start
Scrape a page, interact with it, and stop the session:Response
Interact via prompting
The simplest way to interact with a page. Describe what you want in natural language and it will click, type, scroll, and extract data automatically.output field with the agent’s answer:
Response
Keep Prompts Small and Focused
Prompts work best when each one is a single, clear task. Instead of asking the agent to do a complex multi-step workflow in one shot, break it into separate interact calls. Each call reuses the same browser session, so state carries over between them.Running Code
For full control, you can execute code directly in the browser sandbox. Thepage variable (a Playwright Page object) is available in Node.js and Python. Bash mode has agent-browser pre-installed.
Node.js (Playwright)
The default language. Write Playwright code directly —page is already connected to the browser.
Python
Setlanguage to "python" for Playwright’s Python API.
Bash (agent-browser)
agent-browser is a CLI pre-installed in the sandbox with 60+ commands. It provides an accessibility tree with element refs (@e1, @e2, …) — ideal for LLM-driven automation.
| Command | Description |
|---|---|
snapshot | Full accessibility tree with element refs |
snapshot -i | Interactive elements only |
click @e1 | Click element by ref |
fill @e1 "text" | Clear field and type text |
type @e1 "text" | Type without clearing |
press Enter | Press a keyboard key |
scroll down 500 | Scroll down by pixels |
get text @e1 | Get text content |
get url | Get current URL |
wait @e1 | Wait for element |
wait --load networkidle | Wait for network idle |
find text "X" click | Find element by text and click |
eval "js code" | Run JavaScript in page |
Live View
Every interact response includes URLs for watching the browser session in real time.| Field | Description |
|---|---|
liveViewUrl | Read-only stream — embed to watch the session |
interactiveLiveViewUrl | Interactive stream — viewers can click, type, and interact |
Session Lifecycle
Creation
The firstPOST /v2/scrape/{scrapeId}/interact call creates a sandboxed browser session at the same page state as your scrape.
Reuse
Subsequent interact calls on the samescrapeId reuse the existing session. The browser stays open and maintains its state between calls, so you can chain multiple interactions:
Cleanup
Stop the session explicitly when done:Persistent Profiles
By default, each scrape + interact session starts with a clean browser. Withprofile, you can save and reuse browser state (cookies, localStorage, sessions) across scrapes. This is useful for staying logged in and preserving preferences.
Pass the profile parameter when calling scrape. Sessions with the same profile name share state.
| Parameter | Default | Description |
|---|---|---|
name | — | A name for the persistent profile. Scrapes with the same name share browser state. |
saveChanges | true | When true, browser state is saved back to the profile when the interact session stops. Set to false to load existing data without writing — useful when you need multiple concurrent readers. |
Only one session can save to a profile at a time. If another session is already saving, you’ll get a
409 error. You can still open the same profile with saveChanges: false, or try again later.When to Use What
| Use Case | Recommended | Why |
|---|---|---|
| Web search | Search | Dedicated search endpoint |
| Get clean content from a URL | Scrape | One API call, no session needed |
| Click, type, navigate on a page | Interact (prompt) | Just describe it in English |
| Extract data behind interactions | Interact (prompt) | No selectors needed |
| Complex scraping logic | Interact (code) | Full Playwright control |
Interact vs Browser Sandbox: Interact is built on the same infrastructure as Browser Sandbox but provides a better interface for the most common pattern — scrape a page, then go deeper. Browser Sandbox is better when you need a standalone browser session that isn’t tied to a specific scrape.
Pricing
2 credits per session minute, prorated by the second. The scrape itself is billed separately (1 credit per scrape, plus any format-specific costs).API Reference
- Execute Interact —
POST /v2/scrape/{scrapeId}/interact - Stop Interact —
DELETE /v2/scrape/{scrapeId}/interact
Request Body (POST)
| Field | Type | Default | Description |
|---|---|---|---|
prompt | string | — | Natural language task for the AI agent. Required if code is not set. Max 10,000 characters. |
code | string | — | Code to execute (Node.js, Python, or Bash). Required if prompt is not set. Max 100,000 characters. |
language | string | "node" | "node", "python", or "bash". Only used with code. |
timeout | number | 30 | Timeout in seconds (1–300). |
origin | string | — | Caller identifier for activity tracking. |
Response
| Field | Description |
|---|---|
success | true if the execution completed without errors |
liveViewUrl | Read-only live view URL for the browser session |
interactiveLiveViewUrl | Interactive live view URL (viewers can control the browser) |
output | The agent’s natural language answer to your prompt. Only present when using prompt. |
stdout | Standard output from the code execution |
result | Raw return value from the sandbox. For code: the last expression evaluated. For prompt: the raw page snapshot the agent used to produce output. |
stderr | Standard error output |
exitCode | Exit code (0 = success) |
killed | true if the execution was terminated due to timeout |
Have feedback or need help? Email help@firecrawl.com or reach out on Discord.

