Operating Schedules API
The Operating Schedules API (Horarios Operativos) allows you to manage the operating hours for organizational units. Each unit can have multiple operating schedules that define when the unit is operational throughout the week.Endpoints
Get All Operating Days
Retrieves a list of all operating day types (operatividades) used for scheduling.Request
Method:GET
Endpoint: /operatividades
Headers:
Authorization: Bearer token (required)
Response
Status Code:200 OK
Response Example
Save Unit Schedules
Saves or updates the operating schedules for a specific unit. This endpoint replaces all existing schedules for the unit with the new schedule configuration.Request
Method:POST
Endpoint: /operatividades/horarios
Headers:
Authorization: Bearer token (required)Content-Type: application/json (required)
| Field | Type | Required | Description |
|---|---|---|---|
idUnidad | Integer | Yes | ID of the unit to configure schedules for |
horarios | Array | Yes | Array of schedule objects (must not be empty) |
| Field | Type | Required | Description |
|---|---|---|---|
idOperatividad | Integer | Yes | Operating day ID (1-7 for Monday-Sunday) |
apertura | String (Time) | Yes | Opening time in HH:mm:ss format |
cierre | String (Time) | Yes | Closing time in HH:mm:ss format |
activo | Boolean | Yes | Whether this schedule is active |
Response
Status Code:200 OK
Response Example
Entity Structure
Operatividad Entity
| Field | Type | Description |
|---|---|---|
id | Integer | Unique identifier for the operating day |
nombre | String | Name of the operating day (e.g., “Lunes”, “Martes”) |
Schedule Configuration Object
| Field | Type | Description |
|---|---|---|
idUnidad | Integer | Reference to the unit |
horarios | Array | Collection of schedule entries |
Schedule Entry
| Field | Type | Description |
|---|---|---|
idOperatividad | Integer | Day of the week (1=Monday, 7=Sunday) |
apertura | Time | Opening time |
cierre | Time | Closing time |
activo | Boolean | Whether the schedule is active for this day |
Time Format
All time values must be provided in 24-hour format as strings:- Format:
HH:mm:ss - Examples:
"08:00:00","18:30:00","23:59:59"
Relationships
Operating schedules relate to:- Units: Each schedule configuration belongs to a specific unit
- Operating Days: Each schedule entry references a day of the week
- Attendance System: Operating hours may be used to validate employee check-in/out times
- Kiosk Mode: Operating hours can control when kiosk access is available
Use Cases
Standard Business Hours
Configure Monday-Friday 8am-6pm, Saturday 9am-2pm, Sunday closed:24/7 Operation
Configure continuous operation:Split Shifts
For units with lunch breaks or split shifts, you may need to handle this at the application level or create multiple schedule entries per day (if supported by your implementation).Validation Rules
Save Schedules Request
idUnidad: Required, must reference an existing unithorarios: Required, must not be empty array- Each schedule entry must have all required fields
idOperatividad: Must be between 1-7 (representing days of the week)aperturaandcierre: Must be valid time strings in HH:mm:ss formatactivo: Must be a boolean value
Error Responses
Validation Error
Status Code:400 Bad Request
Invalid Time Format
Status Code:400 Bad Request
Unit Not Found
Status Code:404 Not Found
Best Practices
- Complete Week Configuration: Always provide schedules for all 7 days of the week
- Inactive Days: For closed days, set
activo: falseand use"00:00:00"for both opening and closing times - Time Validation: Ensure closing time is after opening time
- Bulk Updates: This endpoint replaces all schedules for a unit, so always send the complete schedule configuration
- Timezone Consideration: All times are stored in the system’s timezone; ensure consistency across your application
Important Notes
The save schedules endpoint replaces all existing schedules for the specified unit. Always send the complete schedule configuration, including days you want to keep unchanged.
Related Endpoints
- Units API - Manage organizational units
- Attendance API - Track employee attendance based on operating hours
- Kiosk API - Configure kiosk mode settings that may depend on operating hours