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

# Terminate box

> Terminate a running box. This action will stop the box and release its resources.



## OpenAPI

````yaml post /boxes/{boxId}/terminate
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}/terminate:
    post:
      tags:
        - Box
      summary: Terminate box
      description: >-
        Terminate a running box. This action will stop the box and release its
        resources.
      operationId: BoxController_terminateBox
      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/BoxWait'
      responses:
        '200':
          description: terminate box success
      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 'get' method to establish a connection to the box for interactions\n  const box = await gboxSDK.get(boxId);\n\n  // Terminate the box\n  await box.terminate();\n\n  console.log(`Box terminated: ${JSON.stringify(box.data.status)}`);\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' method to establish a connection to the box for
            interactions

            box = gbox_sdk.get(box_id)


            # Terminate the box

            box.terminate()


            print(f"Box terminated: {box.data.status}")
        - 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 '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 attach to box: %v\", err)\n\t}\n\n\t// Terminate the box\n\terr = box.Terminate(context.Background())\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to terminate box: %v\", err)\n\t}\n\n\tfmt.Printf(\"Box terminated: %v\\n\", box.Data.Status)\n}"
components:
  schemas:
    BoxWait:
      type: object
      properties:
        wait:
          type: boolean
          default: true
          description: Wait for the box operation to be completed, default is true
          title: BoxWait
          example: true
      title: Box Wait
      description: Configuration for box operation waiting behavior
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        Enter your API Key in the format: Bearer <token>. Get it from
        https://gbox.ai

````