Skip to main content
GET
/
v1
/
sessions
/
{id}
/
replay
JavaScript
import Stagehand from 'stagehand-sdk';

const client = new Stagehand({
  browserbaseAPIKey: process.env['BROWSERBASE_API_KEY'], // This is the default and can be omitted
  browserbaseProjectID: process.env['BROWSERBASE_PROJECT_ID'], // This is the default and can be omitted
  modelAPIKey: process.env['MODEL_API_KEY'], // This is the default and can be omitted
});

const response = await client.sessions.replay('c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123');

console.log(response.data);
import os
from stagehand import Stagehand

client = Stagehand(
browserbase_api_key=os.environ.get("BROWSERBASE_API_KEY"), # This is the default and can be omitted
browserbase_project_id=os.environ.get("BROWSERBASE_PROJECT_ID"), # This is the default and can be omitted
model_api_key=os.environ.get("MODEL_API_KEY"), # This is the default and can be omitted
)
response = client.sessions.replay(
id="c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
)
print(response.data)
package main

import (
"context"
"fmt"

"github.com/browserbase/stagehand-go"
"github.com/browserbase/stagehand-go/option"
)

func main() {
client := stagehand.NewClient(
option.WithBrowserbaseAPIKey("My Browserbase API Key"),
option.WithBrowserbaseProjectID("My Browserbase Project ID"),
option.WithModelAPIKey("My Model API Key"),
)
response, err := client.Sessions.Replay(
context.TODO(),
"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
stagehand.SessionReplayParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}
package com.browserbase.api.example;

import com.browserbase.api.client.StagehandClient;
import com.browserbase.api.client.okhttp.StagehandOkHttpClient;
import com.browserbase.api.models.sessions.SessionReplayParams;
import com.browserbase.api.models.sessions.SessionReplayResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
StagehandClient client = StagehandOkHttpClient.fromEnv();

SessionReplayResponse response = client.sessions().replay("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123");
}
}
package com.browserbase.api.example

import com.browserbase.api.client.StagehandClient
import com.browserbase.api.client.okhttp.StagehandOkHttpClient
import com.browserbase.api.models.sessions.SessionReplayParams
import com.browserbase.api.models.sessions.SessionReplayResponse

fun main() {
val client: StagehandClient = StagehandOkHttpClient.fromEnv()

val response: SessionReplayResponse = client.sessions().replay("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123")
}
require "stagehand"

stagehand = Stagehand::Client.new(
browserbase_api_key: "My Browserbase API Key",
browserbase_project_id: "My Browserbase Project ID",
model_api_key: "My Model API Key"
)

response = stagehand.sessions.replay("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123")

puts(response)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Stagehand\Client;
use Stagehand\Core\Exceptions\APIException;

$client = new Client(
browserbaseAPIKey: getenv('BROWSERBASE_API_KEY') ?: 'My Browserbase API Key',
browserbaseProjectID: getenv(
'BROWSERBASE_PROJECT_ID'
) ?: 'My Browserbase Project ID',
modelAPIKey: getenv('MODEL_API_KEY') ?: 'My Model API Key',
);

try {
$response = $client->sessions->replay(
'c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123', xStreamResponse: 'true'
);

var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}
using System;
using Stagehand;
using Stagehand.Models.Sessions;

StagehandClient client = new();

SessionReplayParams parameters = new()
{
ID = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123"
};

var response = await client.Sessions.Replay(parameters);

Console.WriteLine(response);
curl --request GET \
--url https://api.stagehand.browserbase.com/v1/sessions/{id}/replay \
--header 'x-bb-api-key: <api-key>' \
--header 'x-bb-project-id: <api-key>'
{
  "success": true,
  "data": {
    "pages": [
      {
        "url": "<string>",
        "timestamp": 123,
        "duration": 123,
        "actions": [
          {
            "method": "<string>",
            "parameters": {},
            "result": {},
            "timestamp": 123,
            "endTime": 123,
            "tokenUsage": {
              "inputTokens": 123,
              "outputTokens": 123,
              "timeMs": 123,
              "cost": 123
            }
          }
        ]
      }
    ],
    "clientLanguage": "<string>"
  }
}

Authorizations

x-bb-api-key
string
header
required

Browserbase API key for authentication

x-bb-project-id
string
header
required

Deprecated. Browserbase API keys are now project-scoped, so this header is no longer required.

Headers

x-stream-response
enum<string>

Whether to stream the response via SSE

Available options:
true,
false
Example:

"true"

Path Parameters

id
string
required

Unique session identifier

Example:

"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123"

Response

200 - application/json

Default Response

success
boolean
required

Indicates whether the request was successful

data
object
required