Skip to main content
POST
/
v1
/
sessions
/
{id}
/
navigate
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.navigate('c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123', {
  url: 'https://example.com',
});

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.navigate(
id="c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
url="https://example.com",
)
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.Navigate(
context.TODO(),
"c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
stagehand.SessionNavigateParams{
URL: "https://example.com",
},
)
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.SessionNavigateParams;
import com.browserbase.api.models.sessions.SessionNavigateResponse;

public final class Main {
private Main() {}

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

SessionNavigateParams params = SessionNavigateParams.builder()
.id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123")
.url("https://example.com")
.build();
SessionNavigateResponse response = client.sessions().navigate(params);
}
}
package com.browserbase.api.example

import com.browserbase.api.client.StagehandClient
import com.browserbase.api.client.okhttp.StagehandOkHttpClient
import com.browserbase.api.models.sessions.SessionNavigateParams
import com.browserbase.api.models.sessions.SessionNavigateResponse

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

val params: SessionNavigateParams = SessionNavigateParams.builder()
.id("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123")
.url("https://example.com")
.build()
val response: SessionNavigateResponse = client.sessions().navigate(params)
}
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.navigate("c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123", url: "https://example.com")

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->navigate(
'c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123',
url: 'https://example.com',
frameID: 'frameId',
options: [
'referer' => 'referer', 'timeout' => 30000, 'waitUntil' => 'networkidle'
],
streamResponse: true,
xStreamResponse: 'true',
);

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

StagehandClient client = new();

SessionNavigateParams parameters = new()
{
ID = "c4dbf3a9-9a58-4b22-8a1c-9f20f9f9e123",
UrlValue = "https://example.com",
};

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

Console.WriteLine(response);
curl --request POST \
--url https://api.stagehand.browserbase.com/v1/sessions/{id}/navigate \
--header 'Content-Type: application/json' \
--header 'x-bb-api-key: <api-key>' \
--header 'x-bb-project-id: <api-key>' \
--data '
{
"url": "https://example.com",
"options": {
"referer": "<string>",
"timeout": 30000,
"waitUntil": "networkidle"
},
"frameId": "<string>",
"streamResponse": true
}
'
{
  "success": true,
  "data": {
    "result": "<unknown>",
    "actionId": "<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"

Body

application/json
url
string
required

URL to navigate to

Example:

"https://example.com"

options
object
frameId
string | null

Target frame ID for the navigation

streamResponse
boolean

Whether to stream the response via SSE

Example:

true

Response

200 - application/json

Default Response

success
boolean
required

Indicates whether the request was successful

data
object
required