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:

    NameTypeDescription
    siteIdintegerThe numeric ID of the site.
  • Query params:

    NameTypeDefaultDescription
    limitinteger20Number of items to return. Maximum 100.
    offsetinteger0Zero-based offset for pagination.
    mimeTypestring(none)Filter by MIME type prefix. For example, image matches image/jpeg, image/png, etc. Omit (or pass all) 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
      }
    }
    
    FieldTypeDescription
    data[].idintegerUnique media item ID.
    data[].filenamestringOriginal filename as uploaded.
    data[].mimeTypestringMIME type, e.g. image/png, video/mp4.
    data[].urlstringFull URL to the original file.
    data[].thumbnailUrlstring | nullURL of a generated thumbnail, if available.
    data[].altstring | nullAlt text for accessibility.
    data[].captionstring | nullOptional caption associated with the media item.
    data[].widthinteger | nullWidth in pixels (images/videos).
    data[].heightinteger | nullHeight in pixels (images/videos).
    pagination.limitintegerThe effective limit applied to this response.
    pagination.offsetintegerThe effective offset applied to this response.
    pagination.totalintegerTotal number of matching items across all pages.
  • Errors:

    StatusmessageCause
    400Invalid site IDsiteId path 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"