Enquiries
Public website enquiries, signed-in applicant threads, staff updates, and the WhatsApp enquiry link.
Use this page to call the enquiry routes or to see which caller each one accepts. Admission applications are a different resource. See Admissions.
All paths are under /api/v1; errors use the shared error shape. EnquiryController carries @RequireFeature(Feature.ADMISSIONS). The website submit is @Public(), so the decorator skips it, but EnquiryService.create checks the flag itself and throws Feature not enabled: admissions (FEATURE_DISABLED).
Submit from a website
POST /api/v1/enquiry
operationId | submitEnquiry |
| Auth | x-api-key. ApiKeyAuth('secret', 'publishable'). A publishable key must send an allowed Origin. |
| Feature flag | Not applied. The method is public. |
| Success | 201, EnquiryDto |
| Limits | ApiKeyRateLimitGuard: 60 a minute per key, plus 10 a minute per IP for publishable keys, counted in Redis so every API copy shares them |
Body (CreateEnquiryDto):
| Field | Required | What the API does with it |
|---|---|---|
name | yes | Stored as the enquirer's name. Any string. |
phone | yes | Stored as sent. The WhatsApp follow link goes to this number, which is normalised to E.164 when the link is sent. |
subject | yes | Stored as the enquiry's subject. Any string. |
message | yes | Stored as the first message. Any string. |
email | no | Must be an email address. Stored, but never used to match an existing account, because the form does not prove it. |
class | no | Stored as free text. It is not checked against the school's classes. |
type | no | enquiry, contact, or admission. Omitted means the column default, admission. |
referralCode | no | Stored as sent. Spaces are removed and letters are upper-cased for the lookup. A match links the enquiry to that referrer. An unknown code is kept and links nothing. |
The four required strings are @IsString() only, so an empty string passes and there is no length limit. The school comes from the API key, not the body.
Documented errors: 400 validation, 401 missing or unknown key, 403 wrong key kind or origin, 429 rate limit.
Unexecuted example. YOUR_API_KEY is a placeholder.
curl --silent --show-error \
--request POST 'https://api.example.com/api/v1/enquiry' \
--header 'content-type: application/json' \
--header 'x-api-key: YOUR_API_KEY' \
--data '{"name":"Amal O.","phone":"+256700000000","subject":"S1 admission","message":"We would like a prospectus.","type":"admission"}'Signed-in applicant
These three require a bearer token and userType guest or guardian. They are not @Public(), so the admissions feature flag runs.
| Method and path | operationId | Body | Success |
|---|---|---|---|
POST /api/v1/enquiry/mine | submitMyEnquiry | subject (string, max 160), message (string, max 4000), optional type (same enum; the DTO says it defaults to enquiry) | 201 EnquiryDto |
GET /api/v1/enquiry/mine | listMyEnquiries | none | 200, array of MyEnquiryDto |
POST /api/v1/enquiry/mine/:id/replies | replyToMyEnquiry | body, string, required, max 4000. Blank after trim is Reply cannot be empty. | 201 EnquiryThreadEntryDto |
POST /api/v1/enquiry/mine/:id/typing | signalMyEnquiryTyping | none | 204 |
submitMyEnquiry takes the name, phone, and email from the account. Do not send them in the body.
Staff
Bearer token. Permissions are on enquiry.
| Method and path | operationId | Who | Success |
|---|---|---|---|
GET /api/v1/enquiry | listEnquiries | list | 200 EnquiryListResponseDto |
GET /api/v1/enquiry/:id | getEnquiry | read | 200 EnquiryDto. 404 Enquiry not found. |
POST /api/v1/enquiry/:id/replies | replyToEnquiry | staff, and update | 201 thread entry |
POST /api/v1/enquiry/:id/typing | signalEnquiryTyping | staff, and read | 204 |
PATCH /api/v1/enquiry/:id/assign | assignEnquiry | update | 200. Body field assignedToId. |
PATCH /api/v1/enquiry/:id/status | updateEnquiryStatus | update | 200. Body field status. |
GET /api/v1/enquiry/:id/status-history | getEnquiryStatusHistory | read | The handler returns the service value. No response DTO is declared on the method. |
PATCH /api/v1/enquiry/:id/priority | updateEnquiryPriority | update | 200. Body field priority. |
PATCH /api/v1/enquiry/:id/notes | addEnquiryNotes | update | 200. Body field notes. |
DELETE /api/v1/enquiry/:id | deleteEnquiry | delete | 200 { "message": "Enquiry deleted successfully" }. The operation says this soft-deletes the enquiry and its conversation. |
| Status | Effect |
|---|---|
new | Default. A staff reply moves it to contacted |
contacted | Set by a staff reply to a new enquiry, or by a status change. Replies are still accepted |
completed | Stamps resolvedAt; replies refused with This enquiry is completed |
closed | Stamps closedAt; replies refused with This enquiry is closed |
Any status can be set from any other. A change adds a status-history row and an empty staff entry in the thread; setting the current status does nothing. Priority is low, medium or high.
Replies are trimmed; a blank one is Reply cannot be empty. Applicant replies don't change status. Another user's enquiry looks like Enquiry not found. The owner is notified of staff replies, without WhatsApp if they're watching the thread.
Assign writes assignedToId, assignedById (the caller) and assignedAt, without checking the target staff exists. Delete soft-deletes only the enquiry row; the thread rows stay, although the operation text says the conversation is deleted too.
List query (ListEnquiriesFilterDto extends the cursor query):
| Query | Constraint |
|---|---|
status | optional enum above |
assignedTo | optional UUID |
userId | optional UUID. The DTO describes this as the enquirer’s account. |
priority | optional enum above |
sort | optional newest, oldest, priority, or status. Omitted means newest. |
The shared cursor filters JSON also works, limited to ENQUIRY_FILTER_FIELDS (status, priority, type, assignedToId, whatsappConfirmed, eq only). EnquiryService.list applies both, together with the cursor search.
Counts
Three analytics routes, each needing read on analytics. All count non-deleted enquiries created in the date window (default the last 30 days, end date inclusive). The operation text mentions a campus filter, but applyStatsFilters ignores it.
| Route | Service | Returns |
|---|---|---|
GET /analytics/enquiries | getStats | total, unassignedCount, averageResolutionTimeSeconds (resolved minus created, or 0), byStatus, byPriority, dailyTimeline; plus newThisMonth and recent (five newest), which ignore the window |
GET /analytics/enquiries/by-period | getStatsByPeriod | { period, data: [{ date, count }] }, period default daily |
GET /analytics/enquiries/by-staff | getStatsByStaff | Per assigned staff member: assignedCount, resolvedCount, resolutionRate; unassigned rows skipped |
WhatsApp enquiry link
EnquiryLinkController is @Controller('enquiry/link'). Both methods are @Public(), use ClientIpThrottlerGuard, and take { "token": "..." } (EnquiryLinkTokenDto, non-empty string). The operation text says the token is hashed before lookup and that the route is POST only.
| Method and path | operationId | Throttle on the method | Success |
|---|---|---|---|
POST /api/v1/enquiry/link/verify | verifyEnquiryLink | 10 per 60 seconds | 200 VerifyEnquiryLinkResponseDto |
POST /api/v1/enquiry/link/resend | resendEnquiryLink | 5 per 60 seconds | 200 RequestMagicLinkResponseDto |
verify response:
| Field | When |
|---|---|
status | signed_in, used, or expired |
enquiryId | always, on this DTO |
accessToken, refreshToken | the DTO says only when status is signed_in |
maskedPhone | the DTO says only when the link is used or expired. It is the last three digits, not the full number. |
channel | optional 'email', when the link was sent by email |
| Link state | verify answers |
|---|---|
| Unused, under 30 days old | 200, signed_in, with session tokens. The link is used up |
| Already used, or lost a race to claim it | 200, used, with maskedPhone (last three digits) or channel: email; no tokens |
Over 30 days old (ENQUIRY_LINK_TTL_DAYS) | 200, expired |
| Unknown token, or the account is inactive, in another school, or not a guest or guardian | 401 This link is not valid |
Tokens are looked up by SHA-256 hash. resend sends a fresh magic link for any known token, used or not, except email-channel links (Sign in with your email address to see your enquiry.). See Authentication.
Related pages
HTTP surface
Prefix, errors, and cursor fields.
Authentication
API keys, bearer tokens, and the magic-link cooldown this resend uses.
Website forms
How the public site posts an enquiry.