HR API
REST endpoints for the HR module — employees, leave, payroll, contracts.
Endpoints
| Method | Path | Purpose |
|---|---|---|
| GET | /api/hr/employees | List. Filters: status, department_id, q. |
| POST | /api/hr/employees | Create. |
| GET/PATCH/DELETE | /api/hr/employees/{id} | CRUD. |
| GET | /api/hr/departments | List. |
| POST | /api/hr/departments | Create. |
| GET | /api/hr/leave | List leave requests. Filters: status, employee_id. |
| POST | /api/hr/leave | Submit a leave request. |
| POST | /api/hr/leave/{id}/approve | Approve OR reject (body: {action: 'approve' | 'reject'}). Emits hr.leave.approved or hr.leave.rejected accordingly. |
| GET | /api/hr/leave-balances | List balances per employee. |
| GET | /api/hr/leave-policies | List policies. |
| GET | /api/hr/payroll | List payroll runs. |
| POST | /api/hr/payroll/{id}/process | Compute + insert payroll_items. Requires hr.payroll.process. |
| GET | /api/hr/contracts | List contracts. |
| POST | /api/hr/contracts/{id}/send | Send contract for signature via Resend. |
| GET | /api/hr/contracts/{id}/pdf | Render unsigned contract PDF. |
| GET | /api/hr/contracts/{id}/signed-pdf | Render signed contract PDF (post-signature). |
Key entity shapes
Employee
{
"id": "uuid",
"first_name": "string",
"last_name": "string",
"email": "string",
"position": "string?",
"department_id": "uuid?",
"hire_date": "iso-8601?",
"status": "active | inactive | terminated",
"salary": 0,
"salary_currency": "USD"
}
Leave request
{
"id": "uuid",
"employee_id": "uuid",
"type": "vacation | sick | personal | bereavement | parental",
"start_date": "iso-8601",
"end_date": "iso-8601",
"status": "pending | approved | rejected",
"approved_by": "uuid?",
"approved_at": "iso-8601?"
}
Permissions
hr.employees.*, hr.departments.*, hr.leave.read|create|approve,
hr.payroll.read|process, hr.contracts.*. Employees can read their
own profile + balances even without admin permissions.
Events
hr.employee.created|updated|deletedhr.leave.requested|approved|rejectedhr.contract.created|sent|updated|deletedhr.payroll.created|processed
OpenAPI
Full schema at /api/openapi.json.