All endpoints available in this service. Use the table below to integrate with the frontend.
| API name | Method | Endpoint | Description | How to use in frontend |
|---|---|---|---|---|
| Health check | GET | /api/health | Returns API health status. | fetch('/api/health') or use for uptime checks. |
| Auth config | GET | /api/v1/auth/config | Public auth configuration (portal, loginIdentifier, tenantSlug). | getAuthConfig() before login to decide email vs phone UI. |
| Check email | POST | /api/v1/auth/check-email | Check if email exists (super-admin portal). | POST body: { email }. Use before sending OTP. |
| Login | POST | /api/v1/auth/login | Authenticate and get session/token. | POST body: credentials. Store token; set cookie or Authorization header. |
| OTP start | POST | /api/v1/auth/otp/start | Request OTP (phone/email) for org portal. | POST body: { phone } or { email }. Then call OTP verify. |
| OTP verify | POST | /api/v1/auth/otp/verify | Verify OTP code and complete login. | POST body: { id, code }. Returns token/session. |
| Logout | POST | /api/v1/auth/logout | Invalidate current session. | POST with credentials. Clear token and redirect to login. |
| Current user (Me) | GET | /api/v1/me | Get current authenticated user, tenant, roles, scopes. | getCurrentUser() after login. Use for layout, role, tenantId. |
| List organizations | GET | /api/v1/organizations | List organizations (super-admin or tenant-scoped). | getOrganizations() or similar. Include Authorization header. |
| Get organization | GET | /api/v1/organizations/[id] | Get single organization by ID. | getOrganization(orgId). Returns name, logoUrl, etc. |
| Update organization | PATCH | /api/v1/organizations/[id] | Update organization details. | PATCH with body. Require admin/owner role. |
| List organization members | GET | /api/v1/organizations/[id]/members | List members (users) of an organization. | getOrganizationMembers(orgId). Use for schedules, job list, dropdowns. |
| Get/Update member | GETPATCHDELETE | /api/v1/organizations/[id]/members/[userId] | Get, update, or remove a member. | Request with orgId and userId. Use for user detail/edit. |
| List locations | GET | /api/v1/organizations/[id]/locations | List locations (properties) for an organization. | getOrganizationLocations(orgId). Use for property switcher. |
| Get/Update location | GETPATCHDELETE | /api/v1/organizations/[id]/locations/[locationId] | Get or update a location. | CRUD with orgId and locationId. |
| List schedules | GET | /api/v1/schedules | List schedules (access-filtered: only assigned or creator). | getSchedules(). Returns items[]. Use for Schedule Lobby. |
| Create schedule | POST | /api/v1/schedules | Create a new schedule. | createSchedule({ name, assigneeGroupIds, assigneeUserIds, assigneeUserIdsExpanded, detailsConfig }). |
| Get schedule | GET | /api/v1/schedules/[id] | Get a schedule by ID (403 if no access). | getSchedule(scheduleId). Use on Schedule Detail page. |
| Update schedule | PATCH | /api/v1/schedules/[id] | Update schedule (name, assignees, detailsConfig). | updateSchedule(scheduleId, body). |
| Delete schedule | DELETE | /api/v1/schedules/[id] | Delete a schedule and its shifts. | deleteSchedule(scheduleId). |
| List shifts | GET | /api/v1/schedules/[id]/shifts | List shifts for a schedule (same access as schedule). | getShifts(scheduleId). Returns items[] with employee_id, shift_date, etc. |
| Create shift | POST | /api/v1/schedules/[id]/shifts | Create a shift (one per user or open shift). | createShift(scheduleId, { assignedUserId, jobId, shiftDate, startTime, endTime, title, instructions, status, isOpenShift }). |
| Get shift | GET | /api/v1/schedules/[id]/shifts/[shiftId] | Get a single shift. | GET with scheduleId and shiftId. |
| Update shift | PATCH | /api/v1/schedules/[id]/shifts/[shiftId] | Update shift (assignee, times, title, status, etc.). | updateShift(scheduleId, shiftId, body). |
| Delete shift | DELETE | /api/v1/schedules/[id]/shifts/[shiftId] | Delete a shift. | deleteShift(scheduleId, shiftId). |
| List jobs | GET | /api/v1/job-list | List jobs for the current tenant. | getJobs(). Returns items with job_name, code, color, etc. Use in shift form and Job List page. |
| Create job | POST | /api/v1/job-list | Create a new job. | createJob({ name, code, description, color, ... }). |
| Get job | GET | /api/v1/job-list/[id] | Get a job by ID. | GET /api/v1/job-list/{id}. |
| Update job | PATCH | /api/v1/job-list/[id] | Update a job. | updateJob(id, body). |
| Delete job | DELETE | /api/v1/job-list/[id] | Delete a job. | deleteJob(id). |
| Bulk delete jobs | POST | /api/v1/job-list/bulk | Delete multiple jobs by IDs. | POST body: { ids: string[] }. |
| List segments (with groups) | GET | /api/v1/smart-groups | List segments and their smart groups for the tenant. | getSegments(). Use for Schedule assignees and Smart Groups page. |
| List segments (flat) | GET | /api/v1/smart-groups/segments | List segments. | GET /api/v1/smart-groups/segments. |
| Create segment | POST | /api/v1/smart-groups/segments | Create a segment. | POST with name, etc. |
| Get/Update/Delete segment | GETPATCHDELETE | /api/v1/smart-groups/segments/[id] | Segment CRUD. | Use segment id in schedule assignees and group rules. |
| Get/Update/Delete smart group | GETPATCHDELETE | /api/v1/smart-groups/[id] | Smart group CRUD (rules, logic). | Use with filterEmployeesBySmartGroup() for member list. |
| Clock in/out | POST | /api/v1/clock | Time clock punch (in/out). | POST with jobId, clockId, etc. Use from Time Clock UI. |
| Presign upload | POST | /api/v1/files/presign | Get presigned URL for file upload (e.g. S3). | POST body: { key, contentType }. Upload file to returned URL. |
| Super admin users | GET | /api/v1/super-admin/users | List users (super-admin only). | Only when portal === 'super-admin'. Include auth. |
| Tickets | GETPOST | /api/v1/tickets | Support or internal tickets. | Use from support/chat UI if integrated. |