# Interact

Scrape a page, then take actions on it. Describe what you want in natural language, or write Playwright code for full control. Session state persists between calls so you can chain multi-step workflows.

Documentation: https://docs.firecrawl.dev/features/interact

## How It Works

### Step 1: Scrape the page

Get clean data from any URL. The response includes a scrapeId you use to interact.

```bash
firecrawl scrape https://example.com
```

### Step 2: Interact with prompts

Describe what you want in natural language. Click buttons, fill forms, extract data.

```bash
firecrawl interact -p "Click the login button"
```

### Step 3: Chain interactions

Each call reuses the session. State carries over so you can perform multiple actions in one session.

```bash
firecrawl interact -p "Fill email with test@example.com"
firecrawl interact -p "Submit the form"
```

Works with prompts, Playwright code, and the agent-browser CLI.

## Key Capabilities

### Prompt-Based

Describe what you want in natural language. Click buttons, fill forms, navigate pages, no selectors or Playwright code needed.

### Full Code Control

Need precision? Write Playwright code in Node.js, Python, or Bash. The page object is ready; execute anything the browser can do.

### Persistent Profiles

Save browser state across sessions with profiles. Stay logged in, preserve cookies, and pick up where you left off.

### Session Chaining

Each interact call reuses the same session. Chain prompts to complete multi-step workflows with state carrying over automatically.

### Live View

Every response includes a liveViewUrl for read-only viewing and an interactiveLiveViewUrl that lets users click, type, and control the browser, useful for debugging, demos, or login flows.

## CLI Commands

### scrape

Scrape any URL to get clean data and a scrapeId for interaction.

```
$ firecrawl scrape https://example.com

{
  "title": "Example",
  "markdown": "# Hello\n...",
  "metadata": {
    "scrapeId": "<string>",
    "statusCode": 200,
    "sourceURL": "https://example.com"
  }
}
```

### interact

Send prompts or code to interact with the scraped page. Session persists between calls.

```
$ firecrawl interact -p "Click the sign up button"

{
  "success": true,
  "output": "I clicked the sign up button...",
  "liveViewUrl": "..."
}
```

### interact --stop

Stop the interact session when done. State is saved if using a profile.

```
$ firecrawl interact --stop

Session stopped.
Duration: 45.2s
Credits billed: 2
```

## SDK Examples

### Node.js

```javascript
import { Firecrawl } from "firecrawl";

const firecrawl = new Firecrawl({ apiKey: "fc-YOUR-API-KEY" });

// Scrape the page
const scrape = await firecrawl.scrapeUrl("https://news.ycombinator.com");
const scrapeId = scrape.metadata.scrapeId;

// Interact with a prompt
const result = await firecrawl.interact(scrapeId, {
  prompt: "Extract the top 5 story titles",
});
console.log(result.output);

// Or run Playwright code
const result2 = await firecrawl.interact(scrapeId, {
  code: "return await page.title()",
  language: "node",
});
console.log(result2.result);

// Stop when done
await firecrawl.interactStop(scrapeId);
```

### Python

```python
from firecrawl import FirecrawlApp

app = FirecrawlApp(api_key="fc-YOUR-API-KEY")

# Scrape the page
scrape = app.scrape_url("https://news.ycombinator.com")
scrape_id = scrape["metadata"]["scrapeId"]

# Interact with a prompt
result = app.interact(scrape_id,
    prompt="Extract the top 5 story titles"
)
print(result["output"])

# Or run Playwright code
result = app.interact(scrape_id,
    code="return await page.title()",
    language="node",
)
print(result["result"])

# Stop when done
app.interact_stop(scrape_id)
```

### CLI

```bash
# Scrape the page
firecrawl scrape https://news.ycombinator.com

# Interact with prompts
firecrawl interact -p "Extract the top 5 story titles"
firecrawl interact -p "Click the first story link"
firecrawl interact -p "Summarize this page"

# Or run code
firecrawl interact -c "return await page.title()"

# Stop when done
firecrawl interact --stop
```

### cURL

```bash
# 1. Scrape the page
curl -X POST "https://api.firecrawl.dev/v2/scrape" \
  -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://news.ycombinator.com"}'

# 2. Interact with a prompt
curl -X POST "https://api.firecrawl.dev/v2/scrape/SCRAPE_ID/interact" \
  -H "Authorization: Bearer $FIRECRAWL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "Extract the top 5 story titles"}'

# 3. Stop
curl -X DELETE "https://api.firecrawl.dev/v2/scrape/SCRAPE_ID/interact" \
  -H "Authorization: Bearer $FIRECRAWL_API_KEY"
```

### Example Output

```
Here are the top 5 stories on Hacker News:
1. Mass Recall of Tesla Cybertrucks
2. Show HN: I built a real-time flight tracker
3. The Art of PostgreSQL
4. Why SQLite Is So Great for the Edge
5. Ask HN: What are you working on?
```

## Agent Framework Integrations

Works with every agent framework. Connect Firecrawl Interact via MCP.

### Vercel AI SDK

```javascript
import { generateText } from "ai";
import { openai } from "@ai-sdk/openai";
import { createMCPClient } from "ai";

const client = await createMCPClient({
  transport: { type: "sse", url: "https://mcp.firecrawl.dev/sse" },
});

const { text } = await generateText({
  model: openai("gpt-4o"),
  tools: await client.tools(),
  prompt: "Scrape example.com and click the login button on the page",
});
```

### OpenAI Agents

```python
from agents import Agent, Runner
from agents.mcp import MCPServerSse

firecrawl = MCPServerSse(
    url="https://mcp.firecrawl.dev/sse",
    headers={
        "Authorization": "Bearer fc-YOUR-API-KEY"
    },
)

agent = Agent(
    name="Interact Agent",
    instructions="Scrape pages and interact with them for the user.",
    mcp_servers=[firecrawl],
)

result = await Runner.run(
    agent, "Scrape example.com, click the pricing tab and extract the plans"
)
```

### Claude (Anthropic)

```python
import anthropic

client = anthropic.Anthropic()

response = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=4096,
    tools=[{
        "type": "mcp",
        "server_url": "https://mcp.firecrawl.dev/sse",
        "server_label": "firecrawl",
    }],
    messages=[{
        "role": "user",
        "content": "Scrape example.com and fill the contact form with test data, then submit it"
    }],
)
```

### LangChain

```python
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI

client = MultiServerMCPClient({
    "firecrawl": {
        "url": "https://mcp.firecrawl.dev/sse",
        "transport": "sse",
    }
})

tools = await client.get_tools()
agent = create_react_agent(
    ChatOpenAI(model="gpt-4o"), tools
)
result = await agent.ainvoke({
    "messages": "Scrape news.ycombinator.com and extract the top 5 story titles"
})
```

Don't see your favorite framework? Email help@firecrawl.com.

## Use Cases

| Use Case                | Example                                                           | CLI Command                                                                                              |
| ----------------------- | ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
| E-commerce Monitoring   | Add items to cart, check prices after login, track inventory      | `firecrawl interact -p "Add the first item to cart and check the total price"`                           |
| Form Automation         | Fill multi-step forms, submit applications, complete signups      | `firecrawl interact -p "Fill the registration form with test data and submit"`                           |
| Deep Data Extraction    | Navigate paginated results, expand dropdowns, click through tabs  | `firecrawl interact -p "Click next page and extract all product listings"`                               |
| Authenticated Workflows | Log in, navigate auth-gated dashboards, extract protected content | `firecrawl interact -p "Log in and download the monthly report"`                                         |
| QA and Testing          | Verify UI flows, check form validations, test user journeys       | `firecrawl interact -p "Submit the form with invalid email and check the error message"`                 |
| Multi-Step Workflows    | Search, filter, select, checkout in one session                   | `firecrawl interact -p "Search for laptops, filter by price under $1000, and extract the top 5 results"` |

## Pricing

- **Code-based interaction**: 2 credits per session minute, prorated by the second
- **Prompt-based interaction**: 7 credits per session minute
- **Scrape**: 1 credit per scrape (billed separately)
- Sessions expire after 10 minutes of total time or 5 minutes of inactivity

Always stop your session when done to avoid unnecessary charges.

## Interact FAQ

### Interact

**What is Firecrawl Interact?** Interact lets you scrape any page, then take actions on it: click buttons, fill forms, navigate, and extract dynamic content. Describe what you want in natural language or write Playwright code. The browser session persists between calls for multi-step workflows.

**How is Interact different from Browser Sandbox?** Interact provides a simpler interface built on the same infrastructure. Instead of managing browser sessions directly, you scrape a URL first, then interact with that page. Browser Sandbox is better when you need a standalone session not tied to a specific scrape.

**What can I do with prompts?** Describe actions in natural language: "click the login button", "fill the email field with test@example.com", "scroll down and extract the pricing table". Keep prompts focused on one task at a time for best results.

**Can I run code instead of prompts?** Yes. Execute Playwright code in Node.js, Python, or Bash. The page object is already connected. You can also use agent-browser CLI commands in bash mode.

**How does an AI agent fill a multi-step form with Firecrawl Interact?** Scrape the form page, then send one short prompt per step to the same session, for example filling the fields on page one and clicking Next. Firecrawl Interact keeps the browser state between calls, so each step continues where the last one ended. Before the final submit, ask for a summary of the review page or open the interactive live view so a person can confirm.

### Pricing

**How much does Interact cost?** 2 credits per session minute (code-based) or 7 credits per session minute (prompt-based), prorated by the second. The scrape itself is billed separately at 1 credit per scrape. Always stop your session when done.

**Is there a free tier?** Yes. Free users get credits to try Interact including all features: prompts, code execution, live view, and persistent profiles.

### Usage

**How long do sessions last?** Sessions expire after 10 minutes of total time or 5 minutes of inactivity, whichever comes first. Always stop sessions when done.

**Can I persist state across sessions?** Yes. Pass a profile parameter when scraping to save and reuse browser state (cookies, localStorage, sessions) across different scrapes.

**What is Live View?** Every interact response includes a liveViewUrl for read-only viewing and an interactiveLiveViewUrl that lets users click, type, and control the browser, useful for debugging, demos, or login flows.

_Canonical HTML: https://www.firecrawl.dev/interact_

## Site Navigation

### Global Hub

- [Home](/index.md)
- [Pricing](/pricing.md)
- [Blog](/blog/index.md)
- [Glossary](/glossary/index.md)
- [Alternatives](/alternatives/index.md)
- [Tools](/tools/index.md)
- [Use Cases](/use-cases/index.md)
- [Integrations](/integrations/index.md)
- [Changelog](/changelog/index.md)
