Skip to main content
GET
/
api
/
v1
/
assets
{
  "assets": [
    {
      "id": "<string>",
      "url": "<string>",
      "content_type": "<string>",
      "size": 123,
      "state": "<string>",
      "created_at": "<string>"
    }
  ],
  "pagination": {
    "limit": 123,
    "offset": 123,
    "total": 123
  }
}

Overview

Get a list of all assets you’ve uploaded to Babou. Supports pagination and filtering by content type and state.

Request

Headers

Authorization
string
required
Bearer token with your API key: Bearer sk-bab-your-api-key

Query Parameters

limit
number
default:"20"
Number of assets to return per page (max: 100)
offset
number
default:"0"
Number of assets to skip for pagination
contentType
string
Filter by MIME type (e.g., image/png, video/mp4)
state
string
Filter by state: uploading, ready, or failed

Response

assets
array
Array of asset objects
pagination
object
Pagination metadata

Examples

# List all assets
curl https://api.babou.ai/api/v1/assets \
  -H "Authorization: Bearer $BABOU_API_KEY"

# List with pagination
curl "https://api.babou.ai/api/v1/assets?limit=50&offset=100" \
  -H "Authorization: Bearer $BABOU_API_KEY"

# Filter by content type
curl "https://api.babou.ai/api/v1/assets?contentType=video/mp4" \
  -H "Authorization: Bearer $BABOU_API_KEY"

# Filter by state
curl "https://api.babou.ai/api/v1/assets?state=ready" \
  -H "Authorization: Bearer $BABOU_API_KEY"

Response Example

{
  "assets": [
    {
      "id": "ast_abc123xyz456789012",
      "name": "logo.png",
      "url": "s3://babou-assets/assets/ast_abc123xyz456789012-original",
      "content_type": "image/png",
      "size": 245678,
      "state": "ready",
      "duration": null,
      "width": 1920,
      "height": 1080,
      "created_at": "2025-12-02T10:00:00Z"
    },
    {
      "id": "ast_def456uvw987654321",
      "name": "intro.mp4",
      "url": "s3://babou-assets/assets/ast_def456uvw987654321-original",
      "content_type": "video/mp4",
      "size": 15234567,
      "state": "ready",
      "duration": 45.2,
      "width": 1920,
      "height": 1080,
      "created_at": "2025-12-02T09:30:00Z"
    }
  ],
  "pagination": {
    "limit": 20,
    "offset": 0,
    "total": 42
  }
}

Pagination

To iterate through all assets, use the offset parameter:
async function getAllAssets() {
  const allAssets = [];
  let offset = 0;
  const limit = 100; // Max per page

  while (true) {
    const response = await listAssets({ limit, offset });
    allAssets.push(...response.assets);

    if (allAssets.length >= response.pagination.total) {
      break;
    }

    offset += limit;
  }

  return allAssets;
}

const assets = await getAllAssets();
console.log(`Retrieved all ${assets.length} assets`);

Filtering Examples

const images = await listAssets({ contentType: 'image/png' });
// Or filter for any image type in your application
const allImages = (await listAssets()).assets.filter(
  asset => asset.content_type.startsWith('image/')
);
videos = list_assets(content_type='video/mp4')

# Or filter for any video type
all_assets = list_assets()
all_videos = [
    asset for asset in all_assets['assets']
    if asset['content_type'].startswith('video/')
]
const failedUploads = await listAssets({ state: 'failed' });

if (failedUploads.assets.length > 0) {
  console.warn(`Found ${failedUploads.assets.length} failed uploads`);
  // Retry or clean up failed uploads
}
from datetime import datetime, timedelta

assets = list_assets(limit=100)
one_hour_ago = datetime.now() - timedelta(hours=1)

recent = [
    asset for asset in assets['assets']
    if datetime.fromisoformat(asset['created_at'].replace('Z', '+00:00')) > one_hour_ago
]

print(f'Found {len(recent)} assets uploaded in the last hour')

Next Steps