Skip to content

API Reference Overview

Oasis APIs power three experiences:

  • Rider experience: buy weekly cover, self-report disruptions, verify GPS, see wallet updates
  • Admin experience: monitor system health, run demos, review the platform
  • Automation: scheduled adjudicator runs detect disruptions and create payouts automatically

Most endpoints are documented in the interactive OpenAPI pages below (requests, responses, and examples).


flowchart LR
  UI[Rider/Admin UI] --> API[Oasis API]
  API --> DB[(Supabase)]
  API --> EXT[Weather / Traffic / News APIs]
  API --> PAY[Razorpay]
  DB --> RT[Realtime updates]
  RT --> UI

  • Most rider/admin routes use the user’s Supabase session (signed-in cookies).
  • System routes (like cron jobs) are protected with a shared secret (CRON_SECRET) so only Oasis can run them.

The following are internal or proxy routes that do not have formal OpenAPI contracts as they rely strictly on Supabase Auth context.

  • GET /api/admin/system-health: quick “is everything up?” status (DB + keys + last run)
  • GET /api/admin/analytics: aggregated admin dashboard numbers
  • GET /api/admin/insights: AI-generated insights (risk + top disruption zones)
Show example responses
{
"systemHealth": { "database": "ok", "lastRun": "2024-03-05T11:00:00.000Z" },
"analytics": { "totalRiders": 120, "activePolicies": 87, "totalPayoutInr": 136800 }
}

Proxy to the OSRM routing API. Returns route details between two coordinates.

Body: origin + destination coordinates.

Signs out the current session by clearing Supabase auth cookies. Redirects to /login.

Injects a synthetic disruption event for demo purposes (admin only). Useful for testing the full trigger → claim → payout pipeline without waiting for real API data.

Updates a rider’s profile role (admin only). Used for promoting users to admin.

Admin override for policy updates (status changes, plan modifications).

Returns AI-generated insights for the authenticated rider, including risk assessment for their zone and upcoming weather outlook.

Public endpoint returning platform operational status — database health, API connectivity, and recent adjudicator activity.

Lightweight health check returning { "status": "ok" }. Used by uptime monitors and deployment probes.

Processes Aadhaar/PAN uploads during onboarding. Validates the document format and extracts basic metadata.

Webhook endpoint for external trigger providers to push disruption events directly. Validates the payload against a signing secret.

OpenAPI documents POST /api/payments/create-checkout. These are also part of the flow:

  • POST /api/payments/verify — Called after Razorpay Standard Checkout succeeds in the browser; verifies the signature and activates the policy (primary path for demos).
  • POST /api/payments/webhook — Optional Razorpay payment.captured handler when RAZORPAY_WEBHOOK_SECRET is set.

See Demo payments for the full walkthrough.


Used when a rider taps Verify on a pending claim. If the GPS check passes, the claim can move to paid.

FieldTypeRequiredDescription
claimIdstringYesUUID of the claim to verify
latitudenumberYesRider’s current latitude
longitudenumberYesRider’s current longitude
deviceFingerprintstringNoBrowser/device fingerprint for multi-device fraud detection
gpsAccuracynumberNoGPS accuracy in meters (rejected if > 100m)

What happens next (simplified): GPS accuracy → claim age window → geofence check → fraud checks → mark paid (if all good).


Rider self-report for delivery disruptions. Now includes rate limiting and external corroboration.

Rate limit: 3 reports per rider per day (returns 429 if exceeded).

Body: multipart/form-data with fields:

  • disruption_note (string) — description of the disruption
  • latitude / longitude (number) — rider’s GPS coordinates
  • file (File, optional) — photo evidence

Response: includes whether the report was corroborated by external data.