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

# List media in album

> Get a list of media files in a specific album



## OpenAPI

````yaml get /boxes/{boxId}/media/albums/{albumName}/media
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:
    get:
      tags:
        - Media
      summary: List media in album
      description: Get a list of media files in a specific album
      operationId: MediaController_listMedia
      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
      responses:
        '200':
          description: List of media files
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAlbumMediaResult'
      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" });

              console.info("taking screenshot and saving to album...");
              await box.action.screenshot({
                saveToAlbum: true
              })

              const album = await box.media.getAlbum("Screenshots");

              console.info("listing media info...");

              const mediaInfo = await album.listMediaInfo();

              console.info(`media info: ${JSON.stringify(mediaInfo, null, 2)}`);

              const media = await album.listMedia();

              console.info("downloading media...");
              for (const item of media) {
                await item.download(`./${item.data.name}`);
              }

            }

            main();
        - 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\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\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:
  schemas:
    ListAlbumMediaResult:
      type: object
      properties:
        data:
          type: array
          description: List of media files (photos and videos) in the album
          items:
            oneOf:
              - $ref: '#/components/schemas/Photo'
              - $ref: '#/components/schemas/Video'
      title: List Album Media Result
      description: List album media
      required:
        - data
    Photo:
      type: object
      properties:
        type:
          type: string
          enum:
            - photo
          description: Photo type indicator
          title: Photo
        mimeType:
          type: string
          description: MIME type of the photo
          title: Photo
          example: image/jpeg
        name:
          type: string
          description: Name of the photo
          title: Photo
          example: IMG_001.jpg
        path:
          type: string
          description: Full path to the photo in the box
          title: Photo
          example: /sdcard/albums/vacation/IMG_001.jpg
        size:
          type: string
          description: Size of the photo
          title: Photo
          example: 2.5MB
        lastModified:
          format: date-time
          type: string
          description: Last modified time of the photo
          title: Photo
          example: '2021-01-01T00:00:00Z'
      title: Photo
      description: Photo representation
      required:
        - type
        - mimeType
        - name
        - path
        - size
        - lastModified
    Video:
      type: object
      properties:
        type:
          type: string
          enum:
            - video
          description: Video type indicator
          title: Video
        mimeType:
          type: string
          description: MIME type of the video
          title: Video
          example: video/mp4
        name:
          type: string
          description: Name of the video
          title: Video
          example: VID_001.mp4
        path:
          type: string
          description: Full path to the video in the box
          title: Video
          example: /sdcard/albums/vacation/VID_001.mp4
        size:
          type: string
          description: Size of the video
          title: Video
          example: 100MB
        lastModified:
          format: date-time
          type: string
          description: Last modified time of the video
          title: Video
          example: '2021-01-01T00:00:00Z'
      title: Video
      description: Video representation
      required:
        - type
        - mimeType
        - name
        - path
        - size
        - lastModified
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        Enter your API Key in the format: Bearer <token>. Get it from
        https://gbox.ai

````