Media API

Upload and manage images, videos, and documents via S3 presigned URLs.

Request Upload URL

POST /api/v1/media
{
  "filename": "hero.jpg",
  "mimeType": "image/jpeg",
  "size": 204800,
  "folderId": "clxxx"  // optional
}

Response:
{
  "data": {
    "presignedUrl": "https://s3.amazonaws.com/...",
    "media": { "id": "...", "cdnUrl": "https://cdn.example.com/..." },
    "key": "clxxx/abc123.jpg"
  }
}

Upload the File

// PUT directly to the presigned URL
await fetch(presignedUrl, {
  method: 'PUT',
  body: file,
  headers: { 'Content-Type': 'image/jpeg' }
})

List Media

GET /api/v1/media?folderId=clxxx&limit=50&cursor=clyyy

Allowed Types

image/jpeg, image/png, image/webp, image/gif, image/svg+xml, video/mp4, application/pdf

Maximum file size: 50 MB