API Reference
REST API for the Royal Glow platform — envelope, auth, and endpoint groups.
API Reference
The Royal Glow API is a set of Next.js route handlers under /api. All
endpoints share one JSON envelope, human-readable RESTful paths, and stable
error codes — so both browsers and AI agents can call them predictably.
Base URLs: customer endpoints are on https://theroyalglow.in
(local: http://localhost:3000); admin endpoint groups (Admin — Bookings,
Customers & CRM, the admin halves of Leads / Memberships / Loyalty & Offers,
and Background Jobs) are a separate app on https://admin.theroyalglow.in
(local: http://localhost:3001) and carry no /api/admin/ segment — the
subdomain is the namespace. Most endpoints require a Better Auth session
cookie and note their minimum role. This reference is hand-authored from
the actual route handlers and the shared Zod schemas in packages/types; when
a route's schema changes, update the corresponding page.
Base & envelope
{ "success": true, "data": {}, "meta": {} }meta is optional and carries pagination (page, totalPages, totalCount).
{
"success": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid request data",
"statusCode": 400,
"requestId": "req_xxx",
"retryable": false,
"details": {}
}
}See Conventions for the full envelope, money/date rules, and the error-code table, and Authentication for the session/role model.
Authentication
Endpoint groups
Services & Availability
Catalogue, service detail, slot availability
Bookings (customer)
Create, view, cancel a booking
Admin — Bookings
Approve, assign, complete, no-show
Customers & CRM
Directory, profiles, notes, tags
Leads
Lead capture + admin pipeline
Memberships
Customer view + admin management
Loyalty & Offers
Gems and promotional offers
Notifications & Realtime
In-app, push, Ably token
Background Jobs
QStash-triggered job routes
Health
Liveness + dependency checks
Was this page helpful?