Skip to main content

API Conventions

All HRMS API endpoints follow consistent conventions for responses, errors, pagination, and search.

Response Envelope

Success Response

{
"data": { },
"message": "Operation successful",
"meta": { }
}
  • data — The requested resource or collection.
  • message — Human-readable success message.
  • meta — Optional metadata (pagination info, counts, etc.).

Validation Error (422)

{
"message": "The given data was invalid.",
"errors": {
"field_name": ["Error message 1", "Error message 2"]
}
}

Error Response

{
"message": "Error description"
}

HTTP Status Codes

CodeMeaningWhen Used
200SuccessSuccessful read, update, or action
201CreatedResource successfully created
204No ContentCSRF cookie response
401UnauthenticatedNo valid session
403ForbiddenUser lacks required permission
404Not FoundResource does not exist
422Validation ErrorInvalid input or business rule violation

Pagination

Most list endpoints support opt-in pagination:

ParameterTypeDefaultDescription
paginatebooleanfalseEnable pagination
per_pageinteger15Items per page (max: 100)
pageinteger1Page number

When pagination is enabled, the response includes meta:

{
"data": [...],
"meta": {
"current_page": 1,
"last_page": 5,
"per_page": 15,
"total": 73
}
}
note

Endpoints remain backward-compatible — without paginate=true, they return all records. The UI sends paginate=true by default.

All list endpoints support text search via the q parameter:

GET /api/employees?q=sarah

Search is case-insensitive (uses PostgreSQL ILIKE) and matches partial strings. The searchable fields vary by endpoint:

EndpointSearchable Fields
EntitiesName
DepartmentsDepartment name, entity name
EmployeesFirst name, last name, email, employee number, display name
KPI TemplatesTemplate name, designation
KPI CyclesCycle name
RolesRole name

Ordering

All list endpoints default to latest-first ordering:

ORDER BY updated_at DESC, id DESC

Recently created or updated records appear at the top.

Filtering

Endpoints support module-specific filter parameters:

EndpointAvailable Filters
Departmentsentity_id
Employeesentity_id, department_id, status, employment_lifecycle
KPI Templatesentity_id, department_id, status
KPI Cyclesstatus
KPI Evaluationsscope, status, kpi_cycle_id, entity_id, department_id
Probation Evaluationsstatus, manager_id
Actionable Itemsstatus (pending/completed/all)

File Downloads

Protected file downloads (employee attachments, KPI evidence, probation signatures) require an authenticated session. They are not public URLs.

The frontend uses an authenticated fetch → blob → download flow. Direct browser navigation to the URL works only when the user has an active session cookie.