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

# Download media

> Download a specific media file from an album



## OpenAPI

````yaml get /boxes/{boxId}/media/albums/{albumName}/media/{mediaName}/download
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}/media/albums/{albumName}/media/{mediaName}/download:
    get:
      tags:
        - Media
      summary: Download media
      description: Download a specific media file from an album
      operationId: MediaController_downloadMedia
      parameters:
        - name: boxId
          required: true
          in: path
          description: Box ID
          schema:
            example: c9bdc193-b54b-4ddb-a035-5ac0c598d32d
            type: string
        - name: albumName
          required: true
          in: path
          description: Album name
          schema:
            example: Pictures
            type: string
        - name: mediaName
          required: true
          in: path
          description: Media name
          schema:
            example: IMG_001.jpg
            type: string
      responses:
        '200':
          description: Media file content
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
      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  console.info(\"taking screenshot and saving to album...\");\n\n  await box.action.screenshot({\n    saveToAlbum: true\n  })\n\n  const album = await box.media.getAlbum(\"Screenshots\");\n\n  console.info(\"listing media info...\");\n\n  const mediaInfo = await album.listMediaInfo();\n\n  console.info(`media info: ${JSON.stringify(mediaInfo, null, 2)}`);\n\n  const media = await album.listMedia();\n\n  console.info(\"downloading media...\");\n\t\n  for (const item of media) {\n    await item.download(`./${item.data.name}`);\n  }\n\n}\n\nmain();"
        - lang: Python
          source: |-
            import os
            from gbox_sdk import GboxSDK

            def main():
                # Initialize GboxSDK with API key from environment variable
                gbox_sdk = GboxSDK(api_key=os.environ["GBOX_API_KEY"])

                # Create an Android box for media operations
                box = gbox_sdk.create(type="android")

                print("taking screenshot and saving to album...")

                # Take screenshot and save to album
                box.action.screenshot(save_to_album=True)

                # Get the Screenshots album
                album = box.media.get_album("Screenshots")

                print("listing media info...")

                # Get media information
                media_info = album.list_media_info()
                print(f"media info: {media_info}")

                # Get media list
                media = album.list_media()

                print("downloading media...")

                # Download each media file
                for item in media:
                    item.download(f"./{item.data.name}")

            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\t// Initialize GboxSDK with API key from environment variable\n\tgboxSDK := gbox.NewGboxSDK(os.Getenv(\"GBOX_API_KEY\"))\n\n\t// Create an Android box for media operations\n\tbox, err := gboxSDK.Create(context.Background(), gbox.CreateOptions{Type: \"android\"})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create android box: %v\", err)\n\t}\n\n\tfmt.Println(\"taking screenshot and saving to album...\")\n\n\t// Take screenshot and save to album\n\terr = box.Action.Screenshot(context.Background(), &gbox.ScreenshotOptions{\n\t\tSaveToAlbum: true,\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to take screenshot: %v\", err)\n\t}\n\n\t// Get the Screenshots album\n\talbum, err := box.Media.GetAlbum(context.Background(), \"Screenshots\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to get album: %v\", err)\n\t}\n\n\tfmt.Println(\"listing media info...\")\n\n\t// Get media information\n\tmediaInfo, err := album.ListMediaInfo(context.Background())\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to list media info: %v\", err)\n\t}\n\tfmt.Printf(\"media info: %+v\\n\", mediaInfo)\n\n\t// Get media list\n\tmedia, err := album.ListMedia(context.Background())\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to list media: %v\", err)\n\t}\n\n\tfmt.Println(\"downloading media...\")\n\n\t// Download each media file\n\tfor _, item := range media {\n\t\terr = item.Download(context.Background(), fmt.Sprintf(\"./%s\", item.Data.Name))\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to download media: %v\", err)\n\t\t}\n\t}\n}"
components:
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        Enter your API Key in the format: Bearer <token>. Get it from
        https://gbox.ai

````