{"openapi":"3.1.0","info":{"title":"NovaHR API","version":"0.8.0","description":"HR, payroll and attendance API for Sri Lankan businesses. Authenticate with a Bearer access token from /v1/auth/login, or with a company API key (Bearer hrk_…, Pro plan) created under Developers in the web app. A key acts for one company, only on the routes its scopes allow; a route outside its scopes answers 403 MISSING_SCOPE or NOT_FOR_API_KEYS. Send X-Company-Id to choose the company when a user belongs to more than one. Errors always look like {\"error\":{\"code\",\"message\"}}. AI agents can also connect over MCP at POST /v1/mcp with the same key.","contact":{"name":"NovaHR","url":"https://novahr.lk","email":"hello@novahr.lk"}},"servers":[{"url":"https://backend.novahr.lk"}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"A user access token (JWT) or a company API key (hrk_…)."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}},"required":["code","message"]}}},"Session":{"type":"object","properties":{"accessToken":{"type":"string"},"refreshToken":{"type":"string"},"expiresIn":{"type":"integer","description":"Seconds until the access token expires"},"tokenType":{"type":"string","const":"Bearer"},"user":{"type":"object"},"companies":{"type":"array","items":{"type":"object"}}}}}},"paths":{"/health":{"get":{"summary":"Liveness and database check","responses":{"200":{"description":"OK"}}}},"/v1/plans":{"get":{"summary":"Public price list in LKR","responses":{"200":{"description":"Plans"}}}},"/v1/auth/register":{"post":{"summary":"Create a company and its owner account; emails a 6-digit code","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["companyName","name","email","password"],"properties":{"companyName":{"type":"string"},"name":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string","example":"0771234567"},"password":{"type":"string","minLength":8},"industry":{"type":"string"},"employeeBand":{"type":"string","enum":["1-5","6-25","26-50","51-150","151-250","250+"]}}}}}},"responses":{"201":{"description":"Verification required"},"409":{"description":"Email taken","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/verify-email":{"post":{"summary":"Confirm the emailed code and start a session","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email","code"],"properties":{"email":{"type":"string"},"code":{"type":"string"}}}}}},"responses":{"200":{"description":"Session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"}}}},"400":{"description":"Bad code","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/resend-code":{"post":{"summary":"Send a fresh verification or reset code","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"email":{"type":"string"},"purpose":{"type":"string","enum":["VERIFY_EMAIL","RESET_PASSWORD"]}}}}}},"responses":{"200":{"description":"Sent if the account exists"}}}},"/v1/auth/login":{"post":{"summary":"Sign in with email and password","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email","password"],"properties":{"email":{"type":"string"},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"Session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"}}}},"401":{"description":"INVALID_CREDENTIALS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"EMAIL_NOT_VERIFIED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/refresh":{"post":{"summary":"Exchange a refresh token for new tokens (rotates the refresh token)","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["refreshToken"],"properties":{"refreshToken":{"type":"string"}}}}}},"responses":{"200":{"description":"New tokens"},"401":{"description":"REFRESH_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/logout":{"post":{"summary":"Revoke a refresh token","responses":{"204":{"description":"Signed out"}}}},"/v1/auth/forgot-password":{"post":{"summary":"Email a password reset code","responses":{"200":{"description":"Sent if the account exists"}}}},"/v1/auth/reset-password":{"post":{"summary":"Set a new password with the emailed code","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email","code","password"],"properties":{"email":{"type":"string"},"code":{"type":"string"},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"Session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"}}}}}}},"/v1/me":{"get":{"summary":"The signed-in user and their companies","security":[{"bearer":[]}],"responses":{"200":{"description":"Profile"}}}},"/v1/branches":{"get":{"summary":"Branches (offices, shops, sites) with optional clock-in geofence: list with active employee counts","security":[{"bearer":[]}],"responses":{"200":{"description":"{ items }"}}},"post":{"summary":"Branches (offices, shops, sites) with optional clock-in geofence: create (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Created"}}}},"/v1/branches/{id}":{"patch":{"summary":"Branches (offices, shops, sites) with optional clock-in geofence: rename or update","security":[{"bearer":[]}],"responses":{"200":{"description":"Updated"}}},"delete":{"summary":"Branches (offices, shops, sites) with optional clock-in geofence: delete (only when no active employees use it)","security":[{"bearer":[]}],"responses":{"204":{"description":"Deleted"},"409":{"description":"IN_USE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/departments":{"get":{"summary":"Departments: list with active employee counts","security":[{"bearer":[]}],"responses":{"200":{"description":"{ items }"}}},"post":{"summary":"Departments: create (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Created"}}}},"/v1/departments/{id}":{"patch":{"summary":"Departments: rename or update","security":[{"bearer":[]}],"responses":{"200":{"description":"Updated"}}},"delete":{"summary":"Departments: delete (only when no active employees use it)","security":[{"bearer":[]}],"responses":{"204":{"description":"Deleted"},"409":{"description":"IN_USE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/designations":{"get":{"summary":"Job titles: list with active employee counts","security":[{"bearer":[]}],"responses":{"200":{"description":"{ items }"}}},"post":{"summary":"Job titles: create (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"}}}}}},"responses":{"201":{"description":"Created"}}}},"/v1/designations/{id}":{"patch":{"summary":"Job titles: rename or update","security":[{"bearer":[]}],"responses":{"200":{"description":"Updated"}}},"delete":{"summary":"Job titles: delete (only when no active employees use it)","security":[{"bearer":[]}],"responses":{"204":{"description":"Deleted"},"409":{"description":"IN_USE","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees":{"get":{"summary":"List employees. HR roles see full records; managers and employees see a directory card.","security":[{"bearer":[]}],"parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string"},"description":"Search name, employee number, email, phone (and NIC for HR)"},{"name":"status","in":"query","required":false,"schema":{"type":"string"},"description":"ACTIVE (default), INACTIVE or ALL"},{"name":"departmentId","in":"query","required":false,"schema":{"type":"string"}},{"name":"branchId","in":"query","required":false,"schema":{"type":"string"}},{"name":"designationId","in":"query","required":false,"schema":{"type":"string"}},{"name":"managerId","in":"query","required":false,"schema":{"type":"string"}},{"name":"page","in":"query","required":false,"schema":{"type":"string"},"description":"Default 1"},{"name":"pageSize","in":"query","required":false,"schema":{"type":"string"},"description":"Default 25, max 200"},{"name":"sort","in":"query","required":false,"schema":{"type":"string"},"description":"name | employeeNo | joinedOn"}],"responses":{"200":{"description":"{ items, page, pageSize, total }"}}},"post":{"summary":"Add an employee (OWNER, ADMIN, HR). employeeNo is generated when omitted; DOB and gender are filled from the NIC.","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["firstName","lastName","joinedOn"],"properties":{"employeeNo":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"email":{"type":"string"},"phone":{"type":"string","example":"0771234567"},"nic":{"type":"string","example":"199512345678"},"dateOfBirth":{"type":"string","format":"date"},"gender":{"enum":["FEMALE","MALE","OTHER"]},"employmentType":{"enum":["PERMANENT","PROBATION","CONTRACT","INTERN","CASUAL"]},"joinedOn":{"type":"string","format":"date"},"probationEndsOn":{"type":"string","format":"date"},"contractEndsOn":{"type":"string","format":"date"},"branchId":{"type":"string"},"departmentId":{"type":"string"},"designationId":{"type":"string"},"managerId":{"type":"string"},"basicSalary":{"type":"number"},"epfNo":{"type":"string"},"bankName":{"type":"string"},"bankBranch":{"type":"string"},"bankAccountNo":{"type":"string"}}}}}},"responses":{"201":{"description":"Created"},"402":{"description":"PLAN_LIMIT_REACHED","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}":{"get":{"summary":"One employee, with direct reports","security":[{"bearer":[]}],"responses":{"200":{"description":"Employee"}}},"patch":{"summary":"Update any employee fields (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"Employee"}}}},"/v1/employees/{id}/exit":{"post":{"summary":"Mark as left; reports move to their manager and app access is removed","security":[{"bearer":[]}],"responses":{"200":{"description":"Employee"}}}},"/v1/employees/{id}/reinstate":{"post":{"summary":"Make a former employee active again","security":[{"bearer":[]}],"responses":{"200":{"description":"Employee"}}}},"/v1/employees/next-number":{"get":{"summary":"Suggested next employee number","security":[{"bearer":[]}],"responses":{"200":{"description":"{ employeeNo }"}}}},"/v1/employees/org-chart":{"get":{"summary":"Active employees as { nodes: [{ id, managerId, ... }] }","security":[{"bearer":[]}],"responses":{"200":{"description":"Nodes"}}}},"/v1/employees/export":{"get":{"summary":"All employees as CSV (HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"text/csv"}}}},"/v1/employees/import/template":{"get":{"summary":"CSV template for bulk import","security":[{"bearer":[]}],"responses":{"200":{"description":"text/csv"}}}},"/v1/employees/import":{"post":{"summary":"Bulk import from CSV text. Send commit:false first to validate and preview; commit:true saves (all or nothing).","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["csv"],"properties":{"csv":{"type":"string"},"commit":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Preview"},"201":{"description":"Imported"},"422":{"description":"IMPORT_HAS_ERRORS","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/employees/{id}/documents":{"get":{"summary":"Documents on file (HR, or the employee themself)","security":[{"bearer":[]}],"responses":{"200":{"description":"{ items }"}}},"post":{"summary":"Upload a document (multipart: file, category, expiresOn). Max 10 MB; PDF, Word, JPG, PNG, WebP.","security":[{"bearer":[]}],"responses":{"201":{"description":"Created"}}}},"/v1/employees/{id}/documents/{docId}/download":{"get":{"summary":"Download a document","security":[{"bearer":[]}],"responses":{"200":{"description":"File"}}}},"/v1/team/members":{"get":{"summary":"People with access, and pending invitations (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"Members"}}}},"/v1/team/members/{id}":{"patch":{"summary":"Change access level (OWNER, ADMIN)","security":[{"bearer":[]}],"responses":{"200":{"description":"Member"}}},"delete":{"summary":"Remove access (OWNER, ADMIN)","security":[{"bearer":[]}],"responses":{"204":{"description":"Removed"}}}},"/v1/team/invitations":{"post":{"summary":"Invite someone by email, optionally also by SMS, and optionally link them to an employee record","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string"},"phone":{"type":"string"},"role":{"enum":["ADMIN","HR","MANAGER","EMPLOYEE"]},"employeeId":{"type":"string"},"sendSms":{"type":"boolean"}}}}}},"responses":{"201":{"description":"Sent"}}}},"/v1/team/audit-log":{"get":{"summary":"Activity log (OWNER, ADMIN)","security":[{"bearer":[]}],"responses":{"200":{"description":"Entries"}}}},"/v1/team/overview":{"get":{"summary":"Headcount, probation and contract end dates, expiring documents, birthdays and anniversaries","security":[{"bearer":[]}],"responses":{"200":{"description":"Overview"}}}},"/v1/auth/invitations/{token}":{"get":{"summary":"Look up an invitation before accepting","responses":{"200":{"description":"Invitation"},"410":{"description":"INVITE_INVALID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/v1/auth/accept-invite":{"post":{"summary":"Accept an invitation; creates a login or uses the existing one","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["token","password"],"properties":{"token":{"type":"string"},"name":{"type":"string"},"password":{"type":"string"}}}}}},"responses":{"200":{"description":"Session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Session"}}}}}}},"/v1/company":{"get":{"summary":"The active company","security":[{"bearer":[]}],"responses":{"200":{"description":"Company"}}},"patch":{"summary":"Update the company profile and policies (OWNER, ADMIN)","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"workWeek":{"type":"object","description":"Keys 0 (Sunday) to 6; values FULL, HALF or OFF"},"holidayCalendar":{"enum":["PUBLIC","MERCANTILE"],"description":"Which national list counts as days off"},"geofenceMode":{"enum":["FLAG","BLOCK"],"description":"FLAG records out-of-fence clock-ins; BLOCK refuses them"},"otRoundingMin":{"enum":[1,5,10,15,30]}}}}}},"responses":{"200":{"description":"Company"}}}},"/v1/leave/types":{"get":{"summary":"Leave types (policy). Seeded with Shop & Office Act defaults","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create a leave type (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/leave/types/{id}":{"patch":{"summary":"Update a leave type (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/leave/balances":{"get":{"summary":"Leave balances: entitled, carried forward, adjustments, taken, pending, available","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"employeeId","in":"query","required":false,"schema":{"type":"string"},"description":"Default: you"},{"name":"year","in":"query","required":false,"schema":{"type":"string"}}]}},"/v1/leave/adjustments":{"post":{"summary":"Add or remove days from a balance (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employeeId","leaveTypeId","year","days","reason"],"properties":{"employeeId":{"type":"string"},"leaveTypeId":{"type":"string"},"year":{"type":"integer"},"days":{"type":"number"},"reason":{"type":"string"}}}}}}}},"/v1/leave/preview":{"post":{"summary":"Working days a request would use, balance after, holidays in range and warnings. Saves nothing","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["leaveTypeId","startDate","endDate"],"properties":{"employeeId":{"type":"string","description":"Omit to apply for yourself"},"leaveTypeId":{"type":"string"},"startDate":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"},"dayPart":{"enum":["FULL","AM","PM"]},"reason":{"type":"string"}}}}}}}},"/v1/leave/requests":{"get":{"summary":"Leave requests. scope=mine (default), approvals (pending for you to decide) or all","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"scope","in":"query","required":false,"schema":{"type":"string"}},{"name":"status","in":"query","required":false,"schema":{"type":"string"}},{"name":"employeeId","in":"query","required":false,"schema":{"type":"string"}},{"name":"from","in":"query","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","required":false,"schema":{"type":"string"}}]},"post":{"summary":"Apply for leave. Errors: INSUFFICIENT_BALANCE, OVERLAPS, SPANS_YEARS, NO_WORKING_DAYS, NO_HALF_DAYS. HR filing for someone else is approved at once","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["leaveTypeId","startDate","endDate"],"properties":{"employeeId":{"type":"string","description":"Omit to apply for yourself"},"leaveTypeId":{"type":"string"},"startDate":{"type":"string","format":"date"},"endDate":{"type":"string","format":"date"},"dayPart":{"enum":["FULL","AM","PM"]},"reason":{"type":"string"}}}}}}}},"/v1/leave/requests/{id}/approve":{"post":{"summary":"Approve (their manager or HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"note":{"type":"string"}}}}}}}},"/v1/leave/requests/{id}/reject":{"post":{"summary":"Decline with a reason (their manager or HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["note"],"properties":{"note":{"type":"string"}}}}}}}},"/v1/leave/requests/{id}/cancel":{"post":{"summary":"Cancel (the employee before it starts, or HR any time)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/leave/calendar":{"get":{"summary":"Who is away (approved and pending) and holidays, up to 2 months","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"from","in":"query","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","required":false,"schema":{"type":"string"}}]}},"/v1/holidays":{"get":{"summary":"Holiday calendar for a year: Sri Lankan national list (per company setting) plus company days","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"year","in":"query","required":false,"schema":{"type":"string"}}]},"post":{"summary":"Add a company day off (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["date","name"],"properties":{"date":{"type":"string","format":"date"},"name":{"type":"string"}}}}}}}},"/v1/holidays/{id}":{"delete":{"summary":"Remove a company day off","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/attendance/shifts":{"get":{"summary":"Shifts","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create a shift (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","startTime","endTime"],"properties":{"name":{"type":"string"},"startTime":{"type":"string","example":"08:30"},"endTime":{"type":"string","example":"17:30"},"breakMinutes":{"type":"integer"},"graceMinutes":{"type":"integer"},"color":{"type":"string"}}}}}}}},"/v1/attendance/shifts/{id}":{"patch":{"summary":"Update a shift","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete a shift","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/attendance/roster":{"get":{"summary":"Roster grid: default shifts plus day overrides","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"from","in":"query","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","required":false,"schema":{"type":"string"}},{"name":"departmentId","in":"query","required":false,"schema":{"type":"string"}}]},"put":{"summary":"Set day overrides. shiftId = an ID, null for a day off, or \"DEFAULT\" to clear","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"type":"object","properties":{"employeeId":{"type":"string"},"date":{"type":"string","format":"date"},"shiftId":{"type":["string","null"]}}}}}}}}}}},"/v1/attendance/default-shift":{"put":{"summary":"Give many employees the same default shift","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employeeIds","shiftId"],"properties":{"employeeIds":{"type":"array","items":{"type":"string"}},"shiftId":{"type":["string","null"]}}}}}}}},"/v1/attendance/clock":{"post":{"summary":"Clock yourself in or out. Send location (checked against branch geofences) or kioskCode from a kiosk QR. Errors: OUTSIDE_GEOFENCE, LOCATION_REQUIRED, KIOSK_CODE_EXPIRED","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"type":{"enum":["IN","OUT"],"description":"Omit to toggle"},"latitude":{"type":"number"},"longitude":{"type":"number"},"accuracyM":{"type":"number"},"kioskCode":{"type":"string"},"source":{"enum":["WEB","MOBILE"]}}}}}}}},"/v1/attendance/me/today":{"get":{"summary":"My shift, punches, worked minutes and the next action (IN or OUT)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/attendance/me":{"get":{"summary":"My attendance days and totals","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"from","in":"query","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","required":false,"schema":{"type":"string"}}]}},"/v1/attendance/me/pin":{"post":{"summary":"Set my kiosk PIN","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["pin"],"properties":{"pin":{"type":"string"}}}}}}}},"/v1/attendance/daily":{"get":{"summary":"Day board: status (PRESENT, LATE, ABSENT, ON_LEAVE, HALF_LEAVE, HOLIDAY, OFF, INCOMPLETE, WORKING, UPCOMING), times, late and OT minutes","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"date","in":"query","required":false,"schema":{"type":"string"}},{"name":"departmentId","in":"query","required":false,"schema":{"type":"string"}},{"name":"branchId","in":"query","required":false,"schema":{"type":"string"}}]}},"/v1/attendance/summary":{"get":{"summary":"Per-person totals for a period (working days, present, late, absent, leave, worked, OT). format=csv to download","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"from","in":"query","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","required":false,"schema":{"type":"string"}},{"name":"employeeId","in":"query","required":false,"schema":{"type":"string"}},{"name":"format","in":"query","required":false,"schema":{"type":"string"}}]}},"/v1/attendance/employees/{id}":{"get":{"summary":"One employee: days and totals","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"from","in":"query","required":false,"schema":{"type":"string"}},{"name":"to","in":"query","required":false,"schema":{"type":"string"}}]}},"/v1/attendance/punches":{"post":{"summary":"Add a missed punch with a reason (HR or their manager)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employeeId","type","date","time","note"],"properties":{"employeeId":{"type":"string"},"type":{"enum":["IN","OUT"]},"date":{"type":"string","format":"date"},"time":{"type":"string"},"note":{"type":"string"}}}}}}}},"/v1/attendance/punches/{id}/void":{"post":{"summary":"Strike out a wrong punch with a reason","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["note"],"properties":{"note":{"type":"string"}}}}}}}},"/v1/attendance/punches/{id}/selfie":{"get":{"summary":"Kiosk photo for a punch (image/jpeg)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/attendance/pins/{employeeId}":{"post":{"summary":"Set or generate an employee kiosk PIN, optionally sent by SMS (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"pin":{"type":"string"},"sendSms":{"type":"boolean"}}}}}}}},"/v1/attendance/kiosks":{"get":{"summary":"Kiosk tablets","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Register a kiosk; returns an 8-character pairing code valid for 15 minutes","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"branchId":{"type":["string","null"]}}}}}}}},"/v1/attendance/kiosks/{id}/pair":{"post":{"summary":"New pairing code (signs out the current tablet)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/attendance/kiosks/{id}":{"delete":{"summary":"Remove a kiosk","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/kiosk/pair":{"post":{"summary":"Kiosk device: exchange a pairing code for a kiosk token","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["code"],"properties":{"code":{"type":"string"}}}}}},"responses":{"200":{"description":"{ token, kiosk }"}}}},"/v1/kiosk/state":{"get":{"summary":"Kiosk device: current rotating QR code (header X-Kiosk-Token)","responses":{"200":{"description":"{ kiosk, qr }"}}}},"/v1/kiosk/punch":{"post":{"summary":"Kiosk device: clock in or out with employee number and PIN, optional JPEG selfie (header X-Kiosk-Token)","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["employeeNo","pin"],"properties":{"employeeNo":{"type":"string"},"pin":{"type":"string"},"selfie":{"type":"string","description":"data:image/jpeg;base64,..."}}}}}},"responses":{"200":{"description":"Punch"}}}},"/v1/payroll/settings":{"get":{"summary":"Payroll settings: EPF/ETF employer numbers, TIN, pay day, OT and no-pay rules, statutory rates (HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"patch":{"summary":"Update payroll settings (OWNER, ADMIN, HR)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"epfRegNo":{"type":"string"},"etfRegNo":{"type":"string"},"employerTin":{"type":"string"},"payDay":{"type":"integer"},"otRate":{"type":"number"},"holidayOtRate":{"type":"number"},"otDivisor":{"type":"integer"},"noPayDivisor":{"type":"integer"},"absentAsNoPay":{"type":"boolean"}}}}}}}},"/v1/payroll/components":{"get":{"summary":"Allowances and deductions the company uses. Seeded with common Sri Lankan items","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Add an allowance or deduction","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["name","kind"],"properties":{"name":{"type":"string"},"kind":{"enum":["EARNING","DEDUCTION"]},"epfLiable":{"type":"boolean","description":"Counts towards EPF/ETF total earnings"},"taxable":{"type":"boolean"},"lumpSum":{"type":"boolean","description":"Taxed with APIT Table 2 (bonus, leave encashment)"},"active":{"type":"boolean"}}}}}}}},"/v1/payroll/components/{id}":{"patch":{"summary":"Update an allowance or deduction","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete (only when no employee uses it). Error: IN_USE","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/payroll/employees/{id}":{"get":{"summary":"An employee’s pay: basic, recurring items, EPF/APIT flags, loans with amounts recovered","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/payroll/employees/{id}/items":{"put":{"summary":"Replace their recurring monthly items","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"type":"object","properties":{"componentId":{"type":"string"},"amount":{"type":"number"}}}}}}}}}}},"/v1/payroll/employees/{id}/tax":{"patch":{"summary":"EPF eligibility, primary employment declaration (APIT) and TIN","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"epfEligible":{"type":"boolean"},"apitPrimary":{"type":"boolean"},"tin":{"type":"string"}}}}}}}},"/v1/payroll/employees/{id}/loans":{"post":{"summary":"Give a loan or salary advance, recovered monthly from payroll","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["principal","instalment","startPeriod"],"properties":{"name":{"type":"string"},"principal":{"type":"number"},"instalment":{"type":"number"},"startPeriod":{"type":"string","example":"2026-11"},"note":{"type":"string"}}}}}}}},"/v1/payroll/loans/{id}":{"patch":{"summary":"Change instalment, close or reopen a loan","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete a loan nothing has been recovered on yet","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/payroll/runs":{"get":{"summary":"Payroll months with totals (gross, net, EPF, ETF, APIT, employer cost)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Calculate (or recalculate a draft) payroll for a month from salaries, allowances, attendance overtime, unpaid leave and loans","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["period"],"properties":{"period":{"type":"string","example":"2026-11"}}}}}}}},"/v1/payroll/runs/{period}":{"get":{"summary":"A payroll month with every payslip, notes for HR and people skipped","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"period","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"description":"Pay month, e.g. 2026-11"}]},"delete":{"summary":"Delete a draft payroll","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"period","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"description":"Pay month, e.g. 2026-11"}]}},"/v1/payroll/runs/{period}/payslips/{employeeId}/one-offs":{"put":{"summary":"This month only: bonus, arrears, damages... then recalculates","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"period","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"description":"Pay month, e.g. 2026-11"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["items"],"properties":{"items":{"type":"array","items":{"type":"object","required":["name","kind","amount"],"properties":{"name":{"type":"string"},"kind":{"enum":["EARNING","DEDUCTION"]},"amount":{"type":"number"},"lumpSum":{"type":"boolean"},"taxable":{"type":"boolean"},"epfLiable":{"type":"boolean"}}}}}}}}}}},"/v1/payroll/runs/{period}/approve":{"post":{"summary":"Lock the month. Closes fully recovered loans. Error: NEGATIVE_NET","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"period","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"description":"Pay month, e.g. 2026-11"}]}},"/v1/payroll/runs/{period}/reopen":{"post":{"summary":"Back to draft (not after statutory payments are marked or a later month exists)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"period","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"description":"Pay month, e.g. 2026-11"}]}},"/v1/payroll/runs/{period}/payments":{"post":{"summary":"Mark EPF, ETF or APIT for the month as paid or unpaid","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"period","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"description":"Pay month, e.g. 2026-11"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["kind","paid"],"properties":{"kind":{"enum":["EPF","ETF","APIT"]},"paid":{"type":"boolean"}}}}}}}},"/v1/payroll/runs/{period}/send":{"post":{"summary":"Email PDF payslips to employees (approved months). 202 with queued count and people without email","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"parameters":[{"name":"period","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"description":"Pay month, e.g. 2026-11"}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":[],"properties":{"employeeIds":{"type":"array","items":{"type":"string"}},"resend":{"type":"boolean"}}}}}}}},"/v1/payroll/runs/{period}/export/{kind}":{"get":{"summary":"CSV: bank (transfer list), epf (C-Form details), etf, apit (monthly schedule) or register","security":[{"bearer":[]}],"responses":{"200":{"description":"CSV file","content":{"text/csv":{}}}},"parameters":[{"name":"period","in":"path","required":true,"schema":{"type":"string","pattern":"^\\d{4}-\\d{2}$"},"description":"Pay month, e.g. 2026-11"},{"name":"kind","in":"path","required":true,"schema":{"enum":["bank","epf","etf","apit","register"]}}]}},"/v1/payroll/payslips/{id}/pdf":{"get":{"summary":"Payslip PDF (HR, or the employee once approved), in the employee’s language (en, si or ta; Sinhala and Tamil need the Growth plan)","security":[{"bearer":[]}],"responses":{"200":{"description":"PDF","content":{"application/pdf":{}}}},"parameters":[{"name":"download","in":"query","required":false,"schema":{"type":"string"},"description":"Any value: download instead of open"},{"name":"lang","in":"query","required":false,"schema":{"type":"string"},"description":"en | si | ta: print in this language instead"}]}},"/v1/payroll/me/payslips":{"get":{"summary":"Your approved payslips, newest first","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/payroll/deadlines":{"get":{"summary":"APIT (15th), EPF and ETF (last working day) due dates with amounts and paid status, plus annual returns","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/payroll/gratuity":{"get":{"summary":"Gratuity liability: half a month’s salary per completed year, payable after 5 years (15+ workers)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/billing":{"get":{"summary":"Plan, trial, seats used, current subscription, invoices and the price list (OWNER, ADMIN)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/billing/checkout":{"post":{"summary":"Start a monthly PayHere subscription. Returns { action, fields }: POST the fields as a form to action. Errors: TOO_FEW_SEATS, TOO_MANY_SEATS, SAME_PLAN, BILLING_OFF","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["planId","seats","phone","city"],"properties":{"planId":{"enum":["starter","growth","pro"]},"seats":{"type":"integer"},"phone":{"type":"string"},"city":{"type":"string"}}}}}}}},"/v1/billing/checkout/{orderId}":{"get":{"summary":"Status of a checkout after returning from PayHere: PENDING, ACTIVE or FAILED","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/billing/cancel":{"post":{"summary":"Stop renewing (OWNER). The plan lasts until the end of the paid month","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/billing/invoices/{id}/pdf":{"get":{"summary":"Invoice PDF","security":[{"bearer":[]}],"responses":{"200":{"description":"PDF","content":{"application/pdf":{}}}}}},"/v1/billing/payhere/notify":{"post":{"summary":"PayHere server callback (form-encoded, verified by md5sig). Not for clients.","responses":{"200":{"description":"OK"}}}},"/v1/mobile/home":{"get":{"summary":"Everything the mobile Today screen needs in one call: today’s attendance and next punch, leave balances and next leave, latest payslip, approvals waiting (isApprover, pending)","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/me/push-tokens":{"post":{"summary":"Register an Expo push token for this user (a device moves to whoever signed in last). Pushes: leave to approve, leave decisions, payslips ready, statutory deadlines, billing","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string","example":"ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]"},"platform":{"enum":["ios","android","web"]}}}}}}},"delete":{"summary":"Stop push notifications to this device (call before signing out)","security":[{"bearer":[]}],"responses":{"204":{"description":"Removed"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["token"],"properties":{"token":{"type":"string","example":"ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]"},"platform":{"enum":["ios","android","web"]}}}}}}}},"/v1/assets":{"get":{"summary":"Company assets (?status=AVAILABLE|ASSIGNED|REPAIR|RETIRED, ?employeeId=, ?category=, ?q=), with counts, total value and how many are held by people who have left. HR. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Add an asset {tag?, name, category, serialNo?, purchasedOn?, cost?, warrantyEndsOn?, branchId?, condition?, notes?}. A blank tag gets the next AST-0000 number. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/assets/mine":{"get":{"summary":"Assets the signed-in employee holds now, with the date they got each one. Any plan.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/assets/export.csv":{"get":{"summary":"Asset register as CSV. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"CSV (UTF-8 with BOM)","content":{"text/csv":{}}}}}},"/v1/assets/{id}":{"get":{"summary":"An asset with every hand-over (who, when, condition out and in). Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"patch":{"summary":"Edit an asset, or set status REPAIR, RETIRED or AVAILABLE (not while someone holds it). Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete an asset that was never handed out (otherwise retire it). Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"204":{"description":"Deleted"}}}},"/v1/assets/{id}/assign":{"post":{"summary":"Hand an asset to an employee {employeeId, date?, condition?, note?}. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/assets/{id}/return":{"post":{"summary":"Take an asset back {date?, condition, status?: AVAILABLE|REPAIR|RETIRED, note?}. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/vehicles":{"get":{"summary":"Company vehicles with driver, papers (revenue licence, insurance, emission test: OK, SOON within 30 days, EXPIRED), service due and this month’s spend. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Add a vehicle {regNo, kind, make?, model?, year?, fuelType, branchId?, driverId?, odometerKm?, nextServiceKm?, licenceExpiresOn?, insuranceExpiresOn?, emissionExpiresOn?, notes?}. Plates are normalised, e.g. \"wp cab 1234\" → \"WP CAB-1234\". Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/vehicles/logs.csv":{"get":{"summary":"Fuel, service and repair log for all vehicles as CSV (?from=&to=, default this month). Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"CSV (UTF-8 with BOM)","content":{"text/csv":{}}}}}},"/v1/vehicles/{id}":{"get":{"summary":"A vehicle with its log (latest 200), km per litre and 12-month costs. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"patch":{"summary":"Edit a vehicle, or set status ACTIVE|REPAIR|SOLD. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"delete":{"summary":"Delete a vehicle with no log entries (otherwise mark it sold). Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"204":{"description":"Deleted"}}}},"/v1/vehicles/{id}/logs":{"post":{"summary":"Log fuel, a service, a repair or a trip {kind, date, odometerKm?, amount?, litres?, note?, employeeId?, nextServiceKm?}. Raises the odometer if higher. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/vehicles/{id}/logs/{logId}":{"delete":{"summary":"Delete a log entry. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"204":{"description":"Deleted"}}}},"/v1/petty-cash/funds":{"get":{"summary":"Petty cash boxes with balance, float, spend this month and top-up needed. HR sees all; a custodian sees their own. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Open a cash box {name, branchId?, custodianId?, floatAmount, openingBalance?}. HR. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/petty-cash/funds/{id}":{"patch":{"summary":"Edit a cash box or close it (isActive: false). HR. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/petty-cash/funds/{id}/entries":{"get":{"summary":"Cash book for a box (?from=&to=, default last 60 days): opening balance and entries newest first with a running balance. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Record an expense or (HR only) a top-up. multipart/form-data: kind, date, amount, category, description, payee, receipt (photo or PDF of the bill). An expense can’t take the box below zero. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/petty-cash/funds/{id}/entries/{entryId}/void":{"post":{"summary":"Void an entry {reason}. Entries are never deleted. HR. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/petty-cash/funds/{id}/entries/{entryId}/receipt":{"get":{"summary":"The bill attached to an entry. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"The file"}}}},"/v1/petty-cash/funds/{id}/export.csv":{"get":{"summary":"Cash book as CSV for the accountant (?from=&to=, default this month). Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"CSV (UTF-8 with BOM)","content":{"text/csv":{}}}}}},"/v1/visitors":{"get":{"summary":"Visitor book for a day (?date=, default today; ?branchId=), plus anyone still signed in. HR and managers. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Sign a visitor in {name, phone?, nic?, organisation?, purpose, hostId?, branchId?, badgeNo?, vehicleNo?, note?}. The host gets a push notification. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/visitors/lookup":{"get":{"summary":"Last visit by a phone number (?phone=), to fill the form for a returning visitor. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/visitors/export.csv":{"get":{"summary":"Visitor book as CSV (?from=&to=, default last 30 days). Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"CSV (UTF-8 with BOM)","content":{"text/csv":{}}}}}},"/v1/visitors/{id}":{"patch":{"summary":"Correct a visit’s details. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/visitors/{id}/out":{"post":{"summary":"Sign a visitor out now. Needs the Growth plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/mobile/language":{"put":{"summary":"Set the signed-in person’s language {language: en|si|ta}. Their payslips (Growth plan) and notifications follow it.","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/calculators/take-home":{"get":{"summary":"Monthly take-home pay from a salary: EPF 8%, APIT Table 1, and the employer’s EPF 12% and ETF 3%. Public, no sign-in.","parameters":[{"name":"basic","in":"query","required":true,"schema":{"type":"number","minimum":0},"description":"Monthly basic salary (LKR)"},{"name":"epfAllowances","in":"query","required":false,"schema":{"type":"number","minimum":0},"description":"Monthly allowances that count for EPF/ETF"},{"name":"otherAllowances","in":"query","required":false,"schema":{"type":"number","minimum":0},"description":"Other taxable monthly allowances"},{"name":"epf","in":"query","required":false,"schema":{"type":"string","enum":["true","false"]},"description":"false if not covered by EPF"}],"responses":{"200":{"description":"OK"}}}},"/v1/calculators/apit":{"get":{"summary":"APIT (Table 1, primary employment, from 1 April 2025) on a month’s regular pay. Public.","parameters":[{"name":"monthly","in":"query","required":true,"schema":{"type":"number","minimum":0},"description":"Monthly regular pay (LKR)"}],"responses":{"200":{"description":"OK"}}}},"/v1/calculators/epf-etf":{"get":{"summary":"EPF and ETF on a monthly EPF base. Public.","parameters":[{"name":"base","in":"query","required":true,"schema":{"type":"number","minimum":0},"description":"Basic plus EPF-liable allowances (LKR)"}],"responses":{"200":{"description":"OK"}}}},"/v1/calculators/gratuity":{"get":{"summary":"Gratuity under the Payment of Gratuity Act (half a month per completed year, after 5 years). Public.","parameters":[{"name":"monthlySalary","in":"query","required":true,"schema":{"type":"number","minimum":0},"description":"Last monthly salary (LKR)"},{"name":"joinedOn","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Date joined"},{"name":"leavingOn","in":"query","required":true,"schema":{"type":"string","format":"date"},"description":"Date leaving"}],"responses":{"200":{"description":"OK"}}}},"/v1/api-keys":{"get":{"summary":"API keys for the company, and the scopes a key can have. OWNER or ADMIN, signed in as a person. Needs the Pro plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}},"post":{"summary":"Create a key {name, scopes[], expiresInDays: 30|90|365|null}. The key (hrk_…) is in the response once; only its hash is stored. Needs the Pro plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"201":{"description":"{ item, key }"}}}},"/v1/api-keys/{id}":{"delete":{"summary":"Revoke a key. It stops working at once. Needs the Pro plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"204":{"description":"Revoked"}}}},"/v1/mcp":{"post":{"summary":"Model Context Protocol server (Streamable HTTP, stateless, JSON responses; protocol 2025-03-26 to 2025-11-25). Send one JSON-RPC message per request: initialize, tools/list, tools/call, ping. Tools follow the API key’s scopes; each call runs through the same REST routes and checks. 120 requests a minute per key. Needs the Pro plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/assistant/chat":{"post":{"summary":"Ask the AI HR assistant {messages: [{role: user|assistant, content}]} (ending with the user’s question). It answers from the company’s data as the signed-in person, and returns {reply, proposals, toolsUsed, remainingToday}. Leave decisions come back as proposals for the person to confirm. Signed-in people only, not API keys. Needs the Pro plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}},"/v1/assistant/status":{"get":{"summary":"Whether the assistant is switched on, and the signed-in person’s questions today and daily limit. Needs the Pro plan (402 FEATURE_NOT_IN_PLAN otherwise).","security":[{"bearer":[]}],"responses":{"200":{"description":"OK"}}}}}}