Other Endpoints
Everything else the API exposes: admin operations, traveller accounts, reviews, wishlists, newsletter, departures, availability, featured tags, legal pages and the health check.
Admin
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| POST | /admin/login | Public | Login, sets admin_auth_token |
| POST | /admin/add | Admin | Create another admin |
| PATCH | /admin/verify-supplier | Admin | Set a supplier's isVerified |
| PATCH | /admin/validate-activity | Admin | Approve or reject with a reason |
| PATCH | /admin/approve-listing | Admin | Set any activity status |
| GET | /admin/analytics | Admin | Counts and 12-month registrations |
| GET | /admin/revenue | Admin | Platform revenue summary |
| PATCH | /admin/change-password | Admin | Change own password |
Admin tokens are signed with JWT_SECRET_ADMIN, not JWT_SECRET. Roles are SUPERADMIN, MODERATOR and SUPPORT; the API does not enforce per-role permissions, so any valid admin token can call every admin route.
validate-activity accepts { activityId, status, reason }. APPROVED sets published = true and emails the supplier; REJECTED sets published = false and includes the reason in the email. approve-listing accepts { activityId, status } or { activityId, reject } and sets published = status === "APPROVED".
analytics returns:
{
"data": {
"total_activity_count": 120,
"activities_pending_approval": 4,
"active_activities": 110,
"suppliers_pending_verification": 3,
"total_registered_suppliers": 45,
"registrations": [{ "month": "Jan", "users": 10, "suppliers": 2 }]
}
}Travellers
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| POST | /users/register | Public | Create an account, send verification email |
| POST | /users/login | Public | Login, sets user_auth_token |
| POST | /users/logout | Public | Clear auth cookies |
| GET | /users/me | User | Current profile |
| PATCH | /users/me | User | Update current profile |
| GET | /users/:username | Public | Public profile |
| GET | /users | None in code | List users — treat as internal only |
| DELETE | /users/:id | Admin | Delete a user |
Registration creates an unverified account, does not log the user in, and emails a 10-minute verification link to ${FRONTEND_BASE_URL}/verify?token=.... Passwords are bcrypt hashes (cost 10).
GET /users is unguarded
The route has no middleware in user.route.ts. It should be considered an admin/internal endpoint even though the code does not enforce it.
Reviews
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| GET | /review | Public | All reviews |
| GET | /review/:activityId | Public | Reviews for an activity |
| POST | /review | User | Create a review |
| DELETE | /review/:id | Auth | Delete a review |
Create body:
{
"activityId": "...",
"rating": 5,
"text": "At least fifty characters describing the trip...",
"photos": ["https://..."]
}rating is an integer 1–5, text is 50–1000 characters, and photos is an optional array of at most five URLs. A review stores the reviewer, activity, rating, text and photos. There is no update route; the shared UpdateReviewValidator exists but is not mounted.
Activity.averageRating is a stored column. It is not recomputed by the review controller — treat it as a denormalised value maintained by the activity/admin flow. Public supplier profiles and activity detail responses also compute a review average on read.
Wishlist
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| GET | /wishlist | User | Current user's saved activities |
| PUT | /wishlist/:id | User | Toggle an activity in the wishlist |
| GET | /wishlist/check/:id | User | Whether an activity is saved |
PUT /wishlist/:id is a toggle: if the row exists it is deleted, otherwise it is created. The response message is Item removed from wishlist or Wishlist updated. A wishlist row is unique per (userId, itemId).
Newsletter
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| POST | /newsletter/subscribe | Public | Add an email |
| GET | /newsletter/unsubscribe?token=... | Public | Opt out |
| POST | /newsletter/send-email | Admin | Send a campaign |
| GET | /newsletter/subscribers | Admin | List subscribers |
| DELETE | /newsletter/subscribers/:id | Admin | Delete a subscriber |
Subscribe returns 201, 409 if the address already exists, and 400 for an invalid email. The unsubscribe token is a JWT signed with EMAIL_UNSUB_SECRET; a valid token marks the row inactive and redirects the browser to ${FRONTEND_BASE_URL}/unsubscribed. A bad or missing token is 400; an already-unsubscribed row is 409.
Both subscribe and unsubscribe mirror the change into the Resend audience with syncContact. That call is fail-soft: the local row is the source of truth, so a Resend outage does not fail the request.
Departures
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| GET | /departures?tripId=... | Public | Departures, optionally for one activity |
| POST | /departures | Auth (owner) | Create a departure |
| PUT | /departures/:id | Auth (owner) | Update |
| PUT | /departures/:id/delay | Auth (owner) | Mark delayed |
| DELETE | /departures/:id | Auth (owner) | Delete |
Without tripId, the list returns only future departures, capped at 200 and ordered by start date. A created departure starts with availableSpots = capacity; bookings decrement it atomically. DepartureStatus is OPEN, FULL or DELAYED. Responses include a tripId alias for activityId.
Ownership is checked against the auth token: a supplier can only manage departures on their own activities.
Availability
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| GET | /availability/:id | Public | Availability for an activity |
| POST | /availability/:id | Auth (owner) | Create |
| PUT | /availability/:id | Auth (owner) | Update |
Availability is one row per activity (activityId is unique) with unavailableDates (an array of dates) and an optional JSON availableRange. POST accepts activityId or the legacy packageId; creating a second row for the same activity returns 400 with "try updating instead". Booking validates that the requested dates do not intersect unavailableDates.
Featured tags
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| GET | /featured | Public | All tags with activities |
| GET | /featured/paginated | Public | Paginated tags |
| GET | /featured/:slug | Public | One tag |
| POST | /featured | Admin | Create (name and slug required) |
| PATCH | /featured/:slug | Admin | Update |
| DELETE | /featured/:id | Admin | Delete |
Tagging an activity is done through the activity route, not here:
PATCH /api/v1/activity/:id/feature
{ "featuredTagIds": ["tag-id-1", "tag-id-2"] }The call replaces the activity's tag set and sets isFeatured = featuredTagIds.length > 0. An unknown tag id returns 400; an unknown activity returns 404.
Promotion is a separate admin call:
PATCH /api/v1/activity/:id/promotion
{ "durationDays": 30 }durationDays must be an integer 0–365. Zero clears promotedUntil.
Legal pages
| Method | Endpoint | Auth | Purpose |
|---|---|---|---|
| GET | /legal-pages | Admin | All pages |
| GET | /legal-pages/public/:slug | Public | Published page by slug |
| GET | /legal-pages/:id | Admin | Page by id |
| POST | /legal-pages | Admin | Create |
| PATCH | /legal-pages/:id | Admin | Update |
| DELETE | /legal-pages/:id | Admin | Delete |
| GET | /legal-page-categories | Public | Categories |
| POST/PATCH/DELETE | /legal-page-categories... | Admin | Manage categories |
A page requires title, slug and content. Content is sanitised before storage. published defaults to true; coverImage, metaTitle, metaDescription and categoryId are optional. A duplicate slug returns 400.
Health and tooling
| Endpoint | Purpose |
|---|---|
GET /health | { status: "OK", timestamp } |
GET /docs | Swagger UI (development server) |
GET /docs.json | OpenAPI JSON |
Disabled: search
searchRouter is commented out in v1/index.route.ts, and the Typesense sync scripts and activity collection schema are commented out too. There is no /search endpoint on the API today; the frontend searches CMS posts and activity listings separately.
Disabled: Typesense
The Typesense env vars (TYPESENSE_HOST, TYPESENSE_PORT, TYPESENSE_PROTOCOL, TYPESENSE_API_KEY) and the dependency may still be present, but the route and sync jobs are not active. Do not document or build against a Typesense-backed search until it is re-enabled.