Documentation Index
Fetch the complete documentation index at: https://mintlify.com/exon-reyes/integra-backend/llms.txt
Use this file to discover all available pages before exploring further.
Units API
The Units API provides comprehensive CRUD operations for managing organizational units (unidades), which represent physical locations, branches, or operational sites within the organization.Endpoints
Create Unit
Registers a new organizational unit.Request
Method:POST
Endpoint: /unidades/registrar
Headers:
Authorization: Bearer token (required)Content-Type: application/json (required)
UNIDADES_CREAR
Body Parameters:
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
clave | String | Yes | 1-10 characters | Unique code for the unit |
nombre | String | Yes | 1-100 characters | Name of the unit |
localizacion | String | No | Max 80 characters | Location description |
telefono | String | No | Max 15 characters | Contact phone number |
activo | Boolean | No | - | Active status of the unit |
direccion | String | No | Max 255 characters | Physical address |
email | String | No | Max 100 characters | Contact email |
idZona | Integer | Yes | - | Zone ID where the unit is located |
idEstado | Integer | Yes | - | State/Province ID |
idSupervisor | Integer | Yes | - | ID of the employee supervising this unit |
Response
Status Code:200 OK
Response Example
Update Unit
Updates an existing organizational unit.Request
Method:PUT
Endpoint: /unidades/actualizar
Headers:
Authorization: Bearer token (required)Content-Type: application/json (required)
UNIDADES_EDITAR
Body Parameters: Same as Create Unit, plus:
| Field | Type | Required | Constraints | Description |
|---|---|---|---|---|
id | Integer | Yes | Min value: 1 | ID of the unit to update |
Response
Status Code:200 OK
Response Example
Update Unit Status
Enables or disables a unit.Request
Method:PUT
Endpoint: /unidades/estatus/{id}/{estatus}
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id | Integer | ID of the unit |
estatus | Boolean | true to enable, false to disable |
Authorization: Bearer token (required)
Response
Status Code:200 OK
Response Example (Enable)
Response Example (Disable)
Delete Unit
Permanently deletes a unit from the system.Request
Method:DELETE
Endpoint: /unidades/{id}
Path Parameters:
| Parameter | Type | Description |
|---|---|---|
id | Integer | ID of the unit to delete |
Authorization: Bearer token (required)
Response
Status Code:200 OK
Response Example
Entity Structure
Unit Entity
| Field | Type | Description |
|---|---|---|
id | Integer | Unique identifier for the unit |
clave | String | Unique code for the unit (1-10 characters) |
nombre | String | Short name of the unit |
nombreCompleto | String | Full name combining code and name |
activo | Boolean | Whether the unit is active |
operativa | Boolean | Whether the unit is operational |
contacto | Object | Contact information (see below) |
requiereCamara | Boolean | Whether the unit requires camera integration |
codigoAutorizacionKiosco | String | Authorization code for kiosk mode |
requiereReset | Boolean | Whether the unit requires reset |
versionKiosco | Integer | Version of the kiosk software |
supervisor | Object | Supervisor employee information |
tiempoCompensacion | Time | Compensation time configuration |
tiempoEsperaKiosco | Integer | Kiosk wait time in seconds |
Contact Object
| Field | Type | Description |
|---|---|---|
direccion | String | Physical address |
telefono | String | Contact phone number |
email | String | Contact email |
localizacion | String | Location description |
estado | Object | State/Province information |
zona | Object | Zone information |
Zone Object
| Field | Type | Description |
|---|---|---|
id | Integer | Zone identifier |
nombre | String | Zone name |
Relationships
Units have the following relationships:- Zone: Each unit belongs to a zone (idZona)
- State: Each unit is located in a state/province (idEstado)
- Supervisor: Each unit has an assigned supervisor employee (idSupervisor)
- Operating Schedules: Units can have multiple operating schedules defining their hours of operation
- Employees: Multiple employees can be assigned to a unit
- Kiosk Configuration: Units can have kiosk mode settings for employee check-in/out
Validation Rules
Create/Update Unit
clave: Required, 1-10 characters, must be uniquenombre: Required, 1-100 characterslocalizacion: Optional, max 80 characterstelefono: Optional, max 15 charactersdireccion: Optional, max 255 charactersemail: Optional, max 100 characters, must be valid email formatidZona: Required, must reference an existing zoneidEstado: Required, must reference an existing stateidSupervisor: Required, must reference an existing employee
Error Responses
Validation Error
Status Code:400 Bad Request
Not Found Error
Status Code:404 Not Found
Unauthorized Error
Status Code:403 Forbidden
Related Endpoints
- Zones API - Manage geographical zones
- Operating Schedules API - Configure unit operating hours
- Employees API - Manage employees assigned to units