> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gbox.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Open a new browser tab

> Create and open a new browser tab with the specified URL. This endpoint will navigate to the provided URL and return the new tab's information including its assigned id, loaded title, final URL (after any redirects), and favicon. The returned tab id can be used for future operations on this specific tab. The browser will attempt to load the page and will wait for the DOM content to be loaded before returning the response. If the URL is invalid or unreachable, an error will be returned.



## OpenAPI

````yaml post /boxes/{boxId}/browser/tabs
openapi: 3.0.0
info:
  title: GBOX Open API
  description: GBOX Open API Documentation
  version: '1.0'
  contact: {}
servers:
  - url: https://gbox.ai/api/v1
    description: Production Server
security: []
tags: []
paths:
  /boxes/{boxId}/browser/tabs:
    post:
      tags:
        - Browser
      summary: Open a new browser tab
      description: >-
        Create and open a new browser tab with the specified URL. This endpoint
        will navigate to the provided URL and return the new tab's information
        including its assigned id, loaded title, final URL (after any
        redirects), and favicon. The returned tab id can be used for future
        operations on this specific tab. The browser will attempt to load the
        page and will wait for the DOM content to be loaded before returning the
        response. If the URL is invalid or unreachable, an error will be
        returned.
      operationId: BrowserController_openTab
      parameters:
        - name: boxId
          required: true
          in: path
          description: Box ID
          schema:
            example: c9bdc193-b54b-4ddb-a035-5ac0c598d32d
            type: string
      requestBody:
        required: true
        description: URL to open in the new tab
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenTab'
            examples:
              google:
                summary: Open Google
                value:
                  url: https://www.google.com
              github:
                summary: Open GitHub
                value:
                  url: https://github.com
      responses:
        '200':
          description: Successfully opened new tab
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BrowserTab'
      security:
        - bearer: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            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(`  Id: ${newTab.id}`);
              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();
        - lang: Python
          source: |-
            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")

                # Open a new tab with Google
                new_tab = box.browser.open_tab(
                    url="https://www.google.com"
                )

                print(f"New tab opened successfully:")
                print(f"  Id: {new_tab.id}")
                print(f"  Title: {new_tab.title}")
                print(f"  URL: {new_tab.url}")

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

                for url in urls:
                    tab = box.browser.open_tab(url=url)
                    print(f"Opened tab: {tab.title} - {tab.url}")

            if __name__ == "__main__":
                main()
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/gbox/gbox-sdk-go\"\n)\n\nfunc main() {\n\tgboxSDK := gbox.NewGboxSDK(os.Getenv(\"GBOX_API_KEY\"))\n\n\tbox, err := gboxSDK.Create(context.Background(), gbox.CreateOptions{Type: \"linux\"})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create linux box: %v\", err)\n\t}\n\n\t// Open a new tab with Google\n\tnewTab, err := box.Browser.OpenTab(context.Background(), &gbox.OpenTabRequest{\n\t\tURL: \"https://www.google.com\",\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to open new tab: %v\", err)\n\t}\n\n\tfmt.Printf(\"New tab opened successfully:\\n\")\n\tfmt.Printf(\"  Id: %d\\n\", newTab.Id)\n\tfmt.Printf(\"  Title: %s\\n\", newTab.Title)\n\tfmt.Printf(\"  URL: %s\\n\", newTab.URL)\n\n\t// Open multiple tabs\n\turls := []string{\n\t\t\"https://github.com\",\n\t\t\"https://stackoverflow.com\",\n\t\t\"https://developer.mozilla.org\",\n\t}\n\n\tfor _, url := range urls {\n\t\ttab, err := box.Browser.OpenTab(context.Background(), &gbox.OpenTabRequest{\n\t\t\tURL: url,\n\t\t})\n\t\tif err != nil {\n\t\t\tlog.Printf(\"Failed to open tab for %s: %v\", url, err)\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Printf(\"Opened tab: %s - %s\\n\", tab.Title, tab.URL)\n\t}\n}"
components:
  schemas:
    OpenTab:
      type: object
      properties:
        url:
          type: string
          description: The tab url
          example: https://www.google.com
          title: TabUrl
      title: Open Tab
      description: Open tab
      required:
        - url
    BrowserTab:
      type: object
      properties:
        id:
          type: string
          description: The tab id
          example: '1'
          title: TabId
        title:
          type: string
          description: The tab title
          example: Google
          title: TabTitle
        url:
          type: string
          description: The tab url
          example: https://www.google.com
          title: TabUrl
        favicon:
          type: string
          description: The tab favicon
          example: https://www.google.com/favicon.ico
          title: TabFavicon
        active:
          type: boolean
          description: Whether the tab is the current active (frontmost) tab
          example: true
          title: TabActive
        loading:
          type: boolean
          description: >-
            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.
          example: false
          title: TabLoading
      title: Browser Tab
      description: Browser tab
      required:
        - id
        - title
        - url
        - favicon
        - active
        - loading
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        Enter your API Key in the format: Bearer <token>. Get it from
        https://gbox.ai

````