Ir al contenido

Crear una reserva/renta de caja

POST
/teams/{teamId}/box-reservations
curl --request POST \
--url https://api.dev.lade.com.mx/teams/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/box-reservations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "boxId": "bb0e8400-e29b-41d4-a716-446655440006", "clientId": "cc0e8400-e29b-41d4-a716-446655440007", "reservationType": "STORAGE_RENTAL", "dailyRate": 250, "billable": true }'

Crea una reserva de caja para un cliente. Si startAt es ahora o ya pasó, la reserva queda ACTIVA de inmediato y la caja pasa a RENTADA; si es una fecha futura, queda RESERVADA sin ocupar la caja todavía. Falla con 409 si la caja no está DISPONIBLE.

teamId
required
string format: uuid

ID del equipo (UUID)

Media typeapplication/json
object
boxId
required
string format: uuid
clientId
required
string format: uuid
reservationType

TRIP_HOLD: apartado breve ligado a un viaje (Fase 3, no implementado aún). STORAGE_RENTAL: renta de almacenaje independiente.

string
default: STORAGE_RENTAL
Allowed values: TRIP_HOLD STORAGE_RENTAL
startAt

Default: ahora

string format: date-time
expectedEndAt
string format: date-time
dailyRate

Default: tarifa diaria de la caja

number
<= 999999
billable
boolean
default: true
location
object
notes
string
<= 1000 characters
Example
{
"boxId": "bb0e8400-e29b-41d4-a716-446655440006",
"clientId": "cc0e8400-e29b-41d4-a716-446655440007",
"reservationType": "STORAGE_RENTAL",
"dailyRate": 250,
"billable": true
}

Reserva creada

Media typeapplication/json
object
message
string
reservation

Registro de que una caja quedó en manos de un cliente (renta de almacenaje o apartado ligado a un viaje)

object
id
string format: uuid
reservationId
string format: uuid
teamId
string format: uuid
boxId
string format: uuid
boxCode
string
nullable
clientId
string format: uuid
clientName
string
nullable
reservationType

TRIP_HOLD: apartado breve ligado a un viaje (Fase 3, no implementado aún). STORAGE_RENTAL: renta de almacenaje independiente.

string
Allowed values: TRIP_HOLD STORAGE_RENTAL
tripId
string
nullable
status
string
Allowed values: RESERVADA ACTIVA FINALIZADA CANCELADA
startAt
string format: date-time
expectedEndAt
string format: date-time
nullable
actualEndAt
string format: date-time
nullable
dailyRate
number
billable
boolean
billedDays
integer
nullable
totalAmount
number
nullable
invoiceId
string
nullable
location
object
notes
string
nullable
createdAt
string format: date-time
updatedAt
string format: date-time
Example
{
"message": "Box reservation created successfully",
"reservation": {
"id": "dd0e8400-e29b-41d4-a716-446655440008",
"teamId": "550e8400-e29b-41d4-a716-446655440000",
"boxId": "bb0e8400-e29b-41d4-a716-446655440006",
"clientId": "cc0e8400-e29b-41d4-a716-446655440007",
"status": "ACTIVA",
"dailyRate": 250
}
}

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

Recurso no encontrado

Media typeapplication/json
object
error
required
string
message
string
field
string
Example
{
"error": "Not found",
"message": "Resource not found"
}

Conflicto con recurso existente

Media typeapplication/json
object
error
required
string
message
string
field
string
Example
{
"error": "Conflict",
"message": "Resource already exists"
}