Every route this API exposes, cross-referenced against the frontend's endpoint
constants (apps/web/src/services/ApiEndpoints.ts) and call sites
(apps/web/src/services/KarmaCircleApi.ts and per-feature code). Read this
before changing any route's path, method, or request/response shape — and before
assuming a frontend call "just works" against this backend.
Route inventory cross-checked against both apps on 1 November 2026. This is a static code audit, not an end-to-end production verification; a listed frontend caller shows code wiring, not proof that a live deployment succeeds.
Update (2026-11-29): The API now stores data in PostgreSQL.
Requests and responses are unchanged, except that every _id and organization id they return is a UUID, and GET /health reports postgres where it reported mongo.
Products, reports and payments moved too, with unchanged shapes (products and reports were removed on 2026-12-02, see products.md and reports.md).
The events routes moved the same day: event, registration and invite ids are UUIDs (:registrationId and :inviteId must be one), and on POST /events/{uid}/join emailSent now means the confirmation was queued (production only) while emailFailed is always false.
Update: GET /user, GET /organizations, GET /display/users,
GET /display/organizations, GET /events, and the since-removed GET /product/allproducts
(their unfiltered "list everything" branches only) now return
{ data, pagination } instead of a bare array — see
known-issues.md#pagination and
architecture.md#pagination. This was verified
live, via a Supertest assertion against a real (in-memory) Mongo, not just read
from source - see tests/events.test.ts's
"paginates across multiple pages with skip/limit math" case.
That was before the move to PostgreSQL; the suite now runs against PostgreSQL.
Update (2026-11-30): GET /user, GET /user?userName=, GET /organizations?userName=, GET /display/users and GET /display/organizations were removed: an account is returned only to its owner (directory.md).
GET /user and /display/* now answer 404; GET /organizations ignores a userName parameter and returns the organization directory.
Update: All four contract breaks below are resolved —
PATCH /user/update, GET /user/profile, GET /auth/login/success, and
PATCH /user/complete all now work as the frontend already calls them. See
known-issues.md#cross-repo-contract-breaks
and users.md/auth.md for the fix detail; the
breakdown below is kept for historical context on what was wrong and why.
Several routes also answer 429 from a per-route limit or a daily budget, see limits against abuse.
| Method + path | Module | Auth | Frontend constant | Frontend actually calls it? |
|---|---|---|---|---|
GET / |
app.ts | no | — | no (liveness check only) |
GET /health |
app.ts | no | — | no |
GET /docs |
app.ts (swagger) | no | - | no |
GET /health/live |
app.ts | no | none | no (answers without touching the database, for uptime checks) |
POST /auth/signup |
auth | no | authEndpoints.signup |
✅ RegisterUser() |
POST /auth/signin |
auth | no | authEndpoints.signin |
✅ LoginUser() |
GET /auth/check-email |
auth | no | authEndpoints.checkEmail |
✅ CheckEmailExists() — called from Auth.tsx's email-step Continue action |
POST /auth/update |
auth | no (email+oldPassword in body) | — | ❌ no frontend constant/call exists for this route at all |
POST /auth/forgot-password |
auth | no | authEndpoints.forgotPassword |
✅ ForgotPassword() — features/authentication/pages/ForgotPassword.tsx |
POST /auth/reset-password |
auth | no (single-use token in body) | authEndpoints.resetPassword |
✅ ResetPassword() — features/authentication/pages/ResetPassword.tsx |
GET /auth/google |
auth | no | authEndpoints.googleLogin |
✅ GoogleAuth() |
GET /auth/google/callback |
auth | Passport | — | n/a (hit by Google's redirect, not called directly by frontend code) |
GET /auth/login/failed |
auth | no | — | n/a (redirect target, not called directly) |
GET /auth/login/success |
auth | requireAuth (see auth.md) |
authEndpoints.googleLoginSuccess |
✅ successCallback() — was unreachable, fixed, see contract break #3 |
GET /auth/logout |
auth | no | authEndpoints.logout |
✅ Logout() |
GET /user/profile |
users | requireAuth |
userEndpoints.profile |
✅ restoreSession() validates persisted login at app startup, and the routed /user/setup editor loads the signed-in user's saved profile |
PATCH /user/update |
users | requireAuth |
userEndpoints.updateProfile |
✅ updateUserProfile() — was a method mismatch, fixed, see contract break #1 |
| — (no route) | — | — | userEndpoints.update (/user/update/profile) |
❌ dead constant on the frontend side, no matching backend route either — consistent dead code both sides, not a break |
PATCH /user/complete |
users | requireAuth |
userEndpoints.completeProfile |
ProfileCompletion path; no routed page currently calls it |
GET /organizations |
organizations | no | organizationEndpoints.all, organizationEndpoints.directory({...}) |
✅ Organizations.tsx's SWR key (the live directory, filtered server-side via ?search=&domain=). The unfiltered branch lists live organization records, not organization-type users - see organizations.md. userEndpoints.details() and organizationEndpoints.details() still build the removed lookup URLs; only the unrouted UserProfile.tsx uses the first and nothing uses the second. GetAllOrganizations() is called only by unrouted Donate.tsx; getOrganizations() is defined but has no callers. |
GET /organizations/taxonomy |
organizations | no | organizationEndpoints.taxonomy |
✅ Organizations.tsx (directory filter dropdown) and OrganizationSetup.tsx (tag/domain choices) |
GET /organizations/me |
organizations | requireAuth |
organizationEndpoints.mine |
✅ OrganizationSetup.tsx's SWR key |
PATCH /organizations/me |
organizations | requireAuth |
organizationEndpoints.mine |
✅ UpdateMyOrganization() |
GET /organizations/{handle} |
organizations | no | organizationEndpoints.byHandle(handle) |
✅ OrganizationProfile.tsx's SWR key. 404s for a draft organization exactly as for an unknown handle |
GET /organizations/dashboard |
organizations | organization account via requireAuth |
organizationEndpoints.dashboard |
✅ Dashboard.tsx — response fields map to the ten dashboard refinement areas; exact response contract is in organizations.md |
POST /organizations/{handle}/analytics/profile-view |
organizations | no | organizationEndpoints.profileView(handle) |
✅ public profile load records a raw view for live profiles |
GET /organizations/{handle}/follow |
organizations | requireAuth |
organizationEndpoints.follow(handle) |
✅ OrganizationProfile.tsx loads current follow state |
POST /organizations/{handle}/follow |
organizations | requireAuth |
organizationEndpoints.follow(handle) |
✅ profile Follow action persists relationship |
DELETE /organizations/{handle}/follow |
organizations | requireAuth |
organizationEndpoints.follow(handle) |
✅ profile Following action removes relationship |
| — (no route) | — | — | organizationEndpoints.createEvent (/organization/createevent) |
❌ dead constant, no backend route either — consistent dead code both sides |
GET /events |
events | no | eventEndpoints.directory({ period, search, mode, type, access, page, limit }), eventEndpoints.byUid() |
✅ live on both branches: Events.tsx's directory grid (no uid; useSWRInfinite, 12 per page, November 2026) and DetailedEvent.tsx's single-event fetch (?uid={id}, reusing this same route rather than a dedicated GET /events/:uid - see events.md). Optional query params since November 2026: search (trimmed, max 100, case-insensitive literal match on name, city, hostName), period (upcoming is endTime >= now, so a running event is included, and past is endTime < now; omitted returns all), mode (Online, Offline or Hybrid), type (one of the seven event kinds, PG-9; search also matches tags), access (open, approval or invite; matched against the stored value, which defaults to open). Sorted by startTime, then creation time, soonest first, except period=past (most recent first); a host-filtered list with no period is newest first. Response shape { data, pagination } is unchanged and pagination.total counts every match. limit default 20, maximum 100. PG-15 (November 2026): drafts are never listed or returned by uid unless the signed-in caller is the hosting organization (optionalAuth reads the cookie but never rejects; the host list ?host= then includes its own drafts), and status is draft, published or cancelled on every event. Every response: platformLink is present only for the hosting organization and people going, see Event responses. |
GET /events?host={handle} |
events | no | eventEndpoints.byHost |
✅ HostedEvents.tsx (My events, Hosting) and OrganizationProfile.tsx's "Events hosted" section - one host's own events, matched server-side against either organizerHandle or the legacy hostUsername (see events.md). The web call sends limit=100 (the maximum); with no period the API lists a host's events newest first, so a host over 100 events loses its oldest. Combines with the filters above. The host sees platformLink and its drafts, which may lack description and coverImage. |
GET /events/mine |
events | requireAuth |
eventEndpoints.mine() |
✅ AttendingEvents.tsx shows authenticated attendee registrations, paginated by upcoming/past period. Each row has registrationStatus. period=upcoming (default) is every event not yet ended, soonest start first; past is every ended one, latest start first. platformLink only on rows where the person is going or hosts. |
POST /uploads/event-covers |
uploads | requireAuth (organization account) |
eventEndpoints.coverUpload |
✅ November 2026 (DB-1). uploadCoverImage() in CreateEvents.tsx's cover picker (RequestCoverUpload). Body { contentType: image/png | image/jpeg | image/webp | image/gif, size: 1 to 5242880 } (strict). 201 with { strategy: "vercel-blob", clientToken, pathname } (send the bytes to Vercel Blob with @vercel/blob/client's put) or, in development and test, { strategy: "direct", uploadUrl, method: "PUT", publicUrl }. 403 for a personal account, 429 past 20 tickets a day, 503 when production has no Blob token. The event then keeps only the https link as coverImage |
PUT /uploads/local/{token} |
uploads | signed token in the path | none (called with the uploadUrl above) |
✅ November 2026 (DB-1). Development and test only (404 when a Blob token is set, never offered in production). Raw image bytes; the token fixes the file name and type and the bytes must be that type. 400 wrong type or not a real image, 403 bad or expired token, 409 token already used, 413 over 5 MB |
POST /events/create |
events | requireAuth |
eventEndpoints.create |
✅ Full-page CreateEvents.tsx route at /organization/events/new; API verifies the authenticated account is an organization (403 otherwise). Validation (November 2026): name 10 to 80 and description at most 200 characters (at least 20 to publish); endTime strictly after startTime; startTime not in the past; uid URL-safe and not one of mine, new, create, edit, admin, api; coverImage an https URL (max 2048; data URLs are refused); city/state/country max 100, address max 200, platform max 60, platformLink max 2048; online events need HTTP(S) meeting URLs. A rule failure is 400 { message: "Validation failed", errors: [{ path, message }] }. A taken uid is 409, including the race where two requests pass the existence check together (the unique constraint violation maps to the same 409). See events.md and the frontend's event lifecycle reference PG-9, PG-10, PG-15 (November 2026): mode may be Hybrid (needs both the in-person and the online fields), eventType (one of volunteering, fundraiser, workshop, awareness, meetup, cultural, other; optional in the API, required by the web form) and tags (up to 8) are accepted, and status may be draft or published (default published). A draft needs only uid, name, mode and the four date and time fields; publishing also needs description, coverImage and the mode's fields, see Event validation. Response 201 { message: "Event Created", savedEvent }. 400 for an organization account with no name; 429 past 20 creates a day. PG-11, PG-12 (November 2026): timezone (an IANA name such as Asia/Kolkata, optional) says which clock the start and end were read in, and an about paragraph may be up to 4000 characters. |
PATCH /events/{uid} |
events | requireAuth |
eventEndpoints.update(uid) |
✅ November 2026 (PG-1). Edit form at /organization/events/:eventId/edit (EditEvent.tsx via EventForm in CreateEvents.tsx; call UpdateEvent in KarmaCircleApi.ts). Body is any non-empty subset of the create fields except uid and status; uid, status, isGovernmentSponsored and any other unknown key are a 400. Only the hosting organization can call it (403 for a personal account or another organization, 404 unknown event). 409 for a cancelled event or one that has ended. The stored event merged with the body must pass the rules for its status (see Event validation), and a start time left alone may be in the past; switching mode drops the other mode's fields. timezone (an IANA name; never removable; does not move startTime/endTime), mode (Online, Offline or Hybrid; Hybrid needs both field sets and switching drops only the side that no longer applies), eventType (one of seven slugs) and tags (up to 8, [] clears), capacity (integer 1 to 100000; null removes it; never below the people already registered, else 409) and the optional detail fields (about, contactEmail, cost, bringAlong, languages, minimumAge, agenda, gettingThere, linkDelivery, joinRequirements; null removes a scalar or cost, [] clears a list). Response 200 { message: "Event Updated", event }. See events.md. When a published event's time, mode, venue or meeting link changes, the people going are emailed. |
POST /events/{uid}/publish |
events | requireAuth |
eventEndpoints.publish(uid) |
✅ November 2026 (PG-15). "Publish" on a draft row of HostedEvents.tsx, and "Publish event" on the draft edit form (PublishEvent in KarmaCircleApi.ts). Host only. The draft must pass the publishing rules (400 with one entry per missing or invalid field, including description and coverImage, and on a stale start); 409 if already published or cancelled. Response 200 { message: "Event Published", event } |
POST /events/{uid}/unpublish |
events | requireAuth |
eventEndpoints.unpublish(uid) |
✅ November 2026 (PG-15). "Unpublish" on a published row (UnpublishEvent). Host only. 409 once anyone has registered (the message says to cancel instead), and for a draft, cancelled or ended event. Response 200 { message: "Event Unpublished", event } |
DELETE /events/{uid} |
events | requireAuth |
eventEndpoints.update(uid) (same URL as the edit PATCH) |
✅ November 2026 (PG-15). "Delete draft" (DeleteDraft). Host only. Deletes a draft only; a published or cancelled event is 409. Response 200 { message: "Draft Deleted" } |
POST /events/{uid}/cancel |
events | requireAuth |
eventEndpoints.cancel(uid) |
✅ November 2026 (PG-2). HostedEvents.tsx Cancel button behind CancelEventDialog (CancelEvent in KarmaCircleApi.ts). Same ownership checks as edit. Sets status: "cancelled"; the event stays public with a badge, new joins get 409, registrations are kept, and everyone going, pending or waitlisted is emailed. 409 for a draft, or if already cancelled or ended. Response 200 { message: "Event Cancelled", event } |
DELETE /events/{uid}/registration |
events | requireAuth |
eventEndpoints.leave(uid) |
✅ November 2026 (PG-3). "Leave event" link and confirmation on DetailedEvent.tsx (LeaveEvent in KarmaCircleApi.ts). Removes the caller's own registration and gives the spot back. 404 unknown event or not registered, 409 once the event has started; allowed on a cancelled event. Response 200 { message, joined: false } |
GET /events/{uid}/attendees |
events | requireAuth |
eventEndpoints.attendees(uid, { page, limit, search, status }) |
✅ November 2026 (PG-6). EventAttendees.tsx at /organization/events/:eventId/attendees. Host only (403 for a personal account or another organization). ?page=&limit= (max 100) and search (name or email). Response { event, data: [{ id, name, email, joinedAt, status, note, decidedAt, checkedIn, checkedInAt }], pagination, summary: { registered, checkedIn, pending, waitlisted, declined } } (November 2026, PG-4 and PG-14: ?status= is going (default), pending, waitlisted, declined or all, and event is { uid, name, status, capacity, access, waitlistEnabled }; see events.md). Attendee identities are never on a public route |
PATCH /events/{uid}/attendees/{registrationId} |
events | requireAuth |
eventEndpoints.attendee(uid, id) |
✅ November 2026 (PG-6). Check-in toggle, SetAttendeeCheckIn in KarmaCircleApi.ts. Host only. Body { checkedIn: boolean } (strict), id must be a UUID and belong to this event. 409 for a cancelled event or a person who is not going. Response { attendee } |
GET /events/{uid}/attendees/export |
events | requireAuth |
eventEndpoints.attendeesExport(uid) |
✅ November 2026 (PG-6). "Download CSV" on the attendee page (FetchAttendeesCsv). Host only. text/csv, formula-neutralized cells |
POST /events/{uid}/attendees/{registrationId}/approve |
events | requireAuth |
eventEndpoints.approveAttendee(uid, id) |
✅ November 2026 (PG-4, PG-14). "Approve" and "Move up" on the attendee page (ApproveAttendee). Host only. Moves a pending, waitlisted or declined person to going (past the capacity if full) and emails them the join confirmation in production. 409 cancelled or ended event, 404 unknown registration. Response { attendee } |
POST /events/{uid}/attendees/{registrationId}/decline |
events | requireAuth |
eventEndpoints.declineAttendee(uid, id) |
✅ November 2026 (PG-4, PG-14). "Decline" on the attendee page (DeclineAttendee). Host only. Sets the registration to declined (the person cannot ask again), releases the spot if they were going. 409 cancelled or ended event, 404 unknown registration. Response { attendee }. The person is emailed unless they were already declined. |
GET /events/{uid}/invites |
events | requireAuth |
eventEndpoints.invites(uid) |
✅ November 2026 (PG-4). The invitation list in EventInvitePanel. Host only. Response { data: [{ id, email, invitedAt, joined }], total } |
POST /events/{uid}/invites |
events | requireAuth |
eventEndpoints.invites(uid) |
✅ November 2026 (PG-4). InviteToEvent. Host only. Body { emails: string[] } (1 to 50, strict). Response 201 { invited, skipped: [{ email, reason }] }; each new email is mailed an invitation in production. 409 draft, cancelled, started or ended event ("This event has already started, so you can no longer invite people."), or over 200 invitations; 429 past the daily invitation limit |
DELETE /events/{uid}/invites/{inviteId} |
events | requireAuth |
eventEndpoints.invite(uid, id) |
✅ November 2026 (PG-4). RevokeInvite. Host only. 404 unknown invitation, 409 once the person joined through it |
GET /events/invitations |
events | requireAuth |
eventEndpoints.invitations() |
November 2026 (PG-4). Published events that have not started that the caller is invited to and holds no registration for, soonest first. ?page=&limit= (default 20, maximum 100). Response { data, pagination }; rows carry no platformLink (unless the caller hosts the event). The "Invited" tab of My Events reads it (apps/web/src/features/events/utils/myEvents.ts) |
POST /events/{uid}/join |
events | requireAuth |
eventEndpoints.join(uid) |
✅ DetailedEvent.tsx registers the authenticated attendee, then shows confirmation feedback; API queues the account-address email, which the worker sends in production only; emailSent says it was queued for sending and emailFailed is always false; 409 for a cancelled event or a full one with the waitlist off (November 2026), and for the organization that hosts it; a new registration of a person who is going also emails the organization owner (production only). November 2026 (PG-4, PG-14): the response is { message, joined, status, alreadyJoined, emailSent, emailFailed } where status is going, pending or waitlisted; an optional body { note } (up to 300 characters) is kept on a request; 404 for an unknown event or a draft, 409 once it has started; 403 for an invite-only event without an invitation and for a person the organizer declined. The note is trimmed, stored only when a new request or waitlist spot is created, and ignored when blank; a longer note or any other body key is 400. A new pending or waitlisted registration emails the organizer. |
GET /events/{uid}/registration |
events | requireAuth |
eventEndpoints.registration(uid) |
✅ DetailedEvent.tsx checks current attendee's saved status on load, preventing an active Join control. November 2026 (PG-14): the response is { joined, status, invited } (status is going, pending, waitlisted, declined or none; joined is true only for going) after returning from email |
POST /payment/razorpay |
payments | no | paymentEndpoints.razorpay (defined, unused) |
PaymentGateway.ts, which constructs the URL directly; it is not imported by a live page and also reads the Axios response at the wrong level. See the frontend's donate-shop-trending.md/SPEC.md |
POST /payment/organizations/{handle}/order |
payments | no | paymentEndpoints.sponsorshipOrder(handle) |
✅ CreateSponsorshipOrder(), called from SponsorOrganizationModal.tsx - see payments.md |
POST /payment/organizations/{handle}/verify |
payments | no | paymentEndpoints.sponsorshipVerify(handle) |
✅ VerifySponsorshipPayment(), called from the same modal's Razorpay Checkout handler |
platformLink is returned only when the caller is the organization that hosts the event, or has a registration for it with status going.
For everyone else the field is absent, not null or empty.
This holds for every response that carries an event; platform, linkDelivery and joinRequirements are public.
GET /events stays public and reads the Token cookie when present, so a client must send credentials for the host or a person going to receive the link.
A draft may lack description, coverImage, the venue fields, platform and platformLink.
A draft needs uid, name, mode, startTime, endTime, startDate and endDate.
Publishing (create without status: "draft", and POST /events/{uid}/publish) also needs a description of at least 20 characters, a coverImage, and city, state, country, address (Offline and Hybrid) and platform, platformLink (Online and Hybrid).
For description, coverImage, city, state, country, address, platform and platformLink, a blank string or null means "not provided" and clears the field on PATCH.
PATCH of a published event cannot leave a mode field missing or blank a description or coverImage it sends.
A failure is:
{
"message": "Validation failed",
"errors": [
{ "path": "description", "message": "Add a description before publishing" }
]
}errors is ordered, and each path is a body field name.
Missing fields read "Add a ... before publishing" on create and publish, and "A published event needs a ..." on edit.
The full list of messages is in events.md.
PATCH /events/{uid}, publish, unpublish, cancel and DELETE /events/{uid} answer 409 { "message": "This event just changed. Reload and try again." } when the event was changed or removed while the request ran.
Nothing was saved and no email was sent, so the client should reload the event and let the person decide again.
The frontend's updateUserProfile()
(KarmaCircleApi.ts)
issues
Axios.patch(userEndpoints.updateProfile, credentials, { withCredentials: true }).
This backend used to register the handler as router.post("/update", ...)
(user.routes.ts) — Express only
matches the declared method, so a PATCH to /user/update fell through to
notFoundHandler (404) instead of the intended controller. At the time, the
old ProfileCompletion.tsx and ProfileUpdate.tsx components called this
endpoint, but those paths are no longer the live organization editor. Fixed
by changing the route to router.patch("/update", ...) — matches what the
frontend sends, no frontend change needed. The old POST registration was
removed rather than kept alongside it (nothing else called it).
updateProfileSchema used to validate
{ tagLine?, description?, city?, state?, address?, country?, pincode? } as
flat top-level strings — none of which lined up with IUser.address's nested
object, and tagLine didn't exist on the schema at all. Fixed in the same
change as #1: updateProfileSchema now validates
{ name?, description?, coverImage?, address?: { line1?, line2?, city?, state?, country?, pincode? } },
matching exactly what ProfileUpdate.tsx sends. coverImage (the frontend's
name for the field) is translated onto IUser.bannerPicture in
user.service.ts's toUserUpdate rather than the schema growing a field named
after the frontend's UI copy. See
users.md.
Historical note: the dashboard previously called GET /user/profile, which had
no route and returned 404. The route was added to support that earlier dashboard
implementation, but the organization dashboard now calls
GET /organizations/dashboard for its owner-scoped profile and metrics.
On 31 October 2026, the organization dashboard was wired to
GET /organizations/dashboard; it now returns owner-only aggregates rather than
its former bare user object.
See auth.md for the full trace. The route's
controller used to require req.user, populated by Passport during the
earlier /auth/google/callback request — but session: false means nothing
carries that forward to this later, separate request, so it 401d every time in
real traffic. Fixed by moving session issuance (signing the JWT, setting
Token/userName/isLoggedIn/userType) into googleCallback itself — the
one request that legitimately has req.user — and making loginSuccess a
normal requireAuth-gated route that reads the Token cookie googleCallback
already set on its redirect response. Verified live via Supertest
(tests/auth.test.ts), confirming the route is reachable given a valid session
cookie and still 401s without one.
The frontend's completeProfileApiCall()
(KarmaCircleApi.ts) calls
Axios.patch(userEndpoints.completeProfile, credentials, { withCredentials: true }),
i.e. PATCH /user/complete — no route existed for this at all, and
config.hasCompletedProfile (see
users.md) could never
become true through any code path in this API. Fixed by adding
PATCH /user/complete (requireAuth-gated, same body shape as
PATCH /user/update), whose service layer accepts the profile fields and always
sets config.hasCompletedProfile: true server-side on success — independent of
whatever the client's body claims about that field.
Superseded 2026-12-02: this section listed the products module (/product/*), which no page called.
That module was removed, see products.md.
If you fix one of the contract breaks above (on either side of the repo
boundary), update both repos' specs in the same change: this file plus the
relevant module file here, and the frontend's own
docs/specs/api-integration.md plus its known-issues.md entry if one exists
for the same issue. A contract break fixed on only one side, with the other
side's spec still describing the old broken behavior, is worse than not
documenting it at all — the next agent will trust the stale doc.