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

# Update album

> Add media files to an existing album



## OpenAPI

````yaml patch /boxes/{boxId}/media/albums/{albumName}
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}:
    patch:
      tags:
        - Media
      summary: Update album
      description: Add media files to an existing album
      operationId: MediaController_updateAlbum
      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
      requestBody:
        required: true
        description: 'Add media files to existing album (max size: 512MB per file)'
        content:
          multipart/form-data:
            schema:
              oneOf:
                - $ref: '#/components/schemas/UpdateAlbumByFiles'
      responses:
        '200':
          description: Album updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Album'
      security:
        - bearer: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import GboxSDK from "gbox-sdk";
            import fs from "fs";

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

              // Create a new album with media files
              const album = await box.media.createAlbum({
                name: "vacation-2024",
                media: [
                  "/path/to/photo1.jpg",
                  "/path/to/photo2.jpg",
                ]
              });

              // Append additional media files to the album
              await album.appendMedia([
                "/path/to/photo3.jpg",
              ])
            }

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

                # Create a new album with media files
                album = box.media.create_album(
                    name="vacation-2024",
                    media=[
                        "/path/to/photo1.jpg",
                        "/path/to/photo2.jpg",
                    ]
                )

                # Append additional media files to the album
                album.append_media([
                    "/path/to/photo3.jpg",
                ])

            if __name__ == "__main__":
                main()
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\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// Create a new album with media files\n\talbum, err := box.Media.CreateAlbum(context.Background(), &gbox.CreateAlbumRequest{\n\t\tName: \"vacation-2024\",\n\t\tMedia: []string{\n\t\t\t\"/path/to/photo1.jpg\",\n\t\t\t\"/path/to/photo2.jpg\",\n\t\t},\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to create album: %v\", err)\n\t}\n\n\t// Append additional media files to the album\n\terr = album.AppendMedia(context.Background(), []string{\n\t\t\"/path/to/photo3.jpg\",\n\t})\n\tif err != nil {\n\t\tlog.Fatalf(\"Failed to append media: %v\", err)\n\t}\n}"
components:
  schemas:
    UpdateAlbumByFiles:
      type: object
      properties:
        media:
          type: array
          description: 'Media files to add to the album (max size: 512MB per file)'
          title: UpdateAlbumByFiles
          items:
            type: string
            format: binary
      title: Update Album By Files
      description: Request to add uploaded media files to an existing album
      required:
        - media
    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

````