The Three Endpoints
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 and read events
Event Types
Cancelling an SSE Run
You can cancel a streaming run using therun_id from the STARTED event. The onStarted callback fires while you consume the stream, so capture run_id there and trigger the cancel from a separate context (here, a deadline timer):
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
Common Request Options
All three endpoints accept the same request body. Beyond the requiredurl and goal, these optional fields apply across /run, /run-async, and /run-sse:
Quick Decision Guide
1
Need real-time progress updates?
Yes → Use
/run-sse2
Task takes longer than 30 seconds?
Yes → Use
/run-async + polling3
Submitting multiple tasks at once?
Yes → Use
/run-async (parallel submission)4
Simple, quick task?
Use
/run (synchronous)Comparison Table
Related
Runs
Understand the automation lifecycle
API Reference
Full endpoint specifications