AI Development GuideDevelopment
API Reference
REST API endpoints for HRMS
API Reference
All HRMS APIs follow REST conventions. This document defines the standard endpoints.
Employee Management
List Employees
GET /api/employeesQuery Parameters:
| Parameter | Type | Description |
|---|---|---|
| search | string | Search by name or email |
| departmentId | string | Filter by department |
| teamId | string | Filter by team |
| status | string | Filter by status |
| page | number | Page number (default: 1) |
| limit | number | Items per page (default: 20) |
Response:
{
"data": {
"items": [...],
"total": 100,
"page": 1,
"limit": 20,
"totalPages": 5
}
}Get Employee
GET /api/employees/:idResponse:
{
"data": {
"id": "cuid",
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"jobTitle": "Software Engineer",
"status": "ACTIVE",
"orgRelations": {
"primaryManager": {...},
"teams": [...],
"departments": [...]
}
}
}Create Employee
POST /api/employeesRequest Body:
{
"firstName": "John",
"lastName": "Doe",
"email": "john@example.com",
"jobTitle": "Software Engineer",
"employmentType": "FULL_TIME",
"workMode": "HYBRID",
"hireDate": "2024-01-15"
}Update Employee
PATCH /api/employees/:idDelete Employee
DELETE /api/employees/:idSoft delete - sets status to TERMINATED.
Org Structure
Primary Manager
POST /api/org/employees/:id/primary-managerRequest Body:
{
"managerId": "manager-cuid"
}DELETE /api/org/employees/:id/primary-managerDotted Line Managers
POST /api/org/employees/:id/dotted-line-managersRequest Body:
{
"managerId": "manager-cuid"
}DELETE /api/org/employees/:id/dotted-line-managers/:managerIdAdditional Managers
POST /api/org/employees/:id/additional-managersRequest Body:
{
"managerId": "manager-cuid"
}DELETE /api/org/employees/:id/additional-managers/:managerIdTeams
POST /api/org/employees/:id/teamsRequest Body:
{
"teamId": "team-cuid",
"role": "Tech Lead"
}PATCH /api/org/employees/:id/teams/:teamIdRequest Body:
{
"role": "Team Lead"
}DELETE /api/org/employees/:id/teams/:teamIdDepartments
POST /api/org/employees/:id/departmentsRequest Body:
{
"departmentId": "dept-cuid",
"isPrimary": true
}DELETE /api/org/employees/:id/departments/:departmentIdPUT /api/org/employees/:id/departments/:departmentId/primaryRoles
POST /api/org/employees/:id/rolesRequest Body:
{
"roleId": "role-cuid",
"isPrimary": true
}DELETE /api/org/employees/:id/roles/:roleIdPUT /api/org/employees/:id/roles/:roleId/primaryOrg Chart
GET /api/v1/org/employees/chartQuery Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
| rootEmployeeId | string | null | Start from specific employee |
| depth | number | 5 | Max depth |
| includeMatrixRelations | boolean | true | Show additional managers |
| includeDottedLines | boolean | true | Show dotted line relations |
| includeTeams | boolean | false | Show team memberships |
Response:
{
"data": {
"nodes": [...],
"edges": [
{ "from": "manager-id", "to": "employee-id", "type": "primary" }
]
}
}Employee Org Summary
GET /api/org/employees/:id/summaryResponse:
{
"data": {
"employee": {...},
"primaryManager": {...},
"dottedLineManagers": [...],
"additionalManagers": [...],
"departments": [...],
"teams": [...],
"roles": [...],
"directReports": [...]
}
}Teams & Departments
Teams
GET /api/teams
GET /api/teams/:id
POST /api/teams
PATCH /api/teams/:id
DELETE /api/teams/:idDepartments
GET /api/departments
GET /api/departments/:id
POST /api/departments
PATCH /api/departments/:id
DELETE /api/departments/:idRoles
GET /api/roles
POST /api/rolesTime-Off
Requests
GET /api/timeoff/requestsQuery Parameters:
| Parameter | Type | Description |
|---|---|---|
| employeeId | string | Filter by employee |
| status | string | Filter by status |
| startDate | date | Filter by date range |
| endDate | date | Filter by date range |
POST /api/timeoff/requestsRequest Body:
{
"policyId": "policy-cuid",
"startDate": "2024-03-01",
"endDate": "2024-03-05",
"reason": "Family vacation"
}PATCH /api/timeoff/requests/:idRequest Body for Approval/Rejection:
{
"status": "APPROVED",
"approverComment": "Approved. Have fun!"
}| Field | Type | Required | Description |
|---|---|---|---|
| status | string | Yes | APPROVED or REJECTED |
| approverComment | string | No | Optional comment from approver |
Success Response:
{
"data": {
"id": "request-cuid",
"status": "APPROVED",
"approverId": "employee-cuid",
"approvedAt": "2024-03-01T10:30:00Z",
"approverComment": "Approved. Have fun!"
},
"error": null
}Error Responses:
| Status | Code | Description |
|---|---|---|
| 400 | INVALID_STATUS | Request is not in PENDING status |
| 403 | FORBIDDEN | User is not authorized to approve this request |
| 404 | NOT_FOUND | Request not found |
Balances
GET /api/timeoff/balances
GET /api/timeoff/balances/:employeeIdCalendar
GET /api/timeoff/calendarQuery Parameters:
| Parameter | Type | Description |
|---|---|---|
| startDate | date | Start of range |
| endDate | date | End of range |
| departmentId | string | Filter by department |
| teamId | string | Filter by team |
AI Endpoints
Chat
POST /api/ai/chatRequest Body:
{
"message": "Who is the CTO?",
"context": {
"employeeId": "current-employee-id"
}
}Org Explain
POST /api/ai/org/explainRequest Body:
{
"employeeId": "employee-cuid"
}Response:
{
"data": {
"summary": "John reports to Sarah (CTO) with a dotted line to...",
"directManager": {...},
"dottedLineManagers": [...],
"teams": [...],
"directReports": 5
}
}Org Validate
POST /api/ai/org/validateRequest Body:
{
"checkCircular": true,
"checkOrphans": true,
"checkOverextended": true,
"maxReportsThreshold": 15
}Response:
{
"data": {
"valid": false,
"issues": [
{
"type": "OVEREXTENDED",
"severity": "WARNING",
"employeeId": "manager-id",
"message": "Manager has 18 direct reports"
}
],
"summary": {
"total": 50,
"withManager": 48,
"orphans": 2,
"overextended": 1,
"circular": 0
}
}
}Generate Structure
POST /api/ai/org/generateRequest Body:
{
"description": "We're a 20-person startup with 3 squads...",
"teamSize": 20,
"style": "squads"
}Error Responses
All errors follow this format:
{
"data": null,
"error": {
"code": "VALIDATION_ERROR",
"message": "Email is required",
"details": {...}
}
}Error Codes
| Code | HTTP Status | Description |
|---|---|---|
| VALIDATION_ERROR | 400 | Invalid input |
| NOT_FOUND | 404 | Resource not found |
| UNAUTHORIZED | 401 | Authentication required |
| FORBIDDEN | 403 | Permission denied |
| CONFLICT | 409 | Resource conflict |
| INTERNAL_ERROR | 500 | Server error |