Generar URL prefirmada para subir un archivo
POST
/dms/upload-url
const url = 'https://api.dev.lade.com.mx/dms/upload-url';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"teamId":"550e8400-e29b-41d4-a716-446655440000","folder":"drivers","entityId":"770e8400-e29b-41d4-a716-446655440002","fileName":"licencia.pdf","contentType":"application/pdf","bucket":"documents"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Authorizations
Sección titulada «Authorizations»Request Bodyrequired
Sección titulada «Request Bodyrequired»Media typeapplication/json
object
teamId
required
string format: uuid
folder
required
string
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
Example
{ "teamId": "550e8400-e29b-41d4-a716-446655440000", "folder": "drivers", "entityId": "770e8400-e29b-41d4-a716-446655440002", "fileName": "licencia.pdf", "contentType": "application/pdf", "bucket": "documents"}Responses
Sección titulada «Responses»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"}