API Overview
Complete index of all API endpoints across the system, organized by feature.
Base URL
Production: https://api.restartix.com
Development: http://localhost:9000All endpoints require authentication unless marked as [Public].
Core Features
Authentication & Users
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/me | Get current user profile |
| PUT | /v1/me/switch-organization | Switch active organization |
| POST | /webhooks/clerk | Clerk webhook handler (sync users) [Public] |
Organizations
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/public/organizations/resolve | Resolve org by slug or custom domain [Public] |
| GET | /v1/organizations | List organizations |
| POST | /v1/organizations | Create organization (superadmin) |
| GET | /v1/organizations/{id} | Get organization details |
| PATCH | /v1/organizations/{id} | Update organization (admin) |
| DELETE | /v1/organizations/{id} | Delete organization (superadmin) |
| GET | /v1/organizations/{id}/domains | List custom domains |
| POST | /v1/organizations/{id}/domains | Add custom domain (admin) |
| DELETE | /v1/organizations/{id}/domains/{domainId} | Remove custom domain (admin) |
| POST | /v1/organizations/{id}/domains/{domainId}/verify | Verify domain DNS (admin) |
| GET | /v1/organizations/{id}/api-keys | List API keys (admin) |
| POST | /v1/organizations/{id}/api-keys | Create API key (admin) |
| DELETE | /v1/organizations/{id}/api-keys/{service} | Delete API key (admin) |
| POST | /v1/organizations/{id}/connect-user | Add user to org (admin) |
Appointment & Scheduling
Appointments
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/appointments | List appointments (filtered by user role) |
| POST | /v1/appointments | Create appointment |
| POST | /v1/appointments/from-template | Create from template |
| GET | /v1/appointments/{id} | Get appointment details |
| PUT | /v1/appointments/{id} | Update appointment |
| DELETE | /v1/appointments/{id} | Delete appointment |
| PUT | /v1/appointments/{id}/status | Transition status |
| PUT | /v1/appointments/{id}/reschedule | Reschedule appointment |
| PUT | /v1/appointments/{id}/cancel | Cancel appointment |
| POST | /v1/appointments/{id}/onboard | Complete patient onboarding |
| POST | /v1/appointments/{id}/attach-forms | Attach form templates |
Calendar Views
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/calendar | Month view (default: current month) |
| GET | /v1/calendar?view=week | Week view (detailed appointments) |
Appointment Templates
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/appointment-templates | List templates |
| POST | /v1/appointment-templates | Create template (admin) |
| GET | /v1/appointment-templates/{id} | Get template details |
| PUT | /v1/appointment-templates/{id} | Update template (admin) |
| DELETE | /v1/appointment-templates/{id} | Delete template (admin) |
| POST | /v1/appointment-templates/{id}/attach-forms | Attach form templates |
| DELETE | /v1/appointment-templates/{id}/forms/{formTemplateId} | Detach form |
| POST | /v1/appointment-templates/{id}/attach-specialists | Set specialist priorities |
| DELETE | /v1/appointment-templates/{id}/specialists/{specialistId} | Remove specialist |
Scheduling
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/scheduling/timeslots | Get available timeslots [Public] |
| POST | /v1/scheduling/holds | Create hold [Public] |
| DELETE | /v1/scheduling/holds/{holdId} | Release hold [Public] |
| POST | /v1/scheduling/book | Confirm booking [Public] |
| GET | /v1/scheduling/holds/{holdId}/stream | SSE stream (hold updates) [Public] |
Profile Management
Patients
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/patients | List patients (admin/specialist) |
| POST | /v1/patients | Create patient (admin) |
| GET | /v1/patients/{id} | Get patient details |
| PUT | /v1/patients/{id} | Update patient |
| DELETE | /v1/patients/{id} | Delete patient (admin) |
| GET | /v1/patients/{id}/profile | Get custom field values |
| PUT | /v1/patients/{id}/profile | Update custom field values |
| POST | /v1/patients/{id}/impersonate | Impersonate patient (admin) |
Specialists
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/specialists | List specialists |
| POST | /v1/specialists | Create specialist (admin) |
| GET | /v1/specialists/{id} | Get specialist details |
| PUT | /v1/specialists/{id} | Update specialist |
| DELETE | /v1/specialists/{id} | Delete specialist (admin) |
| GET | /v1/specialists/{id}/profile | Get custom field values |
| PUT | /v1/specialists/{id}/profile | Update custom field values |
| GET | /v1/specialists/{id}/availability | Get weekly hours + overrides |
| PUT | /v1/specialists/{id}/availability | Update availability config |
Specialties
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/specialties | List specialties |
| POST | /v1/specialties | Create specialty (admin) |
| GET | /v1/specialties/{id} | Get specialty details |
| PUT | /v1/specialties/{id} | Update specialty (admin) |
| DELETE | /v1/specialties/{id} | Delete specialty (admin) |
Forms (Templates + Instances)
See Forms Feature Documentation for complete details.
Form Templates (Design)
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/form-templates | List templates |
| POST | /v1/form-templates | Create template (admin) |
| GET | /v1/form-templates/{id} | Get template details |
| PUT | /v1/form-templates/{id} | Update template draft (admin) |
| DELETE | /v1/form-templates/{id} | Delete template (admin, drafts only) |
| POST | /v1/form-templates/{id}/publish | Publish version (admin) |
| POST | /v1/form-templates/{id}/duplicate | Duplicate template (admin) |
| GET | /v1/form-templates/{id}/versions | List version history |
| POST | /v1/form-templates/{id}/rollback/{version} | Rollback to version (admin) |
Form Instances (Runtime)
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/forms | List forms |
| POST | /v1/forms | Create form instance |
| GET | /v1/forms/{id} | Get form details |
| PUT | /v1/forms/{id} | Save form values |
| DELETE | /v1/forms/{id} | Delete form (admin, unsigned only) |
| POST | /v1/forms/{id}/sign | Sign form (immutable) |
| POST | /v1/forms/{id}/files | Upload file to field |
| GET | /v1/forms/{id}/files/{fieldKey} | Get signed URL for file |
| DELETE | /v1/forms/{id}/files/{fieldKey} | Delete file (unsigned only) |
Custom Fields
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/custom-fields | List custom field definitions |
| POST | /v1/custom-fields | Create custom field (admin) |
| GET | /v1/custom-fields/{id} | Get custom field definition |
| PUT | /v1/custom-fields/{id} | Update custom field (admin) |
| DELETE | /v1/custom-fields/{id} | Delete custom field (admin) |
Segments
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/segments | List segments |
| POST | /v1/segments | Create segment (admin) |
| GET | /v1/segments/{id} | Get segment details |
| PUT | /v1/segments/{id} | Update segment rules (admin) |
| DELETE | /v1/segments/{id} | Delete segment (admin) |
| GET | /v1/segments/{id}/members | List segment members |
| POST | /v1/segments/{id}/evaluate | Re-evaluate membership (admin) |
Telerehabilitation
Exercise Library
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/exercises | List/search exercises (global + org, taxonomy filters) |
| POST | /v1/exercises | Create exercise (admin: org, superadmin: global) |
| GET | /v1/exercises/{id} | Get exercise with instructions, tags, contraindications |
| PUT | /v1/exercises/{id} | Update exercise |
| DELETE | /v1/exercises/{id} | Soft delete exercise |
| PUT | /v1/exercises/{id}/status | Transition status (draft/published/archived) |
| POST | /v1/exercises/{id}/clone | Clone exercise (global→org or org→org) |
| POST | /v1/exercises/{id}/video | Upload video |
| DELETE | /v1/exercises/{id}/video | Remove video |
| GET | /v1/exercises/{id}/instructions | List instruction steps |
| POST | /v1/exercises/{id}/instructions | Add instruction step |
| PUT | /v1/exercises/{id}/instructions/{instructionId} | Update instruction |
| DELETE | /v1/exercises/{id}/instructions/{instructionId} | Remove instruction |
| POST | /v1/exercises/{id}/instructions/{instructionId}/image | Upload instruction image |
| PUT | /v1/exercises/{id}/instructions/reorder | Reorder instructions |
| GET | /v1/exercise-categories | List categories (global + org) |
| POST | /v1/exercise-categories | Create category |
| PUT | /v1/exercise-categories/{id} | Update category |
| DELETE | /v1/exercise-categories/{id} | Delete category |
| GET | /v1/exercise-body-regions | List body regions |
| POST | /v1/exercise-body-regions | Create body region |
| PUT | /v1/exercise-body-regions/{id} | Update body region |
| DELETE | /v1/exercise-body-regions/{id} | Delete body region |
| GET | /v1/exercise-equipment | List equipment |
| POST | /v1/exercise-equipment | Create equipment |
| PUT | /v1/exercise-equipment/{id} | Update equipment |
| DELETE | /v1/exercise-equipment/{id} | Delete equipment |
Treatment Plans
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/treatment-plans | List treatment plans |
| POST | /v1/treatment-plans | Create treatment plan (draft) |
| GET | /v1/treatment-plans/{id} | Get plan with sessions and exercises |
| PUT | /v1/treatment-plans/{id} | Update plan (draft only) |
| DELETE | /v1/treatment-plans/{id} | Soft delete plan |
| POST | /v1/treatment-plans/{id}/publish | Publish version (creates snapshot) |
| PUT | /v1/treatment-plans/{id}/status | Transition plan status |
| GET | /v1/treatment-plans/{id}/versions | List version history |
| GET | /v1/treatment-plans/{id}/versions/{version} | Get specific version snapshot |
| POST | /v1/treatment-plans/{id}/rollback/{version} | Rollback to version |
| POST | /v1/treatment-plans/{id}/duplicate | Duplicate plan |
| POST | /v1/treatment-plans/{id}/clone | Clone plan (custom copy) |
| POST | /v1/treatment-plans/{id}/promote | Promote custom to org plan |
| GET | /v1/treatment-plans/library | Browse premade plans (patient) |
| POST | /v1/treatment-plans/{id}/self-assign | Patient self-assigns from library |
| GET | /v1/treatment-plans/{id}/sessions | List sessions in plan |
| POST | /v1/treatment-plans/{id}/sessions | Add session to plan |
| PUT | /v1/treatment-plans/{planId}/sessions/{sessionId} | Update session |
| DELETE | /v1/treatment-plans/{planId}/sessions/{sessionId} | Remove session |
| PUT | /v1/treatment-plans/{planId}/sessions/reorder | Reorder sessions |
| GET | /v1/treatment-plan-sessions/{sessionId}/exercises | List exercises in session |
| POST | /v1/treatment-plan-sessions/{sessionId}/exercises | Add exercise to session |
| PUT | /v1/treatment-plan-sessions/{sessionId}/exercises/{exerciseId} | Update exercise config |
| DELETE | /v1/treatment-plan-sessions/{sessionId}/exercises/{exerciseId} | Remove exercise |
| PUT | /v1/treatment-plan-sessions/{sessionId}/exercises/reorder | Reorder exercises |
| GET | /v1/patient-treatment-plans | List patient enrollments |
| POST | /v1/patient-treatment-plans | Assign plan to patient |
| GET | /v1/patient-treatment-plans/{id} | Get enrollment details |
| PUT | /v1/patient-treatment-plans/{id}/status | Change status (pause/resume/cancel) |
| POST | /v1/patient-treatment-plans/{id}/approve | Approve plan (approval workflow) |
| GET | /v1/patients/{patientId}/treatment-plans | List all plans for patient |
| GET | /v1/patients/{patientId}/treatment-plans/today | Get today's session |
| POST | /v1/patient-treatment-plans/{id}/sessions/{num}/start | Start session |
| PUT | /v1/patient-exercise-logs/{id} | Update exercise log (during session) |
| POST | /v1/patient-session-completions/{id}/complete | Complete session |
| POST | /v1/patient-session-completions/{id}/skip | Skip session |
| GET | /v1/patient-session-completions/{id} | Get session completion details |
| GET | /v1/patient-session-completions/{id}/exercise-logs | Get exercise logs |
| GET | /v1/patient-treatment-plans/{id}/progress | Get plan progress |
| GET | /v1/patient-treatment-plans/{id}/analytics | Get detailed analytics |
Services
Service Plan Bundled Products
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/service-plans/{id}/products | List bundled products |
| POST | /v1/service-plans/{id}/products | Add product to bundle |
| PUT | /v1/service-plans/{id}/products/{pid} | Update bundled quantity |
| DELETE | /v1/service-plans/{id}/products/{pid} | Remove from bundle |
Patient Product Orders
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/patient-product-orders | List product orders |
| POST | /v1/patient-product-orders | Create standalone order |
| PUT | /v1/patient-product-orders/{id}/status | Update order status |
| POST | /v1/patient-product-orders/{id}/cancel | Cancel order |
Supporting Features
PDF Templates
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/pdf-templates | List PDF templates |
| POST | /v1/pdf-templates | Create template (admin) |
| GET | /v1/pdf-templates/{id} | Get template details |
| PUT | /v1/pdf-templates/{id} | Update template draft (admin) |
| POST | /v1/pdf-templates/{id}/publish | Publish new version (admin) |
| POST | /v1/pdf-templates/{id}/rollback/{version} | Rollback to version (admin) |
| DELETE | /v1/pdf-templates/{id} | Delete template (admin) |
| GET | /v1/pdf-templates/{id}/preview | Preview with sample data |
| POST | /v1/pdf-templates/{id}/render | Render PDF with form data |
| POST | /v1/pdf-templates/batch-render | Batch render PDFs (async) |
| GET | /v1/pdf-template-components | List reusable components |
| POST | /v1/pdf-template-components | Create component (admin) |
| PUT | /v1/pdf-template-components/{id} | Update component (admin) |
| DELETE | /v1/pdf-template-components/{id} | Delete component (admin) |
Documents
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/reports | Generate report PDF |
| GET | /v1/reports/{id} | Get report details |
| GET | /v1/reports/{id}/download | Download signed PDF URL |
| POST | /v1/reports/{id}/sign | Digitally sign report |
| POST | /v1/prescriptions | Generate prescription PDF |
| GET | /v1/prescriptions/{id} | Get prescription details |
| GET | /v1/prescriptions/{id}/download | Download signed PDF URL |
| POST | /v1/prescriptions/{id}/sign | Digitally sign prescription |
Webhooks
| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/webhook-subscriptions | List webhook subscriptions (admin) |
| POST | /v1/webhook-subscriptions | Create subscription (admin) |
| PATCH | /v1/webhook-subscriptions/{uid} | Update subscription (admin) |
| DELETE | /v1/webhook-subscriptions/{uid} | Delete subscription (admin) |
| GET | /v1/webhook-subscriptions/{uid}/events | List delivery events (admin) |
| POST | /v1/webhook-subscriptions/{uid}/test | Send test event (admin) |
Telemetry (Telemetry & Compliance)
See Telemetry Feature Documentation for full documentation.
Media Events
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/media/events | Track video/exercise media event |
| GET | /v1/media/bandwidth/stats | Bandwidth statistics by dimension |
| GET | /v1/media/sessions/stats | Session statistics and performance |
Analytics
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/analytics/track | Track product analytics event |
Pose Tracking
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/pose/frames | Batch submit MediaPipe pose data |
Audit
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/audit/ingest | Ingest audit entry (internal) |
Error Tracking
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/errors/report | Report frontend error |
Admin
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/admin/geo/update | Update geolocation database |
| GET | /v1/admin/geo/status | Geo database status |
| GET | /v1/admin/privacy/exclusions | List CCPA exclusions |
| POST | /v1/admin/privacy/exclusions/sync | Sync MaxMind exclusions |
| GET | /v1/admin/privacy/exclusions/check | Check IP exclusion status |
Dashboard
| Method | Endpoint | Description |
|---|---|---|
| GET | /dashboard/ | Dashboard home |
| GET | /dashboard/audit | Audit viewer |
| GET | /dashboard/analytics | Analytics viewer |
| GET | /dashboard/media | Media session viewer |
| GET | /dashboard/security | Security events viewer |
| GET | /dashboard/detail/:type/:id | Detail view |
Global Conventions
Authentication
All endpoints (except [Public]) require:
Authorization: Bearer <clerk_session_token>Public endpoints:
/v1/public/organizations/resolve(domain routing)/webhooks/clerk(verified via HMAC signature)/v1/scheduling/*(public booking flow)
Organization Context
The active organization is determined by:
X-Organization-IDheader (set by frontend proxy based on domain resolution)- Falls back to user's
current_organization_idif header is not present - Superadmins can operate without org context (access all organizations)
Pagination
List endpoints support pagination:
GET /v1/patients?page=2&limit=50Response:
{
"data": [...],
"pagination": {
"page": 2,
"limit": 50,
"total": 237,
"total_pages": 5
}
}Defaults: page=1, limit=25, max limit=100
Filtering
List endpoints support filtering via query params:
GET /v1/appointments?status=upcoming&specialist_id=5
GET /v1/forms?status=pending&type=consent
GET /v1/patients?segment_id=10See individual feature docs for available filters.
Sorting
List endpoints support sorting:
GET /v1/appointments?sort=-started_at # Descending by started_at
GET /v1/patients?sort=created_at # Ascending by created_atFormat: sort={field} (ascending) or sort=-{field} (descending)
Error Responses
All errors return consistent format:
{
"error": {
"code": "validation_failed",
"message": "Validation error",
"details": {
"field": "email",
"error": "invalid format"
}
}
}Common error codes:
401- Unauthorized (invalid/missing token)403- Forbidden (insufficient permissions)404- Not Found409- Conflict (e.g., form already signed)422- Validation Failed429- Rate Limited500- Internal Server Error
Rate Limiting
API rate limits:
| Scope | Limit | Window |
|---|---|---|
| Per user | 1000 requests | 1 minute |
| Per IP (public endpoints) | 100 requests | 1 minute |
| Webhook deliveries | 50 events | 5 seconds |
Headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 987
X-RateLimit-Reset: 60Idempotency
POST/PUT/DELETE endpoints support idempotency via:
Idempotency-Key: <unique-client-generated-key>Server caches response for 24 hours. Duplicate requests return cached response.
Endpoint Count by Category
| Category | Endpoints | Features |
|---|---|---|
| Core | 11 | Auth, Organizations |
| Appointments & Scheduling | 28 | Appointments, Templates, Scheduling |
| Profiles | 19 | Patients, Specialists, Specialties |
| Forms System | 28 | Forms, Templates, Custom Fields, Segments |
| Telerehabilitation | 67 | Exercise Library (27), Treatment Plans (40) |
| Services | 8 | Bundled Products, Product Orders |
| Supporting | 15 | Documents, Webhooks |
| Telemetry | 18 | Media Events, Analytics, Pose Tracking, Audit, Error Tracking, Admin, Dashboard |
| Total | 194 | 28 |
Related Documentation
- Database Overview - All tables
- RBAC Permissions - Role-based access control
- Features Index - Feature-by-feature documentation