On this page
The internal application API behind the MSO Cloud web app: tRPC v11 (superjson and Zod) at /api/trpc/[trpc], plus a few plain HTTP routes. It is not a versioned public contract; each procedure's description is the comment above it in the source.
Router groups#
| Group | Routers | Scope |
|---|---|---|
| Sign-in and workspace | health, me, orgs, users, brands, passkeys, social, orgAuthLdap, orgAuthOidc, orgLoginPage |
Session context, members, organizations and brands, passkeys and organization sign-in. |
| Dashboards and exploration | dashboards, dashboard, dashboard, dashboard, dashboard, insights, explore, brandCompare, orgDataset |
Dashboards, templates, versions and delivery, Explore, brand comparison and AI insight cards. |
| Commerce data | orders, creators, inventory, products, subscription, attribution, audiences, cases, activation, campaigns, reports, marketplace |
Orders, products, inventory, creators, reports and customer operations over the organization's own data. |
| Marketing performance | marketing, leadsDiagnostic, marketing, marketing, marketing, marketing, planBindings |
Ad spend, web analytics, owned channels, leads and plan bindings from the organization's own sources. |
| Content Intelligence | audience, audience, content, content, content, audience, audience |
A conversation corpus: taxonomy, insights and presentation decks. |
| Data sources and datasets | connectors, orgCredentials, connector, pipeline, manual, validation, categories, shopAliases, import, orgDatasets |
Connections, shared credentials, uploads, mapping templates, backfill, validation and organization datasets. |
| Market and social intelligence | market, social, social |
The third-party estimate plane, kept apart from first-party validation and from chat. |
| Signals and decisions | alerts, alertWorkflows, briefing, actions, memos, playbooks, offtake, msoPlaybooks, signals |
Signals, alerts, the morning brief, actions, playbooks, memos and the decision ledger. |
| AI and chat | aiConfigs, platform, aiPrompts, chat, chatAssistant |
The data assistant, per-organization AI configuration and the prompt registry. |
| Notifications | notifications, notification, notification |
The in-app inbox, channel configuration and per-organization notification policy. |
| Administration | apiTokens, admin, siteIdentity, appearance, platform, orgData, orgBackupConfig, orgMenu, orgBlueprints, masking |
Platform administration, organization data and backup, menus, blueprints, appearance and masking. |
| Sharing and public | shares, public |
Dashboard and report share links, and public surfaces that need no sign-in. |
REST routes#
Flows that need plain HTTP sit outside tRPC: sign-in, WebAuthn, streaming chat, webhooks, OAuth callbacks and exports. Mutating routes are rate-limited, and organization-scoped routes set the row-level security context before touching data. Only routes an integrator calls are listed; internal operating routes are not.
| Route | Methods |
|---|---|
/ |
GET |
/ |
GET, POST |
/ |
GET |
/ |
POST |
/ |
GET |
/ |
GET |
/ |
POST |
/ |
POST |
/ |
POST |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
POST |
/ |
POST |
/ |
POST |
/ |
POST |
/ |
GET, POST |
/ |
GET |
/ |
POST |
/ |
POST |
/ |
POST |
/ |
GET |
/ |
POST |
/ |
GET |
/ |
POST |
/ |
GET |
/ |
GET |
/ |
POST |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET |
/ |
GET, POST |
/ |
POST |
/ |
POST |
Tenancy bases#
Six base procedures in apps/web/src/server/trpc.ts; choosing a base chooses the data-isolation tier.
| Base | Requires | Row-level security context |
|---|---|---|
public |
nothing | none; public surfaces only (health, share links, wordmark) |
authed |
a signed-in user | none; data the user owns (passkeys, my organizations) |
superAdminProcedure |
isSuperAdmin |
cross-organization by design; every admin. procedure |
orgProcedure |
an active in the session |
the whole resolver runs in one transaction carrying app. (runWithRlsContext) |
brandProcedure |
as orgProcedure |
adds app.; null means the whole-organization rollup |
chatProcedure |
as brandProcedure |
adds the chat- plugin gate and an owner or admin role |
Access checks#
The Access column on each group page names the base plus any check the resolver runs, detected from the source:
owner or admin:requireOwnerOrOrgAdmininapps/web/src/server/access.ts, a fixed role gate. It guards every learning-loop mutation, the playbook library, mapping administration, chat configuration and market-intelligence ingest.- A capability id such as
manage_connectors:requireOrgCapability, the per-organization role policy. Ids match the Roles and capabilities matrix.
Organization-scoped mutations also pass rateLimitOrgMutation, and administrative actions write the audit log. Plugin entitlements are enforced at the page and the menu, not in tRPC; chatProcedure is the one exception.
Data conventions#
- Money is integer VND, never
numericorfloat; displayed through@yng/charts/formatVnd. - Time is Asia/Ho_Chi_Minh (ICT) on every date path: day buckets are ICT-anchored in SQL, day edges and labels come from
@yng/ui/ict-date, and charts receive the ISO string verbatim. is_sampleon every data table keeps sample data apart from real data.- Serialization is superjson (Date, Map and BigInt cross the wire intact); input is validated with Zod, and a validation error returns a flattened
zodError. - Personal data is stored verbatim and masked on display through
@yng/ui/mask; a response never carries a credential or secret.