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

# Delete media from album

> Delete a specific media file from an album



## OpenAPI

````yaml delete /boxes/{boxId}/media/albums/{albumName}/media/{mediaName}
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}:
    delete:
      tags:
        - Media
      summary: Delete media from album
      description: Delete a specific media file from an album
      operationId: MediaController_deleteMedia
      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:
        '204':
          description: Media deleted successfully
      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("deleting all media in album...");

              for (const media of await album.listMedia()) {
                await album.deleteMedia(media.data.name);
                console.info(`deleted ${media.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("deleting all media in album...")

                # Delete all media in the album
                for media in album.list_media():
                    album.delete_media(media.data.name)
                    print(f"deleted {media.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(\"deleting all media in album...\")\n\n\t// Get all media in the album and delete them\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\t// Delete all media in the album\n\tfor _, item := range media {\n\t\terr = box.Media.DeleteMedia(context.Background(), \"Screenshots\", item.Data.Name)\n\t\tif err != nil {\n\t\t\tlog.Fatalf(\"Failed to delete media: %v\", err)\n\t\t}\n\t\tfmt.Printf(\"deleted %s\\n\", item.Data.Name)\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

````