Skip to content
Firecrawl Docsv2
Firecrawl Docs
Interact Endpoints

Interact with a Scraped Page

POST/scrape/{jobId}/interact

Execute code or an AI prompt in the browser session bound to a scrape job.

Use this endpoint to continue interacting with the same browser state initialized from a previous scrape. Either code or prompt must be provided — not both.

POST /v2/scrape/{jobId}/interact handles the full lifecycle:

  1. If no browser session exists for this scrape job yet, Firecrawl creates one at the same page state as the original scrape.
  2. When code is provided, Firecrawl runs it in the browser sandbox. When prompt is provided, an AI agent automates the task using natural language.
  3. Later POST /interact calls on the same jobId reuse the same live browser state.

When you are done, call DELETE /v2/scrape/{jobId}/interact to stop the session.

Path Parameters

ParameterTypeRequiredDescription
jobIdstring (UUID)YesThe scrape job ID from data.metadata.scrapeId in the scrape response

Request Body

ParameterTypeRequiredDefaultDescription
codestringNoCode to execute in the browser sandbox (1–100,000 chars). Required if prompt is not set.
promptstringNoNatural language task for the AI agent (1–10,000 chars). Required if code is not set.
languagestringNo"node"One of "python", "node", or "bash". Only used with code.
timeoutnumberNo30Execution timeout in seconds (1–300).
originstringNoOptional origin label used for telemetry.

Response

FieldTypeDescription
successbooleanWhether the execution completed without errors
cdpUrlstringRaw Chrome DevTools Protocol (CDP) WebSocket URL for the browser session. Connect directly with Playwright, Puppeteer, or any CDP client
liveViewUrlstringRead-only live view URL for the browser session
interactiveLiveViewUrlstringInteractive live view URL (viewers can control the browser)
outputstringAI agent’s final response (only present when using prompt)
stdoutstringStandard output from the code execution
resultstringReturn value — last expression value for Node.js, final page snapshot for prompt
stderrstringStandard error output
exitCodenumberExit code of the execution (0 = success)
killedbooleanWhether the execution was terminated due to timeout
errorstringError message (only present on failure)

Example Request (Code)

curl -X POST "https://api.firecrawl.dev/v2/scrape/550e8400-e29b-41d4-a716-446655440000/interact" \
  -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "code": "const title = await page.title(); JSON.stringify({ title });",
    "language": "node",
    "timeout": 30
  }'

Example Response (Code)

{
  "success": true,
  "cdpUrl": "wss://browser.firecrawl.dev/...",
  "liveViewUrl": "https://liveview.firecrawl.dev/...",
  "interactiveLiveViewUrl": "https://liveview.firecrawl.dev/...",
  "stdout": "",
  "result": "{\"title\":\"Example Domain\"}",
  "stderr": "",
  "exitCode": 0,
  "killed": false
}

Example Request (Prompt)

curl -X POST "https://api.firecrawl.dev/v2/scrape/550e8400-e29b-41d4-a716-446655440000/interact" \
  -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Find the pricing section and tell me the price of the Pro plan",
    "timeout": 60
  }'

Example Response (Prompt)

{
  "success": true,
  "cdpUrl": "wss://browser.firecrawl.dev/...",
  "liveViewUrl": "https://liveview.firecrawl.dev/...",
  "interactiveLiveViewUrl": "https://liveview.firecrawl.dev/...",
  "output": "The Pro plan costs $49/month and includes unlimited scrapes, priority support, and custom integrations.",
  "stdout": "...",
  "result": "...",
  "stderr": "",
  "exitCode": 0,
  "killed": false
}

Error Codes

StatusDescription
402Insufficient credits for a browser session
403Scrape job belongs to a different team
404Scrape job not found
409Replay context unavailable — rerun the scrape and try again
410Browser session has already been destroyed
429Maximum concurrent browser sessions reached
502Browser service or AI agent execution failed
503Browser feature not configured (self-hosted only)

For detailed usage with examples, see the Interact feature guide.

Was this page helpful?Suggest editsRaise issue