API Reference
All Inspect Africa Pro endpoints require a valid Supabase JWT and enforce per-tenant row-level isolation. Authentication is via Authorization: Bearer <token> on every request.
Authentication & Rate Limiting
| Mechanism | Detail |
|---|---|
| JWT Bearer | Supabase-issued access token, refreshed automatically |
| requireTenant() | Validates session and injects companyId -- every route uses this |
| requirePermission(scope) | Extends tenant check with RBAC scope: aviation:read, aviation:write, admin |
| rateLimitDB | IP-based, Supabase-backed: 5 req / 60 s on auth scope. Fails closed on DB outage. |
| Account lockout | 3 failed sign-in attempts triggers 15-min per-email lock (tracked in login_attempts) |
Fleet & Aircraft
/api/aviation/aogaviation:readList all AOG (Aircraft on Ground) defects for the tenant fleet.
/api/aviation/aogaviation:writeRaise a new AOG defect. Required body: { aircraft_id, title, ata_chapter?, description?, station? }
/api/aviation/aog/financial-impactaviation:readEstimate revenue loss per grounded aircraft. Returns hours_grounded, daily_revenue_loss, total_loss, escalation tier.
/api/aviation/airspace-authaviation:readFleet airspace authorisations: RVSM, RNP-AR, MNPS, ETOPS-120/180, LVO CAT II/III. Optional ?aircraft_id= filter.
/api/aviation/utilisationaviation:readAircraft utilisation report: FH, cycles, dispatch reliability per aircraft. Optional ?months= (default 3).
/api/aviation/arc/checkaviation:readAirworthiness Review Certificate status per aircraft. Optional ?aircraft_id= filter.
/api/aviation/weight-balanceaviation:readWeight and balance envelope data per aircraft.
Maintenance Operations
/api/aviation/workordersaviation:readList work orders for the tenant. Supports status, aircraft_id filters.
/api/aviation/workordersaviation:writeCreate a work order. Required: { aircraft_id, title, ata_chapter }.
/api/aviation/workorders/transitionaviation:writeAdvance a work order through its lifecycle: open → in_progress → inspection_required → completed → closed.
/api/aviation/workorders/log-hoursaviation:writeRecord technician labour hours against a work order.
/api/aviation/taskcards/stepsaviation:readRetrieve task card steps for a work order.
/api/aviation/taskcards/signoffaviation:writeSign off a task card step with licence number and technician ID.
/api/aviation/transit-checkaviation:readTransit check status per aircraft and station.
/api/aviation/workshopaviation:readWorkshop job list and bench allocation.
Technical Log
/api/aviation/techlogaviation:readRetrieve tech log entries for a flight or aircraft.
/api/aviation/techlog/signaviation:writeEngineer sign-off on a tech log entry with licence and stamp.
/api/aviation/techlog/captain-signaviation:writeCaptain acceptance signature on a deferred defect.
MEL, Defects & Anomalies
/api/aviation/anomalyaviation:readAI-assisted anomaly detection: recurring ATA chapters (3+ defects in 90 days), CAT A MEL items, elevated technical delay rates.
/api/aviation/aog-predictionaviation:readPredictive AOG probability per aircraft over ?days= horizon (default 14). Weighted model: defect history, MEL status, engine life, FDM events, parts stock.
Stores & Parts
/api/aviation/storesaviation:readParts inventory with AOG-stock flags and minimum-stock alerts.
/api/aviation/stores/issueaviation:writeIssue a part from stores to a work order. Deducts from quantity_on_hand.
/api/aviation/stores/reserveaviation:writeReserve stock for a planned work order.
/api/aviation/stores/movementaviation:writeRecord a stock movement (receipt, transfer, adjustment).
/api/aviation/spares-forecastaviation:readDemand forecast for consumable parts based on fleet utilisation trends.
Approvals & AMP
/api/aviation/approvalsaviation:readApproval audit trail. Filter by ?entity_type= (ncr | ca | wo | dispatch | amp).
/api/aviation/approvalsaviation:readSubmit a stage transition with signature and licence number.
/api/aviation/ampaviation:readAircraft Maintenance Programme history. Workflow: draft → under_review → approved → superseded.
Vendors & Tooling
/api/aviation/vendorsaviation:readApproved vendor register.
/api/aviation/vendors/qualifyaviation:writeUpdate vendor qualification status and expiry date.
/api/aviation/toolingaviation:readCalibrated tool inventory with next-calibration dates.
/api/aviation/tooling/issueaviation:writeIssue a tool to a technician for a job.
/api/aviation/tooling/returnaviation:writeReturn a tool to stores. Updates last-used date.
/api/aviation/tooling/validateaviation:readValidate that a tool is in-calibration and available for a task.
Other
/api/aviation/trainingaviation:readTechnician training records and currency status.
/api/aviation/stationsaviation:readStation (base) list with active aircraft counts.
/api/aviation/technicianaviation:readTechnician register with licence numbers and ratings.
/api/aviation/sync/reconcileaviation:readReconcile locally-cached data with the live database.
/api/aviation/sseaviation:readServer-Sent Events stream for real-time fleet status updates.
Error codes
| Status | Meaning |
|---|---|
| 400 | Missing or invalid request body field |
| 401 | Missing or expired JWT, or tenant validation failure |
| 403 | Insufficient RBAC permission for the requested scope |
| 429 | Rate limit exceeded or account locked (sign-in) |
| 500 | Database error -- see server logs |