Reservas
Perfil de reservas, servicios, disponibilidad y gestión de citas
curl https://app.getplea.com/api/scheduling-profile \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID"
const profile = await fetch('/api/scheduling-profile', {
headers: {
'Authorization': 'Bearer TOKEN',
'x-organization-id': 'ORG_ID'
}
}).then(r => r.json());
{
"id": "sp-uuid-1",
"organizationName": "Bufete López & Asociados",
"slug": "bufete-lopez",
"description": "Consultas jurídicas presenciales y online",
"timezone": "Europe/Madrid",
"bookingUrl": "https://app.getplea.com/book/bufete-lopez",
"logo": "https://storage.googleapis.com/plea-uploads/logo.png",
"primaryColor": "#6366f1",
"isActive": true
}
curl -X PATCH https://app.getplea.com/api/scheduling-profile \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-H "x-organization-id: ORG_ID" \
-d '{"description": "Despacho especializado en derecho laboral y civil", "isActive": true}'
await fetch('/api/scheduling-profile', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer TOKEN',
'Content-Type': 'application/json',
'x-organization-id': 'ORG_ID'
},
body: JSON.stringify({
description: 'Despacho especializado en derecho laboral y civil',
isActive: true
})
});
{
"id": "sp-uuid-1",
"description": "Despacho especializado en derecho laboral y civil",
"isActive": true,
"updatedAt": "2026-03-07T12:00:00Z"
}
curl https://app.getplea.com/api/scheduling-services \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID"
const services = await fetch('/api/scheduling-services', {
headers: {
'Authorization': 'Bearer TOKEN',
'x-organization-id': 'ORG_ID'
}
}).then(r => r.json());
[
{
"id": "svc-uuid-1",
"name": "Consulta inicial gratuita",
"description": "Primera consulta de 30 minutos sin compromiso",
"duration": 30,
"price": 0,
"currency": "EUR",
"isActive": true,
"color": "#10b981"
},
{
"id": "svc-uuid-2",
"name": "Consulta jurídica presencial",
"description": "Consulta presencial de 60 minutos",
"duration": 60,
"price": 150.00,
"currency": "EUR",
"isActive": true,
"color": "#6366f1"
}
]
curl -X POST https://app.getplea.com/api/scheduling-services \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-H "x-organization-id: ORG_ID" \
-d '{
"name": "Asesoría fiscal",
"description": "Consulta especializada en derecho tributario",
"duration": 45,
"price": 120.00,
"color": "#f59e0b"
}'
const service = await fetch('/api/scheduling-services', {
method: 'POST',
headers: {
'Authorization': 'Bearer TOKEN',
'Content-Type': 'application/json',
'x-organization-id': 'ORG_ID'
},
body: JSON.stringify({
name: 'Asesoría fiscal',
description: 'Consulta especializada en derecho tributario',
duration: 45,
price: 120.00,
color: '#f59e0b'
})
}).then(r => r.json());
{
"id": "svc-uuid-new",
"name": "Asesoría fiscal",
"description": "Consulta especializada en derecho tributario",
"duration": 45,
"price": 120.00,
"currency": "EUR",
"isActive": true,
"color": "#f59e0b",
"createdAt": "2026-03-07T12:00:00Z"
}
curl https://app.getplea.com/api/availability-rules \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID"
const rules = await fetch('/api/availability-rules', {
headers: {
'Authorization': 'Bearer TOKEN',
'x-organization-id': 'ORG_ID'
}
}).then(r => r.json());
[
{
"id": "ar-uuid-1",
"dayOfWeek": 1,
"dayName": "Lunes",
"startTime": "09:00",
"endTime": "14:00",
"isActive": true
},
{
"id": "ar-uuid-2",
"dayOfWeek": 1,
"dayName": "Lunes",
"startTime": "16:00",
"endTime": "19:00",
"isActive": true
},
{
"id": "ar-uuid-3",
"dayOfWeek": 2,
"dayName": "Martes",
"startTime": "09:00",
"endTime": "14:00",
"isActive": true
}
]
curl -X POST https://app.getplea.com/api/availability-rules \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-H "x-organization-id: ORG_ID" \
-d '{"dayOfWeek": 3, "startTime": "10:00", "endTime": "13:00"}'
await fetch('/api/availability-rules', {
method: 'POST',
headers: {
'Authorization': 'Bearer TOKEN',
'Content-Type': 'application/json',
'x-organization-id': 'ORG_ID'
},
body: JSON.stringify({ dayOfWeek: 3, startTime: '10:00', endTime: '13:00' })
});
{
"id": "ar-uuid-new",
"dayOfWeek": 3,
"dayName": "Miércoles",
"startTime": "10:00",
"endTime": "13:00",
"isActive": true
}
curl "https://app.getplea.com/api/bookings?status=confirmed&dateFrom=2026-03-01" \
-H "Authorization: Bearer TOKEN" \
-H "x-organization-id: ORG_ID"
const bookings = await fetch('/api/bookings?status=confirmed&dateFrom=2026-03-01', {
headers: {
'Authorization': 'Bearer TOKEN',
'x-organization-id': 'ORG_ID'
}
}).then(r => r.json());
[
{
"id": "booking-uuid-1",
"serviceId": "svc-uuid-2",
"serviceName": "Consulta jurídica presencial",
"clientName": "Laura Sánchez",
"clientEmail": "laura@email.com",
"clientPhone": "+34 633 444 555",
"date": "2026-03-10",
"startTime": "10:00",
"endTime": "11:00",
"status": "confirmed",
"paymentStatus": "paid",
"amount": 150.00,
"notes": "Consulta sobre herencia",
"createdAt": "2026-03-05T09:00:00Z"
}
]
curl -X POST https://app.getplea.com/api/bookings \
-H "Content-Type: application/json" \
-d '{
"serviceId": "svc-uuid-2",
"date": "2026-03-15",
"startTime": "11:00",
"clientName": "Miguel Torres",
"clientEmail": "miguel@email.com",
"clientPhone": "+34 666 777 888",
"notes": "Consulta sobre derecho laboral"
}'
const booking = await fetch('/api/bookings', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
serviceId: 'svc-uuid-2',
date: '2026-03-15',
startTime: '11:00',
clientName: 'Miguel Torres',
clientEmail: 'miguel@email.com',
clientPhone: '+34 666 777 888',
notes: 'Consulta sobre derecho laboral'
})
}).then(r => r.json());
{
"id": "booking-uuid-new",
"serviceId": "svc-uuid-2",
"date": "2026-03-15",
"startTime": "11:00",
"endTime": "12:00",
"status": "confirmed",
"clientName": "Miguel Torres",
"paymentRequired": true,
"checkoutUrl": "https://checkout.stripe.com/c/pay/cs_test_..."
}
{
"error": "Bad Request",
"message": "El horario seleccionado no está disponible"
}
Endpoints para configurar el sistema de reservas online: perfil público, servicios, reglas de disponibilidad y gestión de citas.
Perfil de reservas
GET /api/scheduling-profile
Obtiene el perfil de reservas de la organización.
PATCH /api/scheduling-profile
Actualiza el perfil de reservas.
Descripción pública del despacho.
URL amigable para la página de reservas.
Zona horaria (ej: Europe/Madrid).
Activar/desactivar reservas online.
Servicios
GET /api/scheduling-services
Lista los servicios ofrecidos para reservas.
POST /api/scheduling-services
Crea un nuevo servicio.
Nombre del servicio.
Descripción del servicio.
Duración en minutos.
Precio en EUR. Default: 0 (gratuito).
Color hexadecimal para el calendario.
Disponibilidad
GET /api/availability-rules
Lista las reglas de disponibilidad.
POST /api/availability-rules
Crea una nueva regla de disponibilidad.
Día de la semana (0=Domingo, 1=Lunes, ... 6=Sábado).
Hora de inicio (formato HH:mm).
Hora de fin (formato HH:mm).
Reservas
GET /api/bookings
Lista las reservas recibidas.
Filtrar: confirmed, cancelled, completed.
Desde fecha (ISO 8601).
Hasta fecha (ISO 8601).
POST /api/bookings
Crea una nueva reserva (endpoint público, no requiere autenticación).
UUID del servicio.
Fecha de la reserva (ISO 8601).
Hora de inicio (formato HH:mm).
Nombre del cliente.
Email del cliente.
Teléfono del cliente.
Notas adicionales.
Last updated today