The Three Endpoints
| Endpoint | Pattern | Best For |
|---|---|---|
/run | Synchronous | Quick tasks, simple integrations |
/run-async | Start then check | Long tasks, batch processing |
/run-sse | Live updates | Real-time progress, user-facing apps |
Synchronous: /run
Pattern: Send request → Wait → Get result
The simplest approach. You call the API, it blocks until the automation completes, then returns the result.
- When to use
- When to avoid
- Tasks that complete in under 30 seconds
- Simple scripts and one-off automations
- When you don’t need progress updates
Asynchronous: /run-async
Pattern: Send request → Get run ID → Poll for result
The request returns immediately with a run_id. You then poll a separate endpoint to check status and get the result when ready.
1. Start the automation
Learn more about run statuses and lifecycle in Runs.
- When to use
- When to avoid
- Long-running automations (30+ seconds)
- Batch processing multiple URLs
- Fire-and-forget workflows
- When you need to track runs separately
Streaming: /run-sse
Pattern: Send request → Receive event stream → Process events as they arrive
Uses Server-Sent Events (SSE) to push updates to you in real-time. You’ll receive events for each action the browser takes, plus a streaming URL you can embed in an iframe to watch the automation live.
1. Start the automation
Event Types
| Event | Description |
|---|---|
STARTED | Automation has begun, includes runId |
STREAMING_URL | URL to watch the browser live (valid 24hrs) |
PROGRESS | Browser action taken (click, type, scroll, etc.) |
HEARTBEAT | Connection keep-alive (no action needed) |
COMPLETE | Automation finished, includes status and resultJson |
Handling Events
Use this pattern to process each event type as the automation progresses.- When to use
- When to avoid
- User-facing apps (show progress)
- When you want to watch the browser live
- Debugging and development
- Long tasks where you want visibility
Quick Decision Guide
Comparison Table
| Feature | /run | /run-async | /run-sse |
|---|---|---|---|
| Response type | Final result | Run ID | Event stream |
| Progress updates | No | No (poll status) | Yes |
| Streaming URL | In response | Poll to get | In events |
| Best for | Quick tasks | Batch/long tasks | Real-time UI |
| Complexity | Low | Medium | Medium |