Saltearse al contenido

Storage

Nuvem Storage es un almacenamiento de objetos compatible con S3 que corre sobre Cloudflare R2. Sin egress fees, con CDN global incluido.

Endpoints

Subir archivo

Ventana de terminal
# Upload directo (multipart/form-data)
POST /v1/storage/upload
Authorization: Bearer <api_key>
Content-Type: multipart/form-data
# Body: form field "file" con el archivo
curl -X POST https://api.nuvem-latam.com/v1/storage/upload \
-H "Authorization: Bearer $NUVEM_API_KEY" \
-F "file=@foto.jpg" \
-F "path=avatars/usuario123.jpg"

Respuesta:

{
"id": "file_abc123",
"name": "usuario123.jpg",
"path": "avatars/usuario123.jpg",
"contentType": "image/jpeg",
"size": 102400,
"url": "https://cdn.nuvem-latam.com/avatars/usuario123.jpg",
"createdAt": "2026-04-12T00:00:00.000Z"
}

Listar archivos

Ventana de terminal
GET /v1/storage/files?prefix=avatars/&page=1&pageSize=20
Authorization: Bearer <api_key>

Obtener archivo

Ventana de terminal
GET /v1/storage/files/:fileId
Authorization: Bearer <api_key>

Generar presigned URL

Ventana de terminal
POST /v1/storage/presigned-url
Authorization: Bearer <api_key>
{
"path": "uploads/documento.pdf",
"operation": "put",
"expiresIn": 3600
}

Respuesta:

{
"url": "https://api.nuvem-latam.com/v1/storage/presigned/...",
"expiresAt": "2026-04-12T01:00:00.000Z"
}

Eliminar archivo

Ventana de terminal
DELETE /v1/storage/files/:fileId
Authorization: Bearer <api_key>

SDK

import { createClient } from '@nuvem/js';
const nuvem = createClient({ apiKey: process.env.NUVEM_API_KEY! });
// Subir desde el browser (File API)
const file = document.querySelector('input[type="file"]').files[0];
const uploaded = await nuvem.storage.upload(file, { path: 'avatars/user123.jpg' });
console.log(uploaded.url);
// Listar archivos
const { data } = await nuvem.storage.list({ prefix: 'avatars/' });
// Generar presigned URL para upload desde el cliente
const { url } = await nuvem.storage.getPresignedUrl({
path: 'uploads/doc.pdf',
operation: 'put',
expiresIn: 3600,
});

Límites

PlanTamaño máximo por archivoAlmacenamiento total
Free10 MB1 GB
Builder100 MB50 GB
Scale5 GBIlimitado

Errores comunes

CódigoMensajeCausa
file_too_largeEl archivo excede el límiteSupera el límite del plan
file_not_foundEl archivo no existeID inválido
invalid_content_typeTipo de archivo no permitidoTipo bloqueado por configuración