Get a live browser URL
curl --request GET \
--url https://api.pre.dev/browser-agent/{id}/ws \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pre.dev/browser-agent/{id}/ws"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pre.dev/browser-agent/{id}/ws', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pre.dev/browser-agent/{id}/ws",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pre.dev/browser-agent/{id}/ws"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pre.dev/browser-agent/{id}/ws")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pre.dev/browser-agent/{id}/ws")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"url": "wss://browser-worker.example/ws/507f1f77bcf86cd799439011?token=3f1c0b9e2d4a7c58"
}Browser Agents
Watch the live browser
Get an authenticated WebSocket URL for available browser frames in a run you own.
GET
/
browser-agent
/
{id}
/
ws
Get a live browser URL
curl --request GET \
--url https://api.pre.dev/browser-agent/{id}/ws \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pre.dev/browser-agent/{id}/ws"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pre.dev/browser-agent/{id}/ws', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pre.dev/browser-agent/{id}/ws",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pre.dev/browser-agent/{id}/ws"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pre.dev/browser-agent/{id}/ws")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pre.dev/browser-agent/{id}/ws")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"url": "wss://browser-worker.example/ws/507f1f77bcf86cd799439011?token=3f1c0b9e2d4a7c58"
}Request the live-view URL using your API key and an existing run ID:
The response is
Filter for
Each status has an example body in the response examples. See errors and retries.
curl --fail-with-body "https://api.pre.dev/browser-agent/$BATCH_ID/ws" \
-H "Authorization: Bearer $PREDEV_API_KEY"
{ "url": "wss://…" }. Connect to that URL exactly as returned; it includes the authorization needed for the live view. Treat it as a credential-bearing URL and keep it out of public logs.
Frames
Where live capture is available, JSON messages withtype: "frame" contain:
| Field | Meaning |
|---|---|
taskIndex | Zero-based index within the run |
b64 | Base64-encoded JPEG image |
w, h | Capture metadata dimensions, when available |
ts | Unix timestamp in milliseconds |
type: "frame" before reading those fields. For a preview image, use data:image/jpeg;base64, followed by b64 as the image source.
Frames are a live visual feed, not a durable recording, task-control channel, or completion signal. Some execution paths do not produce live frames. Use SSE or polling for authoritative task state and includeEvents=true for available screenshot history.
A returned URL does not guarantee that a frame will arrive. Current SDKs and MCP tools do not have a wrapper for this endpoint.
Errors
| Status | When |
|---|---|
400 | id is not a valid run ID |
401 | Missing or invalid key |
404 | No run with this ID in your account, or no live stream for it |
Authorizations
apiKeyAuthxApiKey
Your pre.dev workspace API key (pdk_...) from Integrations, Built-in tab: https://pre.dev/projects/integrations?tab=built-in
Path Parameters
24-character record ID.
Pattern:
^[a-fA-F0-9]{24}$Response
Connect to the returned WebSocket URL.
Credential-bearing WebSocket URL. Keep private and use only for the requested batch.
Was this page helpful?

