1"use strict";(globalThis.webpackChunkicehrm_docs=globalThis.webpackChunkicehrm_docs||[]).push([[946],{2910(e,n,s){s.r(n),s.d(n,{assets:()=>t,contentTitle:()=>a,default:()=>h,frontMatter:()=>d,metadata:()=>l,toc:()=>c});const l=JSON.parse('{"id":"api-docs/leave","title":"Leave API","description":"Endpoints for managing leave requests, entitlements, and approval workflows.","source":"@site/docs/api-docs/leave.md","sourceDirName":"api-docs","slug":"/api-docs/leave","permalink":"/docs/api-docs/leave","draft":false,"unlisted":false,"tags":[],"version":"current","sidebarPosition":4,"frontMatter":{"sidebar_position":4},"sidebar":"tutorialSidebar","previous":{"title":"Attendance API","permalink":"/docs/api-docs/attendance"},"next":{"title":"Documents API","permalink":"/docs/api-docs/documents"}}');var r=s(4848),i=s(8453);const d={sidebar_position:4},a="Leave API",t={},c=[{value:"List All Leave Requests",id:"list-all-leave-requests",level:2},{value:"Get Leave Request Details",id:"get-leave-request-details",level:2},{value:"Get Leave Entitlement",id:"get-leave-entitlement",level:2},{value:"Check Leave Availability",id:"check-leave-availability",level:2},{value:"Apply for Leave",id:"apply-for-leave",level:2},{value:"Upload Leave Attachment",id:"upload-leave-attachment",level:2},{value:"Get Direct Reports' Leave Requests",id:"get-direct-reports-leave-requests",level:2},{value:"Get Pending Direct Reports' Leave Requests",id:"get-pending-direct-reports-leave-requests",level:2},{value:"Get Leave Details",id:"get-leave-details",level:2},{value:"Approve Leave Request",id:"approve-leave-request",level:2},{value:"Reject Leave Request",id:"reject-leave-request",level:2},{value:"Leave Status Values",id:"leave-status-values",level:2},{value:"Leave Day Types",id:"leave-day-types",level:2},{value:"Related Topics",id:"related-topics",level:2}];function o(e){const n={a:"a",code:"code",h1:"h1",h2:"h2",header:"header",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,i.R)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(n.header,{children:(0,r.jsx)(n.h1,{id:"leave-api",children:"Leave API"})}),"\n",(0,r.jsx)(n.p,{children:"Endpoints for managing leave requests, entitlements, and approval workflows."}),"\n",(0,r.jsx)(n.h2,{id:"list-all-leave-requests",children:"List All Leave Requests"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"GET /leave\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Response:"})," ",(0,r.jsx)(n.code,{children:"200 OK"})," with the list of leave requests."]}),"\n",(0,r.jsx)(n.h2,{id:"get-leave-request-details",children:"Get Leave Request Details"}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"GET /leave/{id}\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Response:"})," ",(0,r.jsx)(n.code,{children:"200 OK"})," with leave request details."]}),"\n",(0,r.jsx)(n.h2,{id:"get-leave-entitlement",children:"Get Leave Entitlement"}),"\n",(0,r.jsx)(n.p,{children:"Returns the current user's leave entitlement and balances."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"GET /leave/entitlement\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Response:"})," ",(0,r.jsx)(n.code,{children:"200 OK"})]}),"\n",(0,r.jsx)(n.h2,{id:"check-leave-availability",children:"Check Leave Availability"}),"\n",(0,r.jsx)(n.p,{children:"Verifies whether a date range is available for a leave type."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"GET /leave/check/{leaveType}/{startDate}/{endDate}\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"Path Parameters:"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"leaveType"}),": Leave type ID"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"startDate"}),": Start date (",(0,r.jsx)(n.code,{children:"YYYY-MM-DD"}),")"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"endDate"}),": End date (",(0,r.jsx)(n.code,{children:"YYYY-MM-DD"}),")"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Response:"})," ",(0,r.jsx)(n.code,{children:"200 OK"})," with availability check result."]}),"\n",(0,r.jsx)(n.h2,{id:"apply-for-leave",children:"Apply for Leave"}),"\n",(0,r.jsx)(n.p,{children:"Submits a new leave request."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"POST /leave/apply\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"Request Body:"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "leave_type": 1,\n "start": "2026-05-01",\n "end": "2026-05-03",\n "details": "Family vacation",\n "attachment": null,\n "days": {\n "2026-05-01": "Full Day",\n "2026-05-02": "Full Day",\n "2026-05-03": "Half Day - Morning"\n }\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"Request Fields:"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"leave_type"}),": Leave type ID"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"start"}),": Start date (",(0,r.jsx)(n.code,{children:"YYYY-MM-DD"}),")"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"end"}),": End date (",(0,r.jsx)(n.code,{children:"YYYY-MM-DD"}),")"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"details"}),": Reason for leave"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"attachment"}),": Optional attached file reference"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"days"}),": Object mapping each date to a duration value"]}),"\n"]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Response:"})," ",(0,r.jsx)(n.code,{children:"200 OK"})]}),"\n",(0,r.jsx)(n.h2,{id:"upload-leave-attachment",children:"Upload Leave Attachment"}),"\n",(0,r.jsx)(n.p,{children:"Uploads a file attachment to attach to a leave request."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"POST /leave/file-upload\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Request:"})," ",(0,r.jsx)(n.code,{children:"multipart/form-data"})," with a ",(0,r.jsx)(n.code,{children:"file"})," field."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Response:"})," ",(0,r.jsx)(n.code,{children:"200 OK"})," with the uploaded filename."]}),"\n",(0,r.jsx)(n.h2,{id:"get-direct-reports-leave-requests",children:"Get Direct Reports' Leave Requests"}),"\n",(0,r.jsx)(n.p,{children:"Returns all leave requests from employees who report to the current user."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"GET /leave/direct-reports\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Response:"})," ",(0,r.jsx)(n.code,{children:"200 OK"})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "status": "SUCCESS",\n "data": [\n {\n "id": 12,\n "employee": "Jane Doe",\n "leave_type": "Annual Leave",\n "leave_period": "2026",\n "date_start": "2026-05-01",\n "date_end": "2026-05-03",\n "status": "Pending"\n }\n ]\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"Error Responses:"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"401 Unauthorized"})}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"404 Not Found"})," if no employee record exists for the current user"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"get-pending-direct-reports-leave-requests",children:"Get Pending Direct Reports' Leave Requests"}),"\n",(0,r.jsxs)(n.p,{children:["Returns only leave requests with ",(0,r.jsx)(n.code,{children:"Pending"})," status from direct reports."]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"GET /leave/direct-reports/pending\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Response:"})," ",(0,r.jsx)(n.code,{children:"200 OK"})," with pending leave requests."]}),"\n",(0,r.jsx)(n.h2,{id:"get-leave-details",children:"Get Leave Details"}),"\n",(0,r.jsx)(n.p,{children:"Returns full leave details including leave type, period, day breakdown, current balance, and activity logs."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"GET /leave/details/{id}\n"})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Response:"})," ",(0,r.jsx)(n.code,{children:"200 OK"})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "status": "SUCCESS",\n "id": 12,\n "currentBalance": 14.5,\n "leave": { },\n "leaveType": { },\n "leavePeriod": { },\n "days": [\n {"id": 1, "leave_date": "2026-05-01", "leave_type": "Full Day"}\n ],\n "logs": []\n}\n'})}),"\n",(0,r.jsx)(n.h2,{id:"approve-leave-request",children:"Approve Leave Request"}),"\n",(0,r.jsx)(n.p,{children:"Approves a pending leave request. Only supervisors or authorized approvers can a
1pprove. The note is stored in the leave log."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"POST /leave/{id}/approve\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"Request Body (optional):"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "reason": "Approved for the requested dates"\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:["The fields ",(0,r.jsx)(n.code,{children:"reason"})," and ",(0,r.jsx)(n.code,{children:"note"})," are aliases."]}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Response:"})," ",(0,r.jsx)(n.code,{children:"200 OK"})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "status": "SUCCESS",\n "message": "Leave request Approved",\n "leave": { }\n}\n'})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"Error Responses:"})}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"401 Unauthorized"})}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.code,{children:"403 Forbidden"})," if not authorized to approve"]}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.code,{children:"404 Not Found"})}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"reject-leave-request",children:"Reject Leave Request"}),"\n",(0,r.jsx)(n.p,{children:"Rejects a pending leave request. Only supervisors or authorized approvers can reject."}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{children:"POST /leave/{id}/reject\n"})}),"\n",(0,r.jsx)(n.p,{children:(0,r.jsx)(n.strong,{children:"Request Body (optional):"})}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "reason": "Insufficient leave balance"\n}\n'})}),"\n",(0,r.jsxs)(n.p,{children:[(0,r.jsx)(n.strong,{children:"Response:"})," ",(0,r.jsx)(n.code,{children:"200 OK"})]}),"\n",(0,r.jsx)(n.pre,{children:(0,r.jsx)(n.code,{className:"language-json",children:'{\n "status": "SUCCESS",\n "message": "Leave request Rejected",\n "leave": { }\n}\n'})}),"\n",(0,r.jsx)(n.h2,{id:"leave-status-values",children:"Leave Status Values"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Pending"}),": Awaiting approval"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Approved"}),": Leave request approved"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Rejected"}),": Leave request rejected"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Cancelled"}),": Cancelled by employee"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"leave-day-types",children:"Leave Day Types"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Full Day"}),": Entire day off"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Half Day - Morning"}),": Morning half-day leave"]}),"\n",(0,r.jsxs)(n.li,{children:[(0,r.jsx)(n.strong,{children:"Half Day - Afternoon"}),": Afternoon half-day leave"]}),"\n"]}),"\n",(0,r.jsx)(n.h2,{id:"related-topics",children:"Related Topics"}),"\n",(0,r.jsxs)(n.ul,{children:["\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/docs/api-docs/employees",children:"Employees API"})}),"\n",(0,r.jsx)(n.li,{children:(0,r.jsx)(n.a,{href:"/docs/api-docs/insights",children:"Insights API"})}),"\n"]})]})}function h(e={}){const{wrapper:n}={...(0,i.R)(),...e.components};return n?(0,r.jsx)(n,{...e,children:(0,r.jsx)(o,{...e})}):o(e)}},8453(e,n,s){s.d(n,{R:()=>d,x:()=>a});var l=s(6540);const r={},i=l.createContext(r);function d(e){const n=l.useContext(i);return l.useMemo(function(){return"function"==typeof e?e(n):{...n,...e}},[n,e])}function a(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:d(e.components),l.createElement(i.Provider,{value:n},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.