List Media
Retrieve media files from your workspace with cursor-based pagination.
Retrieve media files from your workspace with cursor-based pagination.
/api/v1/mediaList media files in your workspace with cursor-based pagination.
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | number | 20 | Number of items to return (1–100) |
cursor | string | — | Media ID to paginate from. Omit for the first page |
curl --request GET \
--url 'https://dopost.co/api/v1/media?limit=10' \
--header 'x-api-key: <apiKey>'curl --request GET \
--url 'https://dopost.co/api/v1/media?limit=10' \
--header 'x-api-key: <apiKey>'{
"media": [
{
"id": "cm3abc123def456",
"name": "banner.png",
"type": "image/png",
"url": "https://media.dopost.co/workspaces/ws_123/1719849600000-banner.png",
"thumbnailUrl": "https://media.dopost.co/workspaces/ws_123/thumb-banner.webp",
"sizeInBytes": 524288,
"width": 1920,
"height": 1080,
"durationSeconds": null,
"createdAt": "2025-07-01T12:00:00.000Z"
}
],
"nextCursor": "cm3xyz789ghi012",
"hasMore": true
}{
"media": [
{
"id": "cm3abc123def456",
"name": "banner.png",
"type": "image/png",
"url": "https://media.dopost.co/workspaces/ws_123/1719849600000-banner.png",
"thumbnailUrl": "https://media.dopost.co/workspaces/ws_123/thumb-banner.webp",
"sizeInBytes": 524288,
"width": 1920,
"height": 1080,
"durationSeconds": null,
"createdAt": "2025-07-01T12:00:00.000Z"
}
],
"nextCursor": "cm3xyz789ghi012",
"hasMore": true
}| Field | Description |
|---|---|
media | Array of media objects |
nextCursor | Pass this value as cursor to fetch the next page. null when no more items |
hasMore | true if there are more items after this page |
| Field | Type | Description |
|---|---|---|
id | string | Unique media ID |
name | string | Original file name |
type | string | MIME type |
url | string | Public URL of the file |
thumbnailUrl | string | null | Thumbnail URL (auto-generated for images and videos) |
sizeInBytes | number | null | File size in bytes |
width | number | null | Width in pixels (images/videos) |
height | number | null | Height in pixels (images/videos) |
durationSeconds | number | null | Duration in seconds (videos only) |
createdAt | string | ISO 8601 creation timestamp |
Results are ordered newest first. Use cursor-based pagination to iterate through all media:
let cursor = undefined;
do {
const params = new URLSearchParams({ limit: "50" });
if (cursor) params.set("cursor", cursor);
const res = await fetch(`https://dopost.co/api/v1/media?${params}`, {
headers: { "x-api-key": "<apiKey>" },
});
const { media, nextCursor } = await res.json();
console.log(`Fetched ${media.length} items`);
cursor = nextCursor;
} while (cursor);let cursor = undefined;
do {
const params = new URLSearchParams({ limit: "50" });
if (cursor) params.set("cursor", cursor);
const res = await fetch(`https://dopost.co/api/v1/media?${params}`, {
headers: { "x-api-key": "<apiKey>" },
});
const { media, nextCursor } = await res.json();
console.log(`Fetched ${media.length} items`);
cursor = nextCursor;
} while (cursor);| Status | Error | Cause |
|---|---|---|
401 | Invalid or missing API key | Bad or missing x-api-key header |
403 | API key does not have permission for this action | API key lacks the required scope for this endpoint |
429 | Rate limit exceeded | Too many requests. Check X-RateLimit-* response headers and retry after the indicated time |