API Spec (Node/Express)

Base: https://api.gharsaathi.itsmehere.com · /api/* needs Authorization: Bearer <jwt>. Errors { error } + HTTP code. Times in user tz (IST default).

Auth

  • POST /auth/send-otp { phone } → { ok } (wa-hub OTP, rate-limited)
  • POST /auth/verify-otp { phone, code } → { token, user } (creates user + free subscription + 7-day trial on first verify)

Me / entitlement

  • GET /api/me → { id, name, phone, tz, plan, status, trial_end, limits }
  • PATCH /api/me { name?, tz? }

Reminders

  • GET /api/reminders → all active reminders (+ today's log status)
  • POST /api/reminders { type, title, icon?, times?, days?, expiry_date?, notify_days_before?, whatsapp?, family_alert? } → 201 reminder. (Server enforces free limit of 5 active; whatsapp/family_alert require Pro.)
  • PATCH /api/reminders/:id · DELETE /api/reminders/:id (soft)
  • POST /api/reminders/:id/log { due_at, status } → mark done/missed/skipped (idempotent per due_at); updates streak

Grocery

  • GET /api/lists → lists (+ item counts) · POST /api/lists { name } (Pro for >1)
  • GET /api/lists/:id/items · POST /api/lists/:id/items { text, qty? }
  • PATCH /api/items/:id { text?, qty?, checked? } · DELETE /api/items/:id
  • POST /api/lists/:id/share → returns a WhatsApp-ready text of the list (app opens wa.me) or sends via wa-hub

Family (Pro)

  • GET /api/family · POST /api/family { name, phone } · DELETE /api/family/:id

Billing

  • GET /api/billing/plans → [{ id, name, price, interval }]
  • POST /api/billing/subscribe { plan } → Razorpay subscription/order payload for the app checkout
  • POST /webhooks/razorpay → (no auth; signature-verified) updates subscription status

Sync (offline outbox)

  • POST /api/sync { ops: [...] } — idempotent by op_id (same pattern as Udhaar): reminder/list/item create/update/delete.

Admin API (separate ADMIN auth, not user JWT)

  • POST /admin/login { email, password } → admin token
  • GET /admin/metrics → { users, pro, trialing, mrr_paise, reminders_sent, wa_sent, churn }
  • GET /admin/users?q= → paged users (+ plan/status)
  • POST /admin/users/:id/plan { plan } → manually grant/revoke Pro (testing/support)
  • GET /admin/templates · PATCH /admin/templates/:key → manage WhatsApp templates

Validation

phone E.164; title ≤120; times HH:MM; qty small int; all scoped to user_id from JWT; Pro gates enforced server-side (never trust the client).