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": "<string>"
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"actionUrl": "<string>",
"requiresSubscription": true,
"trialsUsed": 123,
"maxTrials": 123
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"actionUrl": "<string>",
"requiresSubscription": true,
"trialsUsed": 123,
"maxTrials": 123
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"actionUrl": "<string>",
"requiresSubscription": true,
"trialsUsed": 123,
"maxTrials": 123
}API reference
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": "<string>"
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"actionUrl": "<string>",
"requiresSubscription": true,
"trialsUsed": 123,
"maxTrials": 123
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"actionUrl": "<string>",
"requiresSubscription": true,
"trialsUsed": 123,
"maxTrials": 123
}{
"error": "<string>",
"message": "<string>",
"code": "<string>",
"actionUrl": "<string>",
"requiresSubscription": true,
"trialsUsed": 123,
"maxTrials": 123
}Request the live-view URL using your API key and an existing run ID:
The response is
Filter for
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.
404 can mean the run is inaccessible or live streaming is unavailable. A returned URL does not guarantee that a frame will arrive. Current SDKs and MCP tools do not have a wrapper for this endpoint.Authorizations
apiKeyAuthxApiKey
Use a pre.dev API key from https://pre.dev/projects/key.
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?

