Horarios del negocio
POST
Crear horario
POST /api/schedules/create-schedule
Descripción
Crea un horario reutilizable con turnos por día y excepciones por fecha.
Detalles
* Crea un horario nuevo con nombre, descripción opcional y sus turnos. * Cada turno es un día de la semana con un rango de horas, o el día completo abierto. * Un mismo día admite varios turnos, así se representa una jornada partida. * Las excepciones cubren un rango de fechas y mandan sobre los turnos: cierran esos días o los abren con un horario especial. * Soporta turnos que cruzan la medianoche.
Permisos requeridos
admin.module
Request
| Nombre | Tipo | Requerido | Reglas |
|---|---|---|---|
| name | string | Sí |
min:1
max:100
|
| description | string | No |
max:500
|
| dateStart | string | No |
max:10
|
| dateEnd | string | No |
max:10
|
| periods | array | Sí | — |
| periods[].dayOfWeek | int | Sí |
min_value:1
max_value:7
|
| periods[].isAllDay | bool | No | — |
| periods[].timeStart | string | No |
max:8
|
| periods[].timeEnd | string | No |
max:8
|
| exceptions | array | Sí | — |
| exceptions[].name | string | Sí |
min:1
max:100
|
| exceptions[].dateStart | string | Sí |
max:10
|
| exceptions[].dateEnd | string | Sí |
max:10
|
| exceptions[].isClosed | bool | No | — |
| exceptions[].timeStart | string | No |
max:8
|
| exceptions[].timeEnd | string | No |
max:8
|
Ejemplo de request
curl -X POST https://restofy.pro/api/schedules/create-schedule \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <accessToken>" \
-H "X-Tenant-Key: <tenantKey>" \
-d '{
"name": "string",
"periods": [
{
"dayOfWeek": 1
}
],
"exceptions": [
{
"name": "string",
"dateStart": "string",
"dateEnd": "string"
}
]
}'
Los valores son demo: reemplázalos por datos reales del negocio.
Ejemplo de respuesta
Actualizado: 2026-09-08T16:35:34Z
HTTP 200
Request
{
"name": "Horario test 6aa03928ad7c5",
"description": "Lunes a viernes 8 a 17",
"periods": [
{
"dayOfWeek": 1,
"timeStart": "08:00:00",
"timeEnd": "17:00:00"
},
{
"dayOfWeek": 2,
"timeStart": "08:00:00",
"timeEnd": "17:00:00"
},
{
"dayOfWeek": 3,
"timeStart": "08:00:00",
"timeEnd": "17:00:00"
},
{
"dayOfWeek": 4,
"timeStart": "08:00:00",
"timeEnd": "17:00:00"
},
{
"dayOfWeek": 5,
"timeStart": "08:00:00",
"timeEnd": "17:00:00"
}
],
"exceptions": []
}
Response
{
"success": true,
"message": "Horario creado",
"data": {
"scheduleId": "8"
}
}