Bluewoo HRMS
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/employees

Query Parameters:

ParameterTypeDescription
searchstringSearch by name or email
departmentIdstringFilter by department
teamIdstringFilter by team
statusstringFilter by status
pagenumberPage number (default: 1)
limitnumberItems per page (default: 20)

Response:

{
  "data": {
    "items": [...],
    "total": 100,
    "page": 1,
    "limit": 20,
    "totalPages": 5
  }
}

Get Employee

GET /api/employees/:id

Response:

{
  "data": {
    "id": "cuid",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@example.com",
    "jobTitle": "Software Engineer",
    "status": "ACTIVE",
    "orgRelations": {
      "primaryManager": {...},
      "teams": [...],
      "departments": [...]
    }
  }
}

Create Employee

POST /api/employees

Request 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/:id

Delete Employee

DELETE /api/employees/:id

Soft delete - sets status to TERMINATED.

Org Structure

Primary Manager

POST /api/org/employees/:id/primary-manager

Request Body:

{
  "managerId": "manager-cuid"
}
DELETE /api/org/employees/:id/primary-manager

Dotted Line Managers

POST /api/org/employees/:id/dotted-line-managers

Request Body:

{
  "managerId": "manager-cuid"
}
DELETE /api/org/employees/:id/dotted-line-managers/:managerId

Additional Managers

POST /api/org/employees/:id/additional-managers

Request Body:

{
  "managerId": "manager-cuid"
}
DELETE /api/org/employees/:id/additional-managers/:managerId

Teams

POST /api/org/employees/:id/teams

Request Body:

{
  "teamId": "team-cuid",
  "role": "Tech Lead"
}
PATCH /api/org/employees/:id/teams/:teamId

Request Body:

{
  "role": "Team Lead"
}
DELETE /api/org/employees/:id/teams/:teamId

Departments

POST /api/org/employees/:id/departments

Request Body:

{
  "departmentId": "dept-cuid",
  "isPrimary": true
}
DELETE /api/org/employees/:id/departments/:departmentId
PUT /api/org/employees/:id/departments/:departmentId/primary

Roles

POST /api/org/employees/:id/roles

Request Body:

{
  "roleId": "role-cuid",
  "isPrimary": true
}
DELETE /api/org/employees/:id/roles/:roleId
PUT /api/org/employees/:id/roles/:roleId/primary

Org Chart

GET /api/v1/org/employees/chart

Query Parameters:

ParameterTypeDefaultDescription
rootEmployeeIdstringnullStart from specific employee
depthnumber5Max depth
includeMatrixRelationsbooleantrueShow additional managers
includeDottedLinesbooleantrueShow dotted line relations
includeTeamsbooleanfalseShow team memberships

Response:

{
  "data": {
    "nodes": [...],
    "edges": [
      { "from": "manager-id", "to": "employee-id", "type": "primary" }
    ]
  }
}

Employee Org Summary

GET /api/org/employees/:id/summary

Response:

{
  "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/:id

Departments

GET /api/departments
GET /api/departments/:id
POST /api/departments
PATCH /api/departments/:id
DELETE /api/departments/:id

Roles

GET /api/roles
POST /api/roles

Time-Off

Requests

GET /api/timeoff/requests

Query Parameters:

ParameterTypeDescription
employeeIdstringFilter by employee
statusstringFilter by status
startDatedateFilter by date range
endDatedateFilter by date range
POST /api/timeoff/requests

Request Body:

{
  "policyId": "policy-cuid",
  "startDate": "2024-03-01",
  "endDate": "2024-03-05",
  "reason": "Family vacation"
}
PATCH /api/timeoff/requests/:id

Request Body for Approval/Rejection:

{
  "status": "APPROVED",
  "approverComment": "Approved. Have fun!"
}
FieldTypeRequiredDescription
statusstringYesAPPROVED or REJECTED
approverCommentstringNoOptional 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:

StatusCodeDescription
400INVALID_STATUSRequest is not in PENDING status
403FORBIDDENUser is not authorized to approve this request
404NOT_FOUNDRequest not found

Balances

GET /api/timeoff/balances
GET /api/timeoff/balances/:employeeId

Calendar

GET /api/timeoff/calendar

Query Parameters:

ParameterTypeDescription
startDatedateStart of range
endDatedateEnd of range
departmentIdstringFilter by department
teamIdstringFilter by team

AI Endpoints

Chat

POST /api/ai/chat

Request Body:

{
  "message": "Who is the CTO?",
  "context": {
    "employeeId": "current-employee-id"
  }
}

Org Explain

POST /api/ai/org/explain

Request 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/validate

Request 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/generate

Request 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

CodeHTTP StatusDescription
VALIDATION_ERROR400Invalid input
NOT_FOUND404Resource not found
UNAUTHORIZED401Authentication required
FORBIDDEN403Permission denied
CONFLICT409Resource conflict
INTERNAL_ERROR500Server error