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

# Live view url

> This endpoint allows you to generate a pre-signed URL for accessing the live view of a running box. The URL is valid for a limited time and can be used to view the box's live stream.



## OpenAPI

````yaml post /boxes/{boxId}/live-view-url
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}/live-view-url:
    post:
      tags:
        - Box
      summary: Live view url
      description: >-
        This endpoint allows you to generate a pre-signed URL for accessing the
        live view of a running box. The URL is valid for a limited time and can
        be used to view the box's live stream.
      operationId: BoxController_getLiveViewUrl
      parameters:
        - name: boxId
          required: true
          in: path
          description: Box ID
          schema:
            example: c9bdc193-b54b-4ddb-a035-5ac0c598d32d
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LiveView'
      responses:
        '201':
          description: Generate pre-signed live view url
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LiveViewResult'
      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: "android" });

              const liveViewUrl = await box.liveView();

              console.log(`Live view url: ${liveViewUrl.url}`);
            }

            main();
        - lang: Python
          source: |-
            import os
            from gbox_sdk import GboxSDK

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

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

            live_view_url = box.live_view()

            print(f"Live view url: {live_view_url.url}")
        - lang: Go
          source: "package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n)\n\nfunc main() {\n\tgboxSDK := gbox.NewGboxSDK(os.Getenv(\"GBOX_API_KEY\"))\n\n\tbox, err := gboxSDK.Create(context.Background(), gbox.CreateBoxRequest{\n\t\tType: \"android\",\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create box: %v\", err)\n\t}\n\n\tlive_view_url, err := box.LiveView(context.Background())\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to get live view url: %v\", err)\n\t}\n\n\tfmt.Printf(\"Live view url: %s\\n\", live_view_url.Url)\n}"
components:
  schemas:
    LiveView:
      type: object
      properties:
        expiresIn:
          type: string
          description: >-
            The live view will be alive for the given duration


            Supported time units: ms (milliseconds), s (seconds), m (minutes), h
            (hours)

            Example formats: "500ms", "30s", "5m", "1h"

            Default: 180m
          example: 180m
          default: 180m
          title: LiveView
      title: Live View
      description: Live view configuration
    LiveViewResult:
      type: object
      properties:
        url:
          type: string
          description: >-
            Live view url with Gbox interface and basic information, typically
            used for real-time observation of box usage status
          example: https://gbox.ai/share/live-view/tmp_xxxxxxx
        rawUrl:
          type: string
          description: >-
            Raw live view url without additional layout content, typically used
            for embedding into your own application
          example: https://gbox.ai/share/live-view/tmp_xxxxxxx/raw
      title: Live View Result
      description: Live view result
      required:
        - url
        - rawUrl
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        Enter your API Key in the format: Bearer <token>. Get it from
        https://gbox.ai

````