Ir al contenido

Generar URL prefirmada para subir un archivo

POST
/dms/upload-url
curl --request POST \
--url https://api.dev.lade.com.mx/dms/upload-url \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "teamId": "550e8400-e29b-41d4-a716-446655440000", "folder": "drivers", "entityId": "770e8400-e29b-41d4-a716-446655440002", "fileName": "licencia.pdf", "contentType": "application/pdf", "bucket": "documents" }'

Genera una URL prefirmada de S3 (expira en 300s) para que el frontend suba un archivo directamente al bucket, sin pasar por un Lambda. El folder determina a qué bucket va (assets con CloudFront público, o documents privado) y el key resultante ({folder}/{entityId}/{fileName} si se pasa entityId). Después de subir, el frontend debe llamar a POST /dms/files para registrar el metadato.

Media typeapplication/json
object
teamId
required
string format: uuid
folder
required
string
Allowed values: teams drivers vehicles clients users drivers-profile drivers-files vehicles-profile vehicles-files clients-files user-profiles teams-files
entityId

Si se omite, el archivo se guarda directo bajo el folder sin subcarpeta

string format: uuid
fileName
required
string
contentType
required

Tipo MIME; solo se acepta un conjunto acotado de imágenes/documentos

string
bucket
string
default: assets
Allowed values: assets documents
Example
{
"teamId": "550e8400-e29b-41d4-a716-446655440000",
"folder": "drivers",
"entityId": "770e8400-e29b-41d4-a716-446655440002",
"fileName": "licencia.pdf",
"contentType": "application/pdf",
"bucket": "documents"
}

URL prefirmada generada

Media typeapplication/json
object
uploadUrl
string format: uri
key
string
publicUrl

URL pública vía CloudFront si bucket=assets; cadena vacía si bucket=documents

string
Example
{
"uploadUrl": "https://lade-dev-documents.s3.amazonaws.com/drivers/770e8400.../licencia.pdf?X-Amz-Signature=...",
"key": "drivers/770e8400-e29b-41d4-a716-446655440002/licencia.pdf",
"publicUrl": ""
}

Solicitud inválida

Media typeapplication/json
object
error
required
string
message
string
field
string
Example
{
"error": "Validation failed",
"field": "email",
"message": "Invalid email format"
}

Sin permisos

Media typeapplication/json
object
error
required
string
message
string
field
string
Example
{
"error": "Forbidden",
"message": "You don't have permission to access this resource"
}