> ## 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.

# Get box

> This endpoint retrieves information about a box



## OpenAPI

````yaml get /boxes/{boxId}
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}:
    get:
      tags:
        - Box
      summary: Get box
      description: This endpoint retrieves information about a box
      operationId: BoxController_getBox
      parameters:
        - name: boxId
          required: true
          in: path
          description: Box ID
          schema:
            example: c9bdc193-b54b-4ddb-a035-5ac0c598d32d
            type: string
      responses:
        '200':
          description: Get box
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/LinuxBox'
                  - $ref: '#/components/schemas/AndroidBox'
      security:
        - bearer: []
      x-codeSamples:
        - lang: JavaScript
          source: "import GboxSDK from \"gbox-sdk\";\n\nconst gboxSDK = new GboxSDK({\n  apiKey: process.env[\"GBOX_API_KEY\"] // This is the default and can be omitted\n});\n\nasync function main() {\n  // Create a new Android box for demonstration purposes\n\tconst boxId = (await gboxSDK.create({ type: \"android\" })).data.id;\n\n  // Use the 'getInfo' method to retrieve static information about the box\n  const boxInfo = await gboxSDK.getInfo(boxId);\n\n  // Log the box information to the console\n  console.log(`Box Info: ${JSON.stringify(boxInfo)}`);\n\n  // Use the 'get' method to establish a connection to the box for interactions\n  const box = await gboxSDK.get(boxId);\n\n  // Perform an action on the box (click at coordinates 100, 100)\n  await box.action.click({ x: 100, y: 100 });\n\n  console.log(`Attached Box: ${JSON.stringify(box.data.id)}`);\n}\n\nmain();"
        - lang: Python
          source: >-
            import os

            from gbox_sdk import GboxSDK


            gbox_sdk = GboxSDK(api_key=os.environ["GBOX_API_KEY"])


            # Create a new Android box for demonstration purposes

            box_response = gbox_sdk.create(type="android")

            box_id = box_response.data.id


            # Use the 'get_info' method to retrieve static information about the
            box

            box_info = gbox_sdk.get_info(box_id)


            # Log the box information to the console

            print(f"Box Info: {box_info}")


            # Use the 'get' method to establish a connection to the box for
            interactions

            box = gbox_sdk.get(box_id)


            # Perform an action on the box (click at coordinates 100, 100)

            box.action.click(x=100, y=100)


            print(f"Attached Box: {box.data.id}")
        - 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\t// Create a new Android box for demonstration purposes\n\tboxResponse, err := gboxSDK.Create(context.Background(), \"android\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create box: %v\", err)\n\t}\n\tboxID := boxResponse.Data.ID\n\n\t// Use the 'GetInfo' method to retrieve static information about the box\n\tboxInfo, err := gboxSDK.GetInfo(context.Background(), boxID)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to get box info: %v\", err)\n\t}\n\n\t// Log the box information to the console\n\tfmt.Printf(\"Box Info: %v\\n\", boxInfo)\n\n\t// Use the 'Get' method to establish a connection to the box for interactions\n\tbox, err := gboxSDK.Get(context.Background(), boxID)\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to get instance: %v\", err)\n\t}\n\n\t// Perform an action on the box (click at coordinates 100, 100)\n\tbox.Action.Click(100, 100)\n\n\tfmt.Printf(\"Attached Box: %v\\n\", box.Data.ID)\n}"
components:
  schemas:
    LinuxBox:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the box
          title: BaseBox
          example: c9bdc193-b54b-4ddb-a035-5ac0c598d32d
        status:
          type: string
          enum:
            - pending
            - running
            - error
            - terminated
          description: The current status of a box instance
          title: BaseBox
          example: running
        createdAt:
          format: date-time
          type: string
          description: Creation timestamp of the box
          title: BaseBox
          example: '2024-01-15T10:30:00.000Z'
        updatedAt:
          format: date-time
          type: string
          description: Last update timestamp of the box
          title: BaseBox
          example: '2024-01-15T10:35:00.000Z'
        expiresAt:
          type: string
          format: date-time
          description: Expiration timestamp of the box
          title: BaseBox
          example: '2024-01-15T10:40:00.000Z'
          nullable: true
        reason:
          type: string
          description: The reason for the current status, if any
          title: BaseBox
          example: Box terminated by user
          nullable: true
        type:
          type: string
          enum:
            - linux
          default: linux
          description: Box type is Linux
          title: LinuxBox
          example: linux
        config:
          description: Configuration for a Linux box instance
          title: LinuxBox
          example:
            os:
              version: ubuntu-20.04
            deviceType: physical
            workingDir: /home/user
            labels:
              environment: development
              team: qa
            envs:
              NODE_ENV: production
              PATH: /usr/bin:/bin
            cpu: 2
            memory: 1024
            storage: 30
          allOf:
            - $ref: '#/components/schemas/LinuxConfig'
      title: Linux Box
      description: Linux box instance with full configuration and status
      required:
        - id
        - status
        - createdAt
        - updatedAt
        - expiresAt
        - type
        - config
    AndroidBox:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the box
          title: BaseBox
          example: c9bdc193-b54b-4ddb-a035-5ac0c598d32d
        status:
          type: string
          enum:
            - pending
            - running
            - error
            - terminated
          description: The current status of a box instance
          title: BaseBox
          example: running
        createdAt:
          format: date-time
          type: string
          description: Creation timestamp of the box
          title: BaseBox
          example: '2024-01-15T10:30:00.000Z'
        updatedAt:
          format: date-time
          type: string
          description: Last update timestamp of the box
          title: BaseBox
          example: '2024-01-15T10:35:00.000Z'
        expiresAt:
          type: string
          format: date-time
          description: Expiration timestamp of the box
          title: BaseBox
          example: '2024-01-15T10:40:00.000Z'
          nullable: true
        reason:
          type: string
          description: The reason for the current status, if any
          title: BaseBox
          example: Box terminated by user
          nullable: true
        type:
          type: string
          enum:
            - android
          default: android
          description: Box type is Android
          title: AndroidBox
          example: android
        config:
          description: Configuration for an Android box instance
          title: AndroidBox
          example:
            os:
              version: '12'
            deviceType: virtual
            workingDir: /data/local/tmp
            labels:
              app: mobile-testing
              env: staging
            envs:
              ANDROID_HOME: /opt/android-sdk
              DISPLAY: ':1'
            cpu: 2
            memory: 2048
            storage: 20
          allOf:
            - $ref: '#/components/schemas/AndroidConfig'
      title: Android Box
      description: Android box instance with full configuration and status
      required:
        - id
        - status
        - createdAt
        - updatedAt
        - expiresAt
        - type
        - config
    LinuxConfig:
      type: object
      properties:
        os:
          description: Operating system configuration
          title: LinuxConfig
          example:
            version: ubuntu-20.04
          allOf:
            - $ref: '#/components/schemas/LinuxOsConfig'
        workingDir:
          type: string
          description: >-
            Working directory path for the box. This directory serves as the
            default starting point for all operations including command
            execution, code running, and file system operations. When you
            execute commands or run code, they will start from this directory
            unless explicitly specified otherwise.
          title: LinuxConfig
          example: /home/user
        labels:
          type: object
          additionalProperties:
            type: string
          description: >-
            Key-value pairs of labels for the box. Labels are used to add custom
            metadata to help identify, categorize, and manage boxes. Common use
            cases include project names, environments, teams, applications, or
            any other organizational tags that help you organize and filter your
            boxes.
          title: LinuxConfig
          example:
            project: web-scraper
            environment: production
            team: backend
            version: v1.2.0
        envs:
          type: object
          additionalProperties:
            type: string
          description: >-
            Environment variables for the box. These variables will be available
            in all operations including command execution, code running, and
            other box behaviors
          title: LinuxConfig
          example:
            MY_ENV_KEY: env value
        cpu:
          type: number
          description: CPU cores allocated to the box
          title: LinuxConfig
          example: 2
        memory:
          type: number
          description: Memory allocated to the box in MiB
          title: LinuxConfig
          example: 1024
        storage:
          type: number
          description: Storage allocated to the box in GiB.
          title: LinuxConfig
          example: 30
        publicIp:
          type: string
          description: Public IP allocated to the box.
          title: LinuxConfig
          example: 8.8.8.8
        deviceType:
          type: string
          enum:
            - container
            - vm
          description: Device type - container or vm Linux device
          title: LinuxConfig
          example: container
          default: container
        snapshotName:
          type: string
          description: Snapshot name
          title: LinuxConfig
        snapshotId:
          type: string
          description: Snapshot id
          title: LinuxConfig
      title: Linux Config
      description: Complete configuration for Linux box instance
      required:
        - os
        - workingDir
        - labels
        - envs
        - cpu
        - memory
        - storage
        - publicIp
    AndroidConfig:
      type: object
      properties:
        os:
          description: Android operating system configuration
          title: AndroidConfig
          example:
            version: '12'
          allOf:
            - $ref: '#/components/schemas/AndroidOsConfig'
        deviceType:
          type: string
          enum:
            - virtual
            - physical
          description: Device type - virtual or physical Android device
          title: AndroidConfig
          example: virtual
          default: virtual
        workingDir:
          type: string
          description: >-
            Working directory path for the box. This directory serves as the
            default starting point for all operations including command
            execution, code running, and file system operations. When you
            execute commands or run code, they will start from this directory
            unless explicitly specified otherwise.
          title: AndroidConfig
          example: /data/local/tmp
        labels:
          type: object
          additionalProperties:
            type: string
          description: >-
            Key-value pairs of labels for the box. Labels are used to add custom
            metadata to help identify, categorize, and manage boxes. Common use
            cases include project names, environments, teams, applications, or
            any other organizational tags that help you organize and filter your
            boxes.
          title: AndroidConfig
          example:
            app: mobile-testing
            environment: staging
            team: qa
            device: pixel-6
        envs:
          type: object
          additionalProperties:
            type: string
          description: >-
            Environment variables for the box. These variables will be available
            in all operations including command execution, code running, and
            other box behaviors
          title: AndroidConfig
          example:
            ANDROID_HOME: /opt/android-sdk
            DISPLAY: ':1'
        cpu:
          type: number
          description: CPU cores allocated to the box
          title: AndroidConfig
          example: 2
        memory:
          type: number
          description: Memory allocated to the box in MiB
          title: AndroidConfig
          example: 2048
        storage:
          type: number
          description: Storage allocated to the box in GiB
          title: AndroidConfig
          example: 20
      title: Android Config
      description: Complete configuration for Android box instance
      required:
        - os
        - labels
        - envs
        - cpu
        - memory
        - storage
    LinuxOsConfig:
      type: object
      properties:
        version:
          type: string
          description: OS version string (e.g. 'ubuntu-20.04')
          title: LinuxOsConfig
          example: ubuntu-20.04
      title: Linux OS Config
      description: Linux operating system configuration
      required:
        - version
    AndroidOsConfig:
      type: object
      properties:
        version:
          type: string
          enum:
            - '12'
            - '13'
            - '15'
          description: Supported Android versions
          title: AndroidOsConfig
          example: '12'
      title: Android OS Config
      description: Android operating system configuration
      required:
        - version
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        Enter your API Key in the format: Bearer <token>. Get it from
        https://gbox.ai

````