Super People Docs
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 in apps/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; | null means it is present but may be null.

Endpoints

GET /api/v1/leave/context — Leave permissions and configured reporting managers

Returns 200 → LeaveContextResponse

ErrorWhen
401No valid session. Clear the stored token and sign in again.
403Signed 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.

QueryTypeRequiredNotes
scoperequests | historyno
employeeIdstringno
leaveTypestringno
statusPENDING | APPROVED | DISAPPROVEDno
fromstringno
tostringno

Returns 200 → LeaveRequestResponse[]

ErrorWhen
401No valid session. Clear the stored token and sign in again.
403Signed in, but not allowed to do this.

POST /api/v1/leave/requests — Apply leave

Body — CreateLeaveRequestDto

Returns 201 → LeaveRequestResponse

ErrorWhen
400The request was rejected. message is an array of field errors when validation failed.
401No valid session. Clear the stored token and sign in again.
403Signed in, but not allowed to do this.

PATCH /api/v1/leave/requests/{requestId}/process — Approve or disapprove a pending leave request

Path parameterTypeNotes
requestIdstring

Body — ProcessLeaveRequestDto

Returns 200 → LeaveRequestResponse

ErrorWhen
400The request was rejected. message is an array of field errors when validation failed.
401No valid session. Clear the stored token and sign in again.
403Signed in, but not allowed to do this.
404No such leave request.

DELETE /api/v1/leave/requests/{requestId} — Remove your own pending leave request

Path parameterTypeNotes
requestIdstring

Returns 200 → no body

ErrorWhen
401No valid session. Clear the stored token and sign in again.
403Signed in, but not allowed to do this.
404No such leave request.

POST /api/v1/leave/requests/seen — Mark routed leave requests as seen

Returns 200 → no body

ErrorWhen
401No valid session. Clear the stored token and sign in again.
403Signed in, but not allowed to do this.

Data models

LeaveContextResponse

FieldTypeNotes
isAdminboolean
isReportingManagerboolean
pendingCountnumber
currentManagerCurrentLeaveManagerResponse | null
managersReportingManagerResponse[]
employeesLeaveEmployeeResponse[]

CurrentLeaveManagerResponse

FieldTypeNotes
idstring
namestring
imagestring | null

ReportingManagerResponse

FieldTypeNotes
idstring
namestring
imagestring | null

LeaveEmployeeResponse

FieldTypeNotes
idstring
namestring
managerIdstring | null
managerNamestring | null

LeaveRequestResponse

FieldTypeNotes
idstring
employeeIdstring
employeeNamestring
leaveTypestring
fromDatestring
toDatestring
reasonstring
selectedManagerIdstring
selectedManagerNamestring
processedByIdstring | null
processedByNamestring | null
processedAtstring | null
processCommentstring | null
statusPENDING | APPROVED | DISAPPROVED
createdAtstring ISO 8601

CreateLeaveRequestDto

FieldTypeNotes
leaveTypestring≤ 80 chars
fromDatestring
toDatestring
reasonstring≤ 500 chars
selectedManagerIdstring

ProcessLeaveRequestDto

FieldTypeNotes
statusAPPROVED | DISAPPROVED
comment?string≤ 500 chars

On this page