Skip to main content
POST
/
boxes
/
{boxId}
/
media
/
albums
JavaScript
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",
    ]
  });

  console.log(`✅ Album created: ${album.data.name}`);

}

main();
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
# The media parameter accepts a list of file paths
album = box.media.create_album(
name="vacation-2024",
media=[
"/path/to/photo1.jpg",
"/path/to/photo2.jpg",
]
)

# Print the created album information
print(f"✅ Album created: {album.data.name}")

if __name__ == "__main__":
main()
curl --request POST \
--url https://gbox.ai/api/v1/boxes/{boxId}/media/albums \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form 'name=Vacation Photos' \
--form media.items='@example-file'
{
  "name": "Vacation Photos",
  "path": "/sdcard/albums/vacation",
  "lastModified": "2021-01-01T00:00:00Z",
  "mediaCount": 15
}

Authorizations

Authorization
string
header
required

Enter your API Key in the format: Bearer . Get it from https://gbox.ai

Path Parameters

boxId
string
required

Box ID

Example:

"c9bdc193-b54b-4ddb-a035-5ac0c598d32d"

Body

multipart/form-data

Album creation with media files (max size: 512MB per file)

Request to create a new album with uploaded media files

name
string
required

Name of the album to create

Example:

"Vacation Photos"

media
file[]

Media files to include in the album (max size: 512MB per file)

Response

201 - application/json

Album created successfully

Album representation

name
string
required

Name of the album

Example:

"Vacation Photos"

path
string
required

Full path to the album in the box

Example:

"/sdcard/albums/vacation"

lastModified
string<date-time>
required

Last modified time of the album

Example:

"2021-01-01T00:00:00Z"

mediaCount
number
required

Number of media files in the album

Example:

15