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

> Get a list of albums in the box



## OpenAPI

````yaml get /boxes/{boxId}/media/albums
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:
    get:
      tags:
        - Media
      summary: List albums
      description: Get a list of albums in the box
      operationId: MediaController_listAlbums
      parameters:
        - name: boxId
          required: true
          in: path
          description: Box ID
          schema:
            example: c9bdc193-b54b-4ddb-a035-5ac0c598d32d
            type: string
      responses:
        '200':
          description: List albums
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListAlbumsResult'
      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" });

              // List albums
              const albums = await box.media.listAlbums();

              console.log("Albums found:");
              for (const album of albums) {
                console.info(`📁 ${album.data.name} - ${album.data.path}`);
                console.info(`Last modified: ${album.data.lastModified}`);
              }
            }

            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")

                # List all albums
                albums = box.media.list_albums()

                # Print album information
                print("Albums found:")
                for album in albums:
                    print(f"📁 {album.data.name} - {album.data.path}")
                    print(f"Last modified: {album.data.last_modified}")

            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\t// List all albums\n\talbums, err := box.Media.ListAlbums(context.Background())\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to list albums: %v\", err)\n\t}\n\n\t// Print album information\n\tfmt.Println(\"Albums found:\")\n\tfor _, album := range albums {\n\t\tfmt.Printf(\"📁 %s - %s\\n\", album.Data.Name, album.Data.Path)\n\t\tfmt.Printf(\"Last modified: %s\\n\", album.Data.LastModified)\n\t}\n}"
components:
  schemas:
    ListAlbumsResult:
      type: object
      properties:
        data:
          type: array
          description: List of albums
          title: ListAlbums
          items:
            $ref: '#/components/schemas/Album'
      title: List Albums Result
      description: List albums
      required:
        - data
    Album:
      type: object
      properties:
        name:
          type: string
          description: Name of the album
          title: Album
          example: Vacation Photos
        path:
          type: string
          description: Full path to the album in the box
          title: Album
          example: /sdcard/albums/vacation
        lastModified:
          format: date-time
          type: string
          description: Last modified time of the album
          title: Album
          example: '2021-01-01T00:00:00Z'
        mediaCount:
          type: number
          description: Number of media files in the album
          title: Album
          example: 15
      title: Album
      description: Album representation
      required:
        - name
        - path
        - lastModified
        - mediaCount
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: >-
        Enter your API Key in the format: Bearer <token>. Get it from
        https://gbox.ai

````