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" });
// Update tab at index 0 to navigate to GitHub
const updatedTab = await box.browser.updateTab(
"1",
"https://github.com"
);
console.log(`Tab updated successfully:`);
console.log(` ID: ${updatedTab.id}`);
console.log(` Title: ${updatedTab.title}`);
console.log(` URL: ${updatedTab.url}`);
}
main();import os
from gbox_sdk import GboxSDK
def main():
gbox_sdk = GboxSDK(api_key=os.environ["GBOX_API_KEY"])
box = gbox_sdk.create(type="linux")
# Update tab with ID "1" to navigate to GitHub
updated_tab = box.browser.update_tab(
tab_id="1",
url="https://github.com"
)
print(f"Tab updated successfully:")
print(f" ID: {updated_tab.id}")
print(f" Title: {updated_tab.title}")
print(f" URL: {updated_tab.url}")
if __name__ == "__main__":
main()curl --request PUT \
--url https://gbox.ai/api/v1/boxes/{boxId}/browser/tabs/{tabId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://www.google.com"
}
'{
"id": "1",
"title": "Google",
"url": "https://www.google.com",
"favicon": "https://www.google.com/favicon.ico",
"active": true,
"loading": false
}Update browser tab URL
Navigate an existing browser tab to a new URL. This endpoint updates the specified tab by navigating it to the provided URL and returns the updated tab information. The browser will wait for the DOM content to be loaded before returning the response. If the navigation fails due to an invalid URL or network issues, an error will be returned. The updated tab information will include the new title, final URL (after any redirects), and favicon from the new page.
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" });
// Update tab at index 0 to navigate to GitHub
const updatedTab = await box.browser.updateTab(
"1",
"https://github.com"
);
console.log(`Tab updated successfully:`);
console.log(` ID: ${updatedTab.id}`);
console.log(` Title: ${updatedTab.title}`);
console.log(` URL: ${updatedTab.url}`);
}
main();import os
from gbox_sdk import GboxSDK
def main():
gbox_sdk = GboxSDK(api_key=os.environ["GBOX_API_KEY"])
box = gbox_sdk.create(type="linux")
# Update tab with ID "1" to navigate to GitHub
updated_tab = box.browser.update_tab(
tab_id="1",
url="https://github.com"
)
print(f"Tab updated successfully:")
print(f" ID: {updated_tab.id}")
print(f" Title: {updated_tab.title}")
print(f" URL: {updated_tab.url}")
if __name__ == "__main__":
main()curl --request PUT \
--url https://gbox.ai/api/v1/boxes/{boxId}/browser/tabs/{tabId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"url": "https://www.google.com"
}
'{
"id": "1",
"title": "Google",
"url": "https://www.google.com",
"favicon": "https://www.google.com/favicon.ico",
"active": true,
"loading": false
}Authorizations
Enter your API Key in the format: Bearer . Get it from https://gbox.ai
Path Parameters
Box ID
"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"
Body
New URL to navigate the tab to
Update tab url
The tab new url
"https://www.google.com"
Response
Successfully updated tab
Browser tab
The tab id
"1"
The tab title
"Google"
The tab url
"https://www.google.com"
The tab favicon
"https://www.google.com/favicon.ico"
Whether the tab is the current active (frontmost) tab
true
Whether the tab is currently in a loading state.
The value is true while the browser is still navigating to the target URL or fetching sub-resources (i.e. document.readyState is not "complete"). It typically switches to false once the load event fires and all major network activity has settled.
false
Was this page helpful?