Skip to content

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 ​

MethodEndpointAuthPurpose
POST/admin/loginPublicLogin, sets admin_auth_token
POST/admin/addAdminCreate another admin
PATCH/admin/verify-supplierAdminSet a supplier's isVerified
PATCH/admin/validate-activityAdminApprove or reject with a reason
PATCH/admin/approve-listingAdminSet any activity status
GET/admin/analyticsAdminCounts and 12-month registrations
GET/admin/revenueAdminPlatform revenue summary
PATCH/admin/change-passwordAdminChange 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:

json
{
  "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 ​

MethodEndpointAuthPurpose
POST/users/registerPublicCreate an account, send verification email
POST/users/loginPublicLogin, sets user_auth_token
POST/users/logoutPublicClear auth cookies
GET/users/meUserCurrent profile
PATCH/users/meUserUpdate current profile
GET/users/:usernamePublicPublic profile
GET/usersNone in codeList users — treat as internal only
DELETE/users/:idAdminDelete 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 ​

MethodEndpointAuthPurpose
GET/reviewPublicAll reviews
GET/review/:activityIdPublicReviews for an activity
POST/reviewUserCreate a review
DELETE/review/:idAuthDelete a review

Create body:

json
{
  "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 ​

MethodEndpointAuthPurpose
GET/wishlistUserCurrent user's saved activities
PUT/wishlist/:idUserToggle an activity in the wishlist
GET/wishlist/check/:idUserWhether 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 ​

MethodEndpointAuthPurpose
POST/newsletter/subscribePublicAdd an email
GET/newsletter/unsubscribe?token=...PublicOpt out
POST/newsletter/send-emailAdminSend a campaign
GET/newsletter/subscribersAdminList subscribers
DELETE/newsletter/subscribers/:idAdminDelete 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 ​

MethodEndpointAuthPurpose
GET/departures?tripId=...PublicDepartures, optionally for one activity
POST/departuresAuth (owner)Create a departure
PUT/departures/:idAuth (owner)Update
PUT/departures/:id/delayAuth (owner)Mark delayed
DELETE/departures/:idAuth (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 ​

MethodEndpointAuthPurpose
GET/availability/:idPublicAvailability for an activity
POST/availability/:idAuth (owner)Create
PUT/availability/:idAuth (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.

MethodEndpointAuthPurpose
GET/featuredPublicAll tags with activities
GET/featured/paginatedPublicPaginated tags
GET/featured/:slugPublicOne tag
POST/featuredAdminCreate (name and slug required)
PATCH/featured/:slugAdminUpdate
DELETE/featured/:idAdminDelete

Tagging an activity is done through the activity route, not here:

http
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:

http
PATCH /api/v1/activity/:id/promotion
{ "durationDays": 30 }

durationDays must be an integer 0–365. Zero clears promotedUntil.

MethodEndpointAuthPurpose
GET/legal-pagesAdminAll pages
GET/legal-pages/public/:slugPublicPublished page by slug
GET/legal-pages/:idAdminPage by id
POST/legal-pagesAdminCreate
PATCH/legal-pages/:idAdminUpdate
DELETE/legal-pages/:idAdminDelete
GET/legal-page-categoriesPublicCategories
POST/PATCH/DELETE/legal-page-categories...AdminManage 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 ​

EndpointPurpose
GET /health{ status: "OK", timestamp }
GET /docsSwagger UI (development server)
GET /docs.jsonOpenAPI JSON

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.

Built with VitePress