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

# Install app

> Install an Android app on the box



## OpenAPI

````yaml post /boxes/{boxId}/android/packages
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}/android/packages:
    post:
      tags:
        - Android
      summary: Install app
      description: Install an Android app on the box
      operationId: AndroidController_installAndroidPkg
      parameters:
        - name: boxId
          required: true
          in: path
          description: Box ID
          schema:
            example: c9bdc193-b54b-4ddb-a035-5ac0c598d32d
            type: string
      requestBody:
        required: true
        description: 'APK file upload or URL (max size: 512MB)'
        content:
          multipart/form-data:
            schema:
              oneOf:
                - $ref: '#/components/schemas/InstallAndroidPkgByFile'
                - $ref: '#/components/schemas/InstallAndroidPkgByUrl'
      responses:
        '201':
          description: Android pkg installed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InstallAndroidPkgResult'
        '413':
          description: Apk file too large (max 512MB)
      security:
        - bearer: []
      x-codeSamples:
        - lang: JavaScript
          source: "import GboxSDK from \"gbox-sdk\";\nimport fs from \"fs\";\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  const box = await gboxSDK.create({ type: \"android\" });\n\n  // Install Android app from URL\n  const app = await box.app.install({\n    apk: \"https://github.com/gsantner/markor/releases/download/v2.14.1/net.gsantner.markor-v158-2.14.1-flavorDefault-release.apk\"\n  });\n\n\t// Or install Android app from APK file\n  // const apkFile = fs.createReadStream(\"path/to/your/app.apk\");\n  // const app =  await box.app.install({ apk: apkFile });\n\n  console.log(`Android app installed successfully: ${app.data.packageName}`);\n\n  await app.open();\n}\n\nmain();"
        - lang: Python
          source: |-
            import os
            from gbox_sdk import GboxSDK

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

                # Create Android box
                box = gbox_sdk.create(type="android")

                # Install Android app from URL
                app = box.app.install(
                    apk="https://github.com/gsantner/markor/releases/download/v2.14.1/net.gsantner.markor-v158-2.14.1-flavorDefault-release.apk"
                )

                # Or install Android app from APK file
                # with open("path/to/your/app.apk", "rb") as apk_file:
                #     app = box.app.install(apk=apk_file)

                print(f"Android app installed successfully: {app.data.package_name}")

                app.open()

            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\t// Create Android box\n\tbox, err := gboxSDK.Create(context.Background(), gbox.CreateRequest{Type: \"android\"})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create box: %v\", err)\n\t}\n\n\t// Install Android app from URL\n\tapp, err := box.App.Install(context.Background(), gbox.InstallRequest{\n\t\tApk: \"https://github.com/gsantner/markor/releases/download/v2.14.1/net.gsantner.markor-v158-2.14.1-flavorDefault-release.apk\",\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to install Android app from URL: %v\", err)\n\t}\n\n\t// Or install Android app from APK file\n\t// apkFile, err := os.Open(\"path/to/your/app.apk\")\n\t// if err != nil {\n\t//     log.Fatalf(\"Failed to open APK file: %v\", err)\n\t// }\n\t// defer apkFile.Close()\n\t//\n\t// app, err := box.App.Install(context.Background(), gbox.InstallRequest{Apk: apkFile})\n\t// if err != nil {\n\t//     log.Fatalf(\"Failed to install Android app: %v\", err)\n\t// }\n\n\tfmt.Printf(\"Android app installed successfully: %s\\n\", app.Data.PackageName)\n\n\terr = app.Open(context.Background())\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to open Android app: %v\", err)\n\t}\n}"
components:
  schemas:
    InstallAndroidPkgByFile:
      type: object
      properties:
        open:
          type: boolean
          description: >-
            Whether to open the app after installation. Will find and launch the
            launcher activity of the installed app. If there are multiple
            launcher activities, only one will be opened. If the installed APK
            has no launcher activity, this parameter will have no effect.
          example: false
          default: false
        apk:
          type: string
          description: >-
            APK file or ZIP archive to install (max file size: 512MB).


            **Single APK mode:**

            - Upload a single APK file (e.g., app.apk)

            - System will automatically detect and install as single APK


            **Multi-APK mode (automatically detected):**

            - Upload a ZIP archive containing multiple APK files

            - System will automatically detect ZIP format and install all APKs
            inside

            - ZIP filename example: com.reddit.frontpage-gplay.zip

            - ZIP contents example:


            com.reddit.frontpage-gplay.zip

            └── com.reddit.frontpage-gplay/ (folder)
                ├── reddit-base.apk (base APK)
                ├── reddit-arm64.apk (architecture-specific)
                ├── reddit-en.apk (language pack)
                └── reddit-mdpi.apk (density-specific resources)

            This is commonly used for split APKs where different components are
            separated by architecture, language, or screen density.
          format: binary
          example: Select APK file or ZIP archive
      title: Install Android Pkg By File
      description: Request for installing Android pkg from uploaded APK file or ZIP archive
      required:
        - apk
    InstallAndroidPkgByUrl:
      type: object
      properties:
        open:
          type: boolean
          description: >-
            Whether to open the app after installation. Will find and launch the
            launcher activity of the installed app. If there are multiple
            launcher activities, only one will be opened. If the installed APK
            has no launcher activity, this parameter will have no effect.
          example: false
          default: false
        apk:
          type: string
          description: >-
            HTTP URL to download APK file or ZIP archive (max file size: 512MB).


            **Single APK mode (automatically detected):**

            - Provide URL to a single APK file

            - System will automatically detect .apk extension and install as
            single APK

            - Example: https://example.com/app.apk


            **Multi-APK mode (automatically detected):**

            - Provide URL to a ZIP archive containing multiple APK files

            - System will automatically detect .zip extension and install all
            APKs inside

            - ZIP filename example: com.reddit.frontpage-gplay.zip

            - ZIP contents example:


            com.reddit.frontpage-gplay.zip

            └── com.reddit.frontpage-gplay/ (folder)
                ├── reddit-base.apk (base APK)
                ├── reddit-arm64.apk (architecture-specific)
                ├── reddit-en.apk (language pack)
                └── reddit-mdpi.apk (density-specific resources)
            - Example URL: https://example.com/com.reddit.frontpage-gplay.zip


            This is commonly used for split APKs where different components are
            separated by architecture, language, or screen density.
          example: https://example.com/app.apk
      title: Install Android Pkg By URL
      description: >-
        Request for installing Android pkg from HTTP URL (APK file or ZIP
        archive)
      required:
        - apk
    InstallAndroidPkgResult:
      type: object
      properties:
        packageName:
          type: string
          description: Android pkg package name
          example: com.google.android.apps.googlevoice
        apkPath:
          type: string
          description: Android apk path
          example: /data/app/com.google.android.apps.googlevoice-1/base.apk
        pkgType:
          type: string
          description: system or thirdParty
          enum:
            - system
            - thirdParty
          example: thirdParty
        activities:
          description: Activity list
          example:
            - name: Settings
              className: com.android.settings.Settings
              packageName: com.android.settings
              isExported: true
              isMain: true
            - name: About Phone
              className: com.android.settings.AboutPhone
              packageName: com.android.settings
              isExported: true
              isMain: false
          type: array
          items:
            $ref: '#/components/schemas/AndroidPkgActivity'
      title: Install Android Pkg Result
      description: Response containing the result of installing an Android pkg
      required:
        - packageName
        - apkPath
        - pkgType
        - activities
    AndroidPkgActivity:
      type: object
      properties:
        name:
          type: string
          description: Activity name
          example: Settings
        className:
          type: string
          description: Activity class name
          example: com.android.settings.Settings
        packageName:
          type: string
          description: Activity package name
          example: com.android.settings
        isExported:
          type: boolean
          description: Activity class name
          example: com.android.settings.Settings
        isMain:
          type: boolean
          description: >-
            Whether the activity is the main activity. Main activity is the
            entry point of the pkg and is typically launched when the pkg is
            started.
          example: true
        isLauncher:
          type: boolean
          description: >-
            Whether the activity is a launcher activity. Launcher activities
            appear in the device's pkg launcher/home screen and can be directly
            launched by the user.
          example: true
      title: Android Pkg Activity
      description: Android pkg activity
      required:
        - name
        - className
        - packageName
        - isExported
        - isMain
        - isLauncher
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        Enter your API Key in the format: Bearer <token>. Get it from
        https://gbox.ai

````