Ir al contenido

Registrar metadato de un archivo subido

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

Guarda en DynamoDB el metadato de un archivo tras subirlo exitosamente con la URL de /dms/upload-url (nombre, tipo, tamaño, entidad a la que pertenece). Es el paso 2 del flujo de subida: 1) POST /dms/upload-url → subir a S3 → 2) POST /dms/files.

Media typeapplication/json
object
teamId
required
string format: uuid
entityType
required
string
Allowed values: DRIVER VEHICLE CLIENT USER TEAM
entityId
required
string format: uuid
fileId
required

Generado por el cliente

string format: uuid
key
required

S3 key devuelto por /dms/upload-url

string
bucket
string
default: documents
Allowed values: assets documents
fileName
required
string
contentType
required
string
size
integer
0
Example
{
"teamId": "550e8400-e29b-41d4-a716-446655440000",
"entityType": "DRIVER",
"entityId": "770e8400-e29b-41d4-a716-446655440002",
"fileId": "gg0e8400-e29b-41d4-a716-446655440011",
"key": "drivers/770e8400-e29b-41d4-a716-446655440002/licencia.pdf",
"bucket": "documents",
"fileName": "licencia.pdf",
"contentType": "application/pdf",
"size": 245678
}

Metadato guardado

Media typeapplication/json
object
file

Metadato de un archivo subido vía DMS (el binario vive en S3, esto es el registro en DynamoDB)

object
fileId
string format: uuid
teamId
string format: uuid
entityType
string
Allowed values: DRIVER VEHICLE CLIENT USER TEAM
entityId
string format: uuid
key

S3 key

string
bucket
string
Allowed values: assets documents
fileName
string
contentType
string
size
integer
uploadedBy
string format: uuid
uploadedAt
string format: date-time
url

URL pública (CloudFront) si bucket=assets, o URL prefirmada de 900s si bucket=documents

string
Example
{
"file": {
"fileId": "gg0e8400-e29b-41d4-a716-446655440011",
"teamId": "550e8400-e29b-41d4-a716-446655440000",
"entityType": "DRIVER",
"entityId": "770e8400-e29b-41d4-a716-446655440002",
"key": "drivers/770e8400-e29b-41d4-a716-446655440002/licencia.pdf",
"bucket": "documents",
"fileName": "licencia.pdf",
"contentType": "application/pdf",
"size": 245678,
"url": ""
}
}

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"
}