Listar Media
Obtén los archivos multimedia de tu workspace con paginación por cursor.
Obtén los archivos multimedia de tu workspace con paginación por cursor.
/api/v1/mediaLista los archivos multimedia de tu workspace con paginación por cursor.
| Parámetro | Tipo | Default | Descripción |
|---|---|---|---|
limit | number | 20 | Número de items a retornar (1–100) |
cursor | string | — | ID de media para paginar desde ahí. Omitir para la primera página |
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
}| Campo | Descripción |
|---|---|
media | Array de objetos de media |
nextCursor | Pasa este valor como cursor para obtener la siguiente página. null cuando no hay más items |
hasMore | true si hay más items después de esta página |
| Campo | Tipo | Descripción |
|---|---|---|
id | string | ID único del media |
name | string | Nombre original del archivo |
type | string | Tipo MIME |
url | string | URL pública del archivo |
thumbnailUrl | string | null | URL de la miniatura (generada automáticamente para imágenes y videos) |
sizeInBytes | number | null | Tamaño del archivo en bytes |
width | number | null | Ancho en píxeles (imágenes/videos) |
height | number | null | Alto en píxeles (imágenes/videos) |
durationSeconds | number | null | Duración en segundos (solo videos) |
createdAt | string | Fecha de creación en formato ISO 8601 |
Los resultados se ordenan del más reciente al más antiguo. Usa paginación por cursor para iterar sobre todo el 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(`Obtenidos ${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(`Obtenidos ${media.length} items`);
cursor = nextCursor;
} while (cursor);| Status | Error | Causa |
|---|---|---|
401 | Invalid or missing API key | Header x-api-key inválido o faltante |
403 | API key does not have permission for this action | La API key no tiene el scope necesario para este endpoint |
429 | Rate limit exceeded | Demasiadas peticiones. Revisa las cabeceras X-RateLimit-* y reintenta tras el tiempo indicado |