List media

GET /api/v1/media Every media of the organization, most recent first. Unlike other listings in this reference, the storage layer that holds media never returns a total count — this endpoint pages with hasMore instead of a page/total pair.

Authorization

Role in the organizationThis endpoint
OWNERAllowed
ADMINAllowed
MEMBERAllowed
A key carries the role its creator holds in this organization — never a role on AgentsMail itself. See API keys.

Query parameters

ParameterTypeDescription
folderstringRestricts the listing to one sub-folder. Optional, defaults to the root
searchstringFilters on the file name, case-insensitive. Optional
limitnumberItems per page, default 24, capped at 100
offsetnumberItems to skip, default 0

Example

bash
curl -H "x-api-key: $AGENTMAIL_API_KEY" \
  "https://www.agentsmail.io/api/v1/media?folder=newsletter&limit=10"

Response

  • 200 OK — the media, with hasMore next to them.
  • 400 Bad Requestfolder is not lowercase letters, digits and dashes.
  • 401 Unauthorized — missing or invalid key, or its owner left the organization.

Response fields

FieldTypeDescription
successbooleanIndicates if the operation was successful
data.itemsarrayThe media
data.items[].pathstringThe media's identifier — pass it to Delete a media to remove this file
data.items[].urlstringPublic URL — an email client is never authenticated
data.items[].namestringFile name
data.items[].sizenumberFile size in bytes
data.items[].typestringMIME type
data.items[].createdAtstringISO creation date
data.items[].folderstringSub-folder, absent at the root of the media library
data.hasMorebooleantrue if a further page exists beyond limit + offset
data.limitnumberThe limit actually applied
data.offsetnumberThe offset actually applied

Example response

json
{
  "success": true,
  "data": {
    "items": [
      {
        "path": "organizations/7c2e…/media/newsletter/logo-1703123456789.jpg",
        "url": "https://…/logo-1703123456789.jpg",
        "name": "logo-1703123456789.jpg",
        "size": 48213,
        "type": "image/jpeg",
        "createdAt": "2026-08-29T10:00:00.000Z",
        "folder": "newsletter"
      }
    ],
    "hasMore": false,
    "limit": 24,
    "offset": 0
  }
}

Notes

  • There is no pagination.total. The storage layer this library is built on cannot count without listing everything — paginate with offset and stop when hasMore is false.