Skip to content

API Design

Base URL

https://api.rgls.uk/api/v1

Local development: http://localhost:3000/api/v1

The GET /health liveness probe is outside the /api/v1 prefix: GET /health{"status":"ok"}.

Authentication

All endpoints require Authorization: Bearer <jwt> unless marked @Public().

http
GET /api/v1/me
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...

Request / Response Format

  • Content-Type: application/json
  • Validation: Zod schemas in packages/domain/src/schemas/, applied via ZodValidationPipe
  • Error format:
    json
    {
      "statusCode": 422,
      "error": "Unprocessable Entity",
      "message": ["body must not be empty"]
    }

Pagination

List endpoints use cursor-based pagination:

GET /api/v1/posts?limit=20&cursor=<post_id>

Response:

json
{
  "items": [...],
  "nextCursor": "uuid-of-last-item",
  "hasMore": true
}

Rate Limiting

Global: 60 req/min per IP (ThrottlerGuard).

Per-route overrides:

EndpointLimit
POST /auth/login5/min
POST /auth/register3/min
POST /auth/reserve-invite10/min
POST /ai/reflect20/min
POST /ai/enhance-post10/min

Key Endpoint Groups

Auth

MethodPathDescription
POST/auth/reserve-inviteReserve invite code (TTL 30 min)
POST/auth/registerRegister with reserved code
POST/auth/loginGet JWT
POST/auth/logoutInvalidate session
POST/auth/forgot-passwordSend reset email
POST/auth/reset-passwordApply new password

Users & Identity

MethodPathDescription
GET/meCurrent user profile
PATCH/meUpdate profile
DELETE/meGDPR self-deletion
GET/users/:usernameOrIdPublic profile
GET/me/personasList personas
POST/me/personasCreate persona
PATCH/me/personas/:idUpdate persona
DELETE/me/personas/:idDelete persona

Interests

MethodPathDescription
GET/interests/catalogFull tree (L1→L2→L3)
GET/me/interestsMy selections
POST/me/interestsAdd / update interest
DELETE/me/interests/:idRemove interest

Posts

MethodPathDescription
GET/feedHome feed (For You / Following / Trending / Circles)
GET/feed?journalism=trueJournalism-tagged feed
POST/postsCreate post
GET/posts/:idPost detail
PATCH/posts/:idEdit post
DELETE/posts/:idSoft delete
POST/posts/:id/repliesAdd reply
POST/posts/:id/reactReact (heart/spark)
POST/posts/:id/bookmarkBookmark
POST/posts/:id/repostRepost
POST/posts/:id/co-authorsInvite co-author
POST/posts/:id/boostBoost post (mana cost)

Reputation

MethodPathDescription
GET/reputation/:userIdPer-interest reputation
POST/reputation/voteCast peer vote
GET/reputation/appealsMy appeals
POST/reputation/appealsCreate appeal

Economy

MethodPathDescription
GET/economy/walletMy wallet
POST/economy/paySend EmojiPay
GET/economy/paymentsPayment history

Discovery

MethodPathDescription
GET/discovery/candidatesDiscovery by intent
GET/discovery/mentorsMentor matching
PUT/discovery/intentSet/update connection intent

Social

MethodPathDescription
GET/circlesMy circles
POST/circlesCreate circle
POST/circles/:id/inviteInvite user
POST/circles/invitations/:id/respondAccept/decline
POST/users/:id/followFollow user
DELETE/users/:id/followUnfollow

AI

MethodPathDescription
POST/ai/reflect/startStart reflection session
POST/ai/reflect/:sessionId/answerAnswer question N
POST/ai/map-interestsMap free-text to catalog
POST/ai/apply-suggestionsAccept AI interest suggestions
POST/ai/enhance-postEnhance post content in composer

Access

MethodPathDescription
GET/access/meCurrent capabilities

Wiki

MethodPathDescription
GET/wiki/:interestSlugCurrent wiki entry
POST/wiki/:interestSlug/proposalsCreate proposal
POST/wiki/proposals/:id/voteVote on proposal

Notifications

MethodPathDescription
GET/notificationsInbox
POST/notifications/readMark as read
GET/notifications/preferencesPreferences
PATCH/notifications/preferencesUpdate preferences

Admin (role = admin or moderator)

All admin endpoints are under /admin/ and require AdminGuard or ModeratorGuard.

Regulus — invite-only social-knowledge platform