- The media URL you get back is short-lived, so a URL you stored yesterday may fail to load today.
- Some list endpoints return media without image URLs, which tempts you into slow, repeated lookups.
How media and variants work
A media item has a stableuuid that never changes, and one or more variants. A variant is a specific rendition of the item at a specific size or treatment, each with its own URL.
| Variant | Use it for |
|---|---|
thumbnail | Small previews in lists and grids |
thumbnail_gallery | Larger gallery previews |
main | The full-size image or video |
blurred | A locked or teaser state for unpurchased media |
uuid, status) by default. Pass the variants query parameter to get the full object back, including a variants array where each entry has a url, variantType, width, height, and displayPosition.
Always filter to ready media with
status=ready. An item that is still processing does not have usable variant URLs yet.Treat media URLs as short-lived
Variant URLs are signed and expire. They are designed to be fetched when you need them, not stored. Store the stable identifiers instead (mediaUuid, and for chat media the messageUuid), then resolve a fresh URL at display time. The pattern:
Cache in memory, briefly
Hold the resolved URL in memory for the current view. Do not write it to durable storage.
Display Vault media efficiently
GET /vault/folders/{folderName}/media lists what is in a folder, but it returns lightweight items without variant URLs. Resolving each one by scanning the full media list is the slow path that causes hundreds of calls per folder view.
The supported path is to list the folder’s media directly from the media endpoint with variants included. GET /media accepts a folderName filter, a variants list, and status:
data comes back with its variants array, so you get thumbnail and full-size URLs in one paged response instead of one lookup per item. Page through with page and size to load a folder.
Resolve specific media by ID
When you already hold a set of media UUIDs (for example, IDs you stored earlier), resolve them in a batch rather than one request each.GET /media/bulk takes a comma-separated mediaUuids list and a variants list:
Display chat media reliably
Chat attachments follow the same short-lived-URL rule. Sync and store each message’s stable IDs (messageUuid, mediaUuid), then resolve fresh URLs only for the media a user is actually viewing.
GET /chats/{userUuid}/messages/{messageUuid}/media resolves attachments for a single message. It takes mediaUuids (comma-separated, up to 20) and an optional variants list:
Putting it together
- Store IDs, never signed URLs.
- Ask for the
variantsyou need, and filter withstatus=ready. - Use
folderNameonGET /mediato load a Vault folder with thumbnails in one call per page. - Use
GET /media/bulkor the per-message media endpoint to re-resolve URLs on demand. - Treat
403and404on a media URL as “resolve again”, not as a hard error.