Media API
The Media API lets you list and retrieve media assets that have been uploaded to a site. Use it to build galleries, populate image pickers, or sync your site's media library with external tools.
Base URL: https://your-domain.com/api/v1
Authentication: All endpoints require a valid API key. See Authentication for details.
Endpoints#
GET/sites/{siteId}/media#
Returns a paginated list of media items belonging to the specified site. Results are ordered newest-first.
-
Auth: API key required
-
Path params:
Name Type Description siteIdinteger The numeric ID of the site. -
Query params:
Name Type Default Description limitinteger 20Number of items to return. Maximum 100.offsetinteger 0Zero-based offset for pagination. mimeTypestring (none) Filter by MIME type prefix. For example, imagematchesimage/jpeg,image/png, etc. Omit (or passall) to return all types. -
Response:
{ "success": true, "data": [ { "id": 42, "filename": "hero-banner.jpg", "mimeType": "image/jpeg", "url": "https://cdn.example.com/sites/7/hero-banner.jpg", "thumbnailUrl": "https://cdn.example.com/sites/7/hero-banner-thumb.jpg", "alt": "A sweeping mountain vista at sunrise", "caption": "Hero image for the homepage", "width": 1920, "height": 1080 } ], "pagination": { "limit": 20, "offset": 0, "total": 143 } }Field Type Description data[].idinteger Unique media item ID. data[].filenamestring Original filename as uploaded. data[].mimeTypestring MIME type, e.g. image/png,video/mp4.data[].urlstring Full URL to the original file. data[].thumbnailUrlstring | null URL of a generated thumbnail, if available. data[].altstring | null Alt text for accessibility. data[].captionstring | null Optional caption associated with the media item. data[].widthinteger | null Width in pixels (images/videos). data[].heightinteger | null Height in pixels (images/videos). pagination.limitinteger The effective limitapplied to this response.pagination.offsetinteger The effective offsetapplied to this response.pagination.totalinteger Total number of matching items across all pages. -
Errors:
Status messageCause 400Invalid site IDsiteIdpath segment is not a valid integer.401(from middleware) API key missing or invalid. 404Not foundNo active site exists with the given siteId. -
Example:
# List the first 10 images for site 7 curl -G "https://your-domain.com/api/v1/sites/7/media" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "limit=10" \ -d "offset=0" \ -d "mimeType=image"Paginate to the next page:
curl -G "https://your-domain.com/api/v1/sites/7/media" \ -H "Authorization: Bearer YOUR_API_KEY" \ -d "limit=10" \ -d "offset=10"