API Reference
Leave
Applying for leave, and approving or disapproving the requests routed to you.
Applying for leave, and approving or disapproving the requests routed to you.
Generated from the OpenAPI spec by
npm run docs:api -w api. Do not edit this page — change the decorators inapps/api/src/and regenerate.
Conventions
- Auth — a session on every route: the cookie on web, the bearer token on mobile. See Authentication.
- Errors — every non-2xx response has the body described in Errors.
- Types — a
?after a field name means it is optional;| nullmeans it is present but may be null.
Endpoints
GET /api/v1/leave/context — Leave permissions and configured reporting managers
Returns 200 → LeaveContextResponse
| Error | When |
|---|---|
401 | No valid session. Clear the stored token and sign in again. |
403 | Signed in, but not allowed to do this. |
GET /api/v1/leave/requests — Leave requests visible to the signed-in user
Employees see their own requests. Reporting managers see requests addressed to them. Admins see every request.
| Query | Type | Required | Notes |
|---|---|---|---|
scope | requests | history | no | |
employeeId | string | no | |
leaveType | string | no | |
status | PENDING | APPROVED | DISAPPROVED | no | |
from | string | no | |
to | string | no |
Returns 200 → LeaveRequestResponse[]
| Error | When |
|---|---|
401 | No valid session. Clear the stored token and sign in again. |
403 | Signed in, but not allowed to do this. |
POST /api/v1/leave/requests — Apply leave
Body — CreateLeaveRequestDto
Returns 201 → LeaveRequestResponse
| Error | When |
|---|---|
400 | The request was rejected. message is an array of field errors when validation failed. |
401 | No valid session. Clear the stored token and sign in again. |
403 | Signed in, but not allowed to do this. |
PATCH /api/v1/leave/requests/{requestId}/process — Approve or disapprove a pending leave request
| Path parameter | Type | Notes |
|---|---|---|
requestId | string |
Body — ProcessLeaveRequestDto
Returns 200 → LeaveRequestResponse
| Error | When |
|---|---|
400 | The request was rejected. message is an array of field errors when validation failed. |
401 | No valid session. Clear the stored token and sign in again. |
403 | Signed in, but not allowed to do this. |
404 | No such leave request. |
DELETE /api/v1/leave/requests/{requestId} — Remove your own pending leave request
| Path parameter | Type | Notes |
|---|---|---|
requestId | string |
Returns 200 → no body
| Error | When |
|---|---|
401 | No valid session. Clear the stored token and sign in again. |
403 | Signed in, but not allowed to do this. |
404 | No such leave request. |
POST /api/v1/leave/requests/seen — Mark routed leave requests as seen
Returns 200 → no body
| Error | When |
|---|---|
401 | No valid session. Clear the stored token and sign in again. |
403 | Signed in, but not allowed to do this. |
Data models
LeaveContextResponse
| Field | Type | Notes |
|---|---|---|
isAdmin | boolean | |
isReportingManager | boolean | |
pendingCount | number | |
currentManager | CurrentLeaveManagerResponse | null | |
managers | ReportingManagerResponse[] | |
employees | LeaveEmployeeResponse[] |
CurrentLeaveManagerResponse
| Field | Type | Notes |
|---|---|---|
id | string | |
name | string | |
image | string | null |
ReportingManagerResponse
| Field | Type | Notes |
|---|---|---|
id | string | |
name | string | |
image | string | null |
LeaveEmployeeResponse
| Field | Type | Notes |
|---|---|---|
id | string | |
name | string | |
managerId | string | null | |
managerName | string | null |
LeaveRequestResponse
| Field | Type | Notes |
|---|---|---|
id | string | |
employeeId | string | |
employeeName | string | |
leaveType | string | |
fromDate | string | |
toDate | string | |
reason | string | |
selectedManagerId | string | |
selectedManagerName | string | |
processedById | string | null | |
processedByName | string | null | |
processedAt | string | null | |
processComment | string | null | |
status | PENDING | APPROVED | DISAPPROVED | |
createdAt | string ISO 8601 |
CreateLeaveRequestDto
| Field | Type | Notes |
|---|---|---|
leaveType | string | ≤ 80 chars |
fromDate | string | |
toDate | string | |
reason | string | ≤ 500 chars |
selectedManagerId | string |
ProcessLeaveRequestDto
| Field | Type | Notes |
|---|---|---|
status | APPROVED | DISAPPROVED | |
comment? | string | ≤ 500 chars |