POST
/
boxes
/
{boxId}
/
browser
/
tabs
JavaScript
import GboxSDK from "gbox-sdk";

const gboxSDK = new GboxSDK({
  apiKey: process.env["GBOX_API_KEY"] // This is the default and can be omitted
});

async function main() {
  const box = await gboxSDK.create({ type: "linux" });

  // Open a new tab with Google
  const newTab = await box.browser.openTab({
    url: "https://www.google.com"
  });

  console.log(`New tab opened successfully:`);
  console.log(`  Index: ${newTab.index}`);
  console.log(`  Title: ${newTab.title}`);
  console.log(`  URL: ${newTab.url}`);

  // Open multiple tabs
  const urls = ["https://github.com", "https://stackoverflow.com", "https://developer.mozilla.org"];

  for (const url of urls) {
    const tab = await box.browser.openTab({ url });
    console.log(`Opened tab: ${tab.title} - ${tab.url}`);
  }
}

main();
{
  "id": "1",
  "title": "Google",
  "url": "https://www.google.com",
  "favicon": "https://www.google.com/favicon.ico",
  "active": true,
  "loading": false
}

Authorizations

Authorization
string
header
required

Enter your API Key in the format: Bearer <token>. Get it from https://gbox.ai

Path Parameters

boxId
string
required

Box ID

Example:

"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"

Body

application/json

URL to open in the new tab

Open tab

Response

200 - application/json

Successfully opened new tab

Browser tab