Documentation Index
Fetch the complete documentation index at: https://grantmaster.dev/llms.txt
Use this file to discover all available pages before exploring further.
tRPC Procedures Reference
Complete catalog of all tRPC procedures exposed by the GrantMaster API gateway.
Each procedure is accessed via trpc.<router>.<procedure> from the frontend.
Overview
| Metric | Value |
|---|
| Total procedures | 164 |
| Routers | 22 (+ 1 root-level procedure) |
| Queries | 107 |
| Mutations | 57 |
How to call from React
All tRPC procedures are consumed via @tanstack/react-query hooks auto-generated by the tRPC client:
// Query
const { data } = trpc.projects.list.useQuery({ page: 1, pageSize: 20 });
// Mutation
const mutation = trpc.expenses.create.useMutation();
mutation.mutate({ employeeId: '...', amount: 100, ... });
Authentication
All procedures require a valid Firebase Auth token passed via the Authorization header unless noted otherwise. Three middleware tiers are used:
| Middleware | Description |
|---|
publicProcedure | No auth required (health check, grant ingest) |
protectedProcedure | Requires authenticated Firebase user |
permissionProcedure(P) | Requires authenticated user with specific permission(s) |
superAdminProcedure | Requires authenticated user with isSuperAdmin: true |
Transport
tRPC is served via Hono at /api/trpc/* on the api Cloud Function (region: europe-west1). The transport uses superjson as the serializer.
Root
File: functions/src/api/routers/index.ts
| Procedure | Type | Input | Auth | Description |
|---|
health | query | none | public | Returns { status, timestamp, version } health check |
Router: projects
File: functions/src/api/routers/projects.ts
| Procedure | Type | Input | Auth | Description |
|---|
list | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', status?: string } | VIEW_PROJECTS | List projects for the authenticated organization |
get | query | { id: string } | VIEW_PROJECTS | Get a single project by ID (with budget data) |
stats | query | none | VIEW_PROJECTS | Get organization-level project statistics |
create | mutation | { name: string, description?: string, status?: string, phase?: ProjectPhase, startDate?: string, endDate?: string, budget?: { total: number, spent?: number, currency?: string }, grantId?: string, managerId?: string, managerName?: string, teamMemberIds?: string[], tags?: string[] } | MANAGE_PROJECTS | Create a new project |
update | mutation | { id: string, data: { name?, description?, status?, phase?, startDate?, endDate?, budget?, managerId?, managerName?, teamMemberIds?, tags? } } | MANAGE_PROJECTS | Update an existing project |
delete | mutation | { id: string, hard?: boolean } | MANAGE_PROJECTS | Delete a project (soft delete by default) |
Router: uploads
File: functions/src/api/routers/uploads.ts
| Procedure | Type | Input | Auth | Description |
|---|
requestIntent | mutation | { filename: string, contentType: string, domainContext: string } | protected | Request a signed upload intent for a file |
finalize | mutation | { uploadToken: string, metadata?: Record<string, unknown> } | protected | Finalize an upload after the file has been transferred |
Router: expenses
File: functions/src/api/routers/expenses.ts
| Procedure | Type | Input | Auth | Description |
|---|
list | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', status?: ExpenseStatus, projectId?: string, employeeId?: string } | VIEW_EXPENSES | List expenses with optional filters |
get | query | { id: string } | VIEW_EXPENSES | Get a single expense by ID |
stats | query | none | VIEW_EXPENSES | Get organization-level expense statistics |
create | mutation | { employeeId: string, projectId: string, merchant: string, date: string, amount: number, currency?: string, category: string, description: string, budgetLineId?: string, receiptUrl?: string, receiptStoragePath?: string } | MANAGE_EXPENSES | Create a new expense (status defaults to Draft) |
update | mutation | { id: string, data: { merchant?, date?, amount?, currency?, category?, description?, budgetLineId?, projectId?, receiptUrl?, receiptStoragePath? } } | MANAGE_EXPENSES | Update an existing expense |
submit | mutation | { id: string } | MANAGE_EXPENSES | Submit an expense for approval |
processReceipt | mutation | { storagePath: string, mimeType?: string } | MANAGE_EXPENSES | Process a receipt image (AI extraction) |
approve | mutation | { id: string, notes?: string } | APPROVE_EXPENSES | Approve a submitted expense |
reject | mutation | { id: string, reason: string } | APPROVE_EXPENSES | Reject a submitted expense |
delete | mutation | { id: string, hard?: boolean } | MANAGE_EXPENSES | Delete an expense (soft delete by default) |
listCategories | query | { page?: int, pageSize?: int } | VIEW_EXPENSES | List distinct expense categories with counts and totals |
listReceipts | query | { page?: int, pageSize?: int, status?: 'pending'|'processed'|'failed' } | VIEW_EXPENSES | List expenses that have receipt data |
listReports | query | { page?: int, pageSize?: int } | VIEW_EXPENSES | List expense reports (stub — returns empty) |
Router: journals
File: functions/src/api/routers/journals.ts
Daily Entries
| Procedure | Type | Input | Auth | Description |
|---|
listEntries | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', employeeId?: string, projectId?: string, status?: JournalStatus } | VIEW_JOURNALS | List journal entries with optional filters |
getEntry | query | { id: string } | VIEW_JOURNALS | Get a single journal entry by ID |
createEntry | mutation | { employeeId: string, projectId: string, date: string, hours: number, activityType: string, description: string, entryType?: string, leaveType?: string } | EDIT_OWN_ENTRIES | Create a new journal entry (status defaults to draft) |
updateEntry | mutation | { id: string, data: { projectId?, hours?, activityType?, description?, entryType? } } | EDIT_OWN_ENTRIES | Update an existing journal entry |
lockEntry | mutation | { id: string } | APPROVE_JOURNALS | Lock a journal entry to prevent further edits |
Monthly Submissions
| Procedure | Type | Input | Auth | Description |
|---|
listMonthly | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', employeeId?: string, status?: SubmissionStatus, month?: string } | VIEW_JOURNALS | List monthly journal submissions |
getMonthly | query | { id: string } | VIEW_JOURNALS | Get a single monthly submission by ID |
submitMonthly | mutation | { id: string } | EDIT_OWN_ENTRIES | Submit a monthly journal for approval |
approveMonthly | mutation | { id: string } | APPROVE_JOURNALS | Approve a monthly journal submission |
rejectMonthly | mutation | { id: string, reason: string } | APPROVE_JOURNALS | Reject a monthly journal submission |
Timesheet Sub-domain
| Procedure | Type | Input | Auth | Description |
|---|
timesheetMatrix | query | { weekStartDate: string, employeeId?: string } | VIEW_JOURNALS | Get the weekly timesheet matrix (entries grouped by project x day) |
timesheetReports | query | { page?: int, pageSize?: int, period?: string } | VIEW_JOURNALS | List timesheet reports (stub — returns empty) |
Router: people
File: functions/src/api/routers/people.ts
| Procedure | Type | Input | Auth | Description |
|---|
list | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', status?: UserStatus, department?: string, managerId?: string, staffType?: StaffType } | VIEW_EMPLOYEES | List people/employees with optional filters |
get | query | { id: string } | VIEW_EMPLOYEES | Get a single person by ID |
stats | query | none | VIEW_EMPLOYEES | Get organization-level people statistics |
create | mutation | { name: string, email: string, phone?: string, role?: string, department?: string, costCenter?: string, managerId?: string, managerName?: string, contractHours?: number, fteRatio?: number, startDate?: string, contractType?: string, staffType?: StaffType, staffCategory?: string } | MANAGE_EMPLOYEES | Create a new person/employee |
update | mutation | { id: string, data: { name?, email?, phone?, department?, costCenter?, managerId?, managerName?, contractHours?, fteRatio?, contractType?, staffType?, staffCategory? } } | MANAGE_EMPLOYEES | Update an existing person |
getCostAllocation | query | { id: string } | VIEW_EMPLOYEES | Get cost allocation breakdown for a person |
updateCostAllocation | mutation | { id: string, allocations: [{ projectId: string, projectName: string, fte: number, hourlyRate: number, currency?: string }] } | MANAGE_EMPLOYEES | Update cost allocation for a person |
deactivate | mutation | { id: string } | MANAGE_EMPLOYEES | Deactivate a person |
delete | mutation | { id: string, hard?: boolean } | MANAGE_EMPLOYEES | Delete a person (soft delete by default) |
Router: grants
File: functions/src/api/routers/grants.ts
Opportunities
| Procedure | Type | Input | Auth | Description |
|---|
searchOpportunities | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', grantType?: string, grantorType?: string, query?: string } | VIEW_PROJECTS | Search grant opportunities with optional filters |
getOpportunity | query | { id: string } | VIEW_PROJECTS | Get a single grant opportunity by ID |
Pipeline
| Procedure | Type | Input | Auth | Description |
|---|
listPipeline | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', stage?: string } | VIEW_PROJECTS | List pipeline entries filtered by stage |
getPipelineEntry | query | { id: string } | VIEW_PROJECTS | Get a single pipeline entry by ID |
pipelineStats | query | none | VIEW_PROJECTS | Get pipeline-level statistics (counts by stage, totals) |
createPipelineEntry | mutation | { title: string, grantOpportunityId?: string, grantorName?: string, stage?: string, amount?: number, currency?: string, probability?: number, deadline?: string, assignedTo?: string, assignedToName?: string, notes?: string } | MANAGE_PROJECTS | Create a new pipeline entry |
updatePipelineEntry | mutation | { id: string, data: { title?, grantorName?, amount?, currency?, probability?, deadline?, assignedTo?, assignedToName?, notes? } } | MANAGE_PROJECTS | Update a pipeline entry |
changeStage | mutation | { id: string, stage: string } | MANAGE_PROJECTS | Change the stage of a pipeline entry |
deletePipelineEntry | mutation | { id: string, hard?: boolean } | MANAGE_PROJECTS | Delete a pipeline entry |
Applications
| Procedure | Type | Input | Auth | Description |
|---|
listApplications | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', status?: string, projectId?: string } | VIEW_PROJECTS | List grant applications with optional filters |
getApplication | query | { id: string } | VIEW_PROJECTS | Get a single application by ID |
createApplication | mutation | { title: string, pipelineEntryId?: string, grantOpportunityId?: string, grantorName?: string, amount?: number, currency?: string, projectId?: string, assignedTo?: string } | MANAGE_PROJECTS | Create a new grant application (status defaults to draft) |
updateApplication | mutation | { id: string, data: { title?, grantorName?, amount?, status?, projectId?, assignedTo? } } | MANAGE_PROJECTS | Update an existing application |
submitApplication | mutation | { id: string } | MANAGE_PROJECTS | Submit an application for review |
deleteApplication | mutation | { id: string, hard?: boolean } | MANAGE_PROJECTS | Delete an application |
Active Grants
| Procedure | Type | Input | Auth | Description |
|---|
listActiveGrants | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', status?: string } | VIEW_PROJECTS | List active (awarded) grants |
convertToActiveGrant | mutation | { pipelineEntryId: string, opportunityId: string, applicationId: string, grantDetails?: { status?, awardedAmount?, currency?, startDate?, endDate? } } | MANAGE_PROJECTS | Convert a pipeline entry + application into an active grant |
updateActiveGrant | mutation | { id: string, data: { status?, awardedAmount?, currency?, startDate?, endDate? } } | MANAGE_PROJECTS | Update an active grant |
Router: grantAdmin
File: functions/src/api/routers/grantAdmin.ts
All procedures require superadmin access.
| Procedure | Type | Input | Auth | Description |
|---|
listSourceConfigs | query | none | superAdmin | List all grant ingestion source configurations |
updateSourceConfig | mutation | { sourceId: GrantSourceId, enabled?: boolean, schedule?: string } | superAdmin | Update a grant source configuration (enable/disable, schedule) |
triggerSync | mutation | { sourceId: GrantSourceId } | superAdmin | Manually trigger a sync for a grant source (calls n8n webhook) |
listSyncHistory | query | { sourceId?: GrantSourceId, limit?: int (1-100, default 25), cursor?: string } | superAdmin | List sync history with cursor-based pagination |
listScrapingTargets | query | { sourceId: GrantSourceId } | superAdmin | List scraping targets for a specific grant source |
upsertScrapingTarget | mutation | { id?: string, sourceId: GrantSourceId, url: string, name: string, extractionSchema?: Record, enabled?: boolean, frequency?: 'daily'|'weekly'|'monthly' } | superAdmin | Create or update a scraping target |
deleteScrapingTarget | mutation | { id: string } | superAdmin | Delete a scraping target |
Router: compliance
File: functions/src/api/routers/compliance.ts
Policies
| Procedure | Type | Input | Auth | Description |
|---|
listPolicies | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', status?: string, category?: string, severity?: string } | VIEW_PROJECTS | List compliance policies with filters |
getPolicy | query | { id: string } | VIEW_PROJECTS | Get a single policy by ID |
createPolicy | mutation | { name: string, description?: string, category: string, severity?: string, status?: string, frequency?: string, projectIds?: string[] } | MANAGE_PROJECTS | Create a new compliance policy |
updatePolicy | mutation | { id: string, data: { name?, description?, category?, severity?, status?, frequency?, projectIds? } } | MANAGE_PROJECTS | Update an existing policy |
deletePolicy | mutation | { id: string, hard?: boolean } | MANAGE_PROJECTS | Delete a policy |
Alerts
| Procedure | Type | Input | Auth | Description |
|---|
listAlerts | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', status?: string, type?: string, severity?: string, projectId?: string } | VIEW_PROJECTS | List compliance alerts with filters |
getAlert | query | { id: string } | VIEW_PROJECTS | Get a single alert by ID |
acknowledgeAlert | mutation | { id: string } | MANAGE_PROJECTS | Acknowledge a compliance alert |
resolveAlert | mutation | { id: string, notes?: string } | MANAGE_PROJECTS | Resolve a compliance alert with optional notes |
Scoring
| Procedure | Type | Input | Auth | Description |
|---|
score | query | none | VIEW_PROJECTS | Get the organization’s compliance score |
Router: billing
File: functions/src/api/routers/billing.ts
| Procedure | Type | Input | Auth | Description |
|---|
getTiers | query | none | protected | Get all active subscription pricing tiers |
getPlatformStats | query | none | protected | Get platform-wide billing statistics (MRR, ARR, churn, etc.) |
getOrganizationHistory | query | { organizationId: string } | protected | Get billing transaction history for an organization |
Router: notifications
File: functions/src/api/routers/notifications.ts
| Procedure | Type | Input | Auth | Description |
|---|
markAsRead | mutation | { id: string } | protected | Mark a single notification as read |
markAllRead | mutation | { organizationId: string, userId: string } | protected | Mark all notifications as read for a user |
delete | mutation | { id: string } | protected | Delete a notification |
update | mutation | { id: string, data: Record<string, any> } | protected | Update a notification (versatile/generic) |
updatePreferences | mutation | notificationPreferencesSchema (partial) | protected | Update notification preferences (channels, frequency, quiet hours) |
File: functions/src/api/routers/contacts.ts
| Procedure | Type | Input | Auth | Description |
|---|
list | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', recordType?: string, relationshipGroup?: string, search?: string } | VIEW_TEAM_DIRECTORY | List contacts/stakeholders with filters |
get | query | { id: string } | VIEW_TEAM_DIRECTORY | Get a contact with interaction history |
create | mutation | { recordType?: string, displayName: string, firstName?: string, lastName?: string, organizationName?: string, email?: string, phoneNumber?: string, relationshipGroups?: string[], tags?: string[], consents?: Record[], owner?: string, ownerName?: string, notes?: string, customFields?: Record } | MANAGE_TEAM | Create a new contact |
update | mutation | { id: string, data: { ...contactCreateFields (all optional) } } | MANAGE_TEAM | Update an existing contact |
delete | mutation | { id: string, hard?: boolean } | MANAGE_TEAM | Delete a contact |
addInteraction | mutation | { contactId: string, type: string, title: string, description?: string, timestamp: string } | MANAGE_TEAM | Add an interaction record to a contact |
Router: documents
File: functions/src/api/routers/documents.ts
| Procedure | Type | Input | Auth | Description |
|---|
list | query | { page?: int, pageSize?: int, sortBy?: string, sortOrder?: 'asc'|'desc', projectId?: string, status?: string, documentType?: string, approvedForUse?: boolean, funderId?: string } | VIEW_PROJECTS | List documents with filters |
get | query | { id: string } | VIEW_PROJECTS | Get a single document by ID |
getUploadUrl | mutation | { fileName: string, mimeType: string } | UPLOAD_ATTACHMENTS | Get a signed upload URL for a document |
create | mutation | { fileName: string, title: string, description?: string, documentType?: string, size: int, mimeType: string, storagePath: string, downloadUrl?: string, projectIds?: string[], funderId?: string, tags?: string[], sensitivity?: 'public'|'internal'|'confidential'|'restricted' } | UPLOAD_ATTACHMENTS | Create a document record |
classify | mutation | { id: string } | UPLOAD_ATTACHMENTS | Classify a document using AI |
delete | mutation | { id: string, hard?: boolean } | MANAGE_PROJECTS | Delete a document |
Router: procurement
File: functions/src/api/routers/procurement.ts
Service: ServerProcurementService (4 service classes: requests, vendors, purchase orders, approvals)
Schemas: @grantmaster/domain-schema/trpc (procurement*.ts)
Procurement Requests
| Procedure | Type | Input | Auth | Description |
|---|
listRequests | query | { page, pageSize, status?, priority?, projectId?, categoryCode? } | VIEW_PROCUREMENT | List procurement requests with filtering |
getRequest | query | { id } | VIEW_PROCUREMENT | Get a single procurement request |
createRequest | mutation | { title, requester, department, amount, currency?, justification, projectId?, budgetLineId?, grantId?, categoryCode?, estimatedDelivery?, tags? } | MANAGE_PROCUREMENT | Create a draft procurement request |
updateRequest | mutation | { id, data: Partial<Request> } | MANAGE_PROCUREMENT | Update a procurement request |
submitRequest | mutation | { id } | MANAGE_PROCUREMENT | Submit request for review (draft → submitted) |
approveRequest | mutation | { id, notes? } | APPROVE_PROCUREMENT | Approve a request |
rejectRequest | mutation | { id, reason } | APPROVE_PROCUREMENT | Reject a request with mandatory reason |
deleteRequest | mutation | { id, hard? } | MANAGE_PROCUREMENT | Soft/hard delete a request |
Vendors
| Procedure | Type | Input | Auth | Description |
|---|
listVendors | query | { page, pageSize, type?, compliance?, isPreferred? } | VIEW_PROCUREMENT | List vendors with filtering |
getVendor | query | { id } | VIEW_PROCUREMENT | Get a single vendor |
createVendor | mutation | { name, type?, category, email, phone?, website?, registrationNumber?, taxId?, contractExpiry?, certifications?, tags? } | MANAGE_VENDORS | Create a vendor (starts in pending_review compliance) |
updateVendor | mutation | { id, data: Partial<Vendor> } | MANAGE_VENDORS | Update a vendor |
deleteVendor | mutation | { id, hard? } | MANAGE_VENDORS | Soft/hard delete a vendor |
Purchase Orders
| Procedure | Type | Input | Auth | Description |
|---|
listPurchaseOrders | query | { page, pageSize, status?, vendorId?, projectId? } | VIEW_PROCUREMENT | List purchase orders with filtering |
getPurchaseOrder | query | { id } | VIEW_PROCUREMENT | Get a single purchase order |
createPurchaseOrder | mutation | { vendorId, requestId?, projectId?, lineItems[], terms?, deliveryDate? } | MANAGE_PROCUREMENT | Create a purchase order |
updatePurchaseOrder | mutation | { id, data: Partial<PO> } | MANAGE_PROCUREMENT | Update a purchase order |
receivePurchaseOrder | mutation | { id } | MANAGE_PROCUREMENT | Mark PO as received |
deletePurchaseOrder | mutation | { id, hard? } | MANAGE_PROCUREMENT | Soft/hard delete a PO |
Procurement Approvals
| Procedure | Type | Input | Auth | Description |
|---|
listApprovals | query | { page, pageSize, status?, type? } | VIEW_PROCUREMENT | List approval queue |
approveApproval | mutation | { id, notes? } | APPROVE_PROCUREMENT | Approve a procurement approval |
rejectApproval | mutation | { id, reason } | APPROVE_PROCUREMENT | Reject a procurement approval |
Router: audit
File: functions/src/api/routers/audit.ts
| Procedure | Type | Input | Auth | Description |
|---|
listFindings | query | { page?: int, pageSize?: int, severity?: string } | VIEW_AUDIT_REPORTS | List audit findings with optional severity filter |
listReports | query | { page?: int, pageSize?: int } | VIEW_AUDIT_REPORTS | List audit reports |
getAuditLog | query | { page?: int, pageSize?: int } | VIEW_AUDIT_REPORTS | Get the audit log (sorted by timestamp desc) |
Router: risk
File: functions/src/api/routers/risk.ts
| Procedure | Type | Input | Auth | Description |
|---|
listRisks | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List all risks in the register |
getMatrix | query | {} | VIEW_PROJECTS | Get the risk matrix (all risks with 5x5 probability/impact dimensions) |
listMitigations | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List risk mitigation plans |
listEscalations | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List risk escalations |
Router: mission
File: functions/src/api/routers/mission.ts
| Procedure | Type | Input | Auth | Description |
|---|
listPillars | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List mission/strategic pillars |
listGoals | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List mission goals |
getAllocation | query | {} | VIEW_PROJECTS | Get budget allocation across pillars |
Router: impact
File: functions/src/api/routers/impact.ts
| Procedure | Type | Input | Auth | Description |
|---|
listIndicators | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List M&E indicators |
listCollections | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List data collection entries |
getDashboard | query | {} | VIEW_PROJECTS | Get impact dashboard summary (on-target, below-target, overdue counts) |
Router: marketing
File: functions/src/api/routers/marketing.ts
| Procedure | Type | Input | Auth | Description |
|---|
listPages | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List CMS pages |
listMedia | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List media assets |
listPublishing | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List publishing schedule entries |
Router: partnerships
File: functions/src/api/routers/partnerships.ts
| Procedure | Type | Input | Auth | Description |
|---|
listPartners | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List partners |
listAgreements | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List partnership agreements |
listPipeline | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List partnership pipeline (prospects only) |
Router: referrals
File: functions/src/api/routers/referrals.ts
| Procedure | Type | Input | Auth | Description |
|---|
listPrograms | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List referral programs |
listTracking | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List referral tracking entries |
listRewards | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List referral rewards |
Router: support
File: functions/src/api/routers/support.ts
| Procedure | Type | Input | Auth | Description |
|---|
listTutorials | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List support tutorials |
listArticles | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List knowledge base articles |
listVideos | query | { page?: int, pageSize?: int } | VIEW_PROJECTS | List support videos |
File: functions/src/api/routers/platformApi.ts
All procedures require superadmin access and return stub data ({ items: [], total: 0 } or {}) until platform services are built. All accept { page?: int, pageSize?: int } unless noted.
Tenants
| Procedure | Type | Input | Auth | Description |
|---|
listTenants | query | { page?, pageSize? } | superAdmin | List all tenants |
tenantHealth | query | { page?, pageSize? } | superAdmin | Get tenant health metrics |
Subscriptions
| Procedure | Type | Input | Auth | Description |
|---|
listPlans | query | { page?, pageSize? } | superAdmin | List subscription plans |
listTrials | query | { page?, pageSize? } | superAdmin | List active trials |
revenue | query | { page?, pageSize? } | superAdmin | Get revenue data |
churn | query | { page?, pageSize? } | superAdmin | Get churn metrics |
listCoupons | query | { page?, pageSize? } | superAdmin | List coupon codes |
Email
| Procedure | Type | Input | Auth | Description |
|---|
listEmailProviders | query | { page?, pageSize? } | superAdmin | List email providers |
listEmailTemplates | query | { page?, pageSize? } | superAdmin | List email templates |
emailLogs | query | { page?, pageSize? } | superAdmin | Get email delivery logs |
Orchestration
| Procedure | Type | Input | Auth | Description |
|---|
listWorkflows | query | { page?, pageSize? } | superAdmin | List workflow definitions |
jobQueue | query | { page?, pageSize? } | superAdmin | Get background job queue status |
scheduler | query | { page?, pageSize? } | superAdmin | Get scheduled task status |
EventBus
| Procedure | Type | Input | Auth | Description |
|---|
listEventTopics | query | { page?, pageSize? } | superAdmin | List event topics |
deadLetterQueue | query | { page?, pageSize? } | superAdmin | Get dead letter queue entries |
Notifications
| Procedure | Type | Input | Auth | Description |
|---|
listNotifChannels | query | { page?, pageSize? } | superAdmin | List notification channels |
listNotifTemplates | query | { page?, pageSize? } | superAdmin | List notification templates |
Config
| Procedure | Type | Input | Auth | Description |
|---|
getConfig | query | {} | superAdmin | Get platform configuration |
Intelligence (AI)
| Procedure | Type | Input | Auth | Description |
|---|
listModels | query | { page?, pageSize? } | superAdmin | List AI models |
listPrompts | query | { page?, pageSize? } | superAdmin | List prompt templates |
listRAGPipelines | query | { page?, pageSize? } | superAdmin | List RAG pipelines |
aiCosts | query | { page?, pageSize? } | superAdmin | Get AI cost analytics |
Agentics
| Procedure | Type | Input | Auth | Description |
|---|
listAgents | query | { page?, pageSize? } | superAdmin | List AI agents |
agentLogs | query | { page?, pageSize? } | superAdmin | Get agent execution logs |
Extensions
| Procedure | Type | Input | Auth | Description |
|---|
extRegistry | query | { page?, pageSize? } | superAdmin | Browse the extension registry |
extReviews | query | { page?, pageSize? } | superAdmin | List extension reviews |
extAnalytics | query | { page?, pageSize? } | superAdmin | Get extension usage analytics |
Integrations
| Procedure | Type | Input | Auth | Description |
|---|
listIntegrations | query | { page?, pageSize? } | superAdmin | List third-party integrations |
listWebhooks | query | { page?, pageSize? } | superAdmin | List webhooks |
listAPIKeys | query | { page?, pageSize? } | superAdmin | List API keys |
Policies
| Procedure | Type | Input | Auth | Description |
|---|
listPolicies | query | { page?, pageSize? } | superAdmin | List platform policies |
policyEnforcement | query | { page?, pageSize? } | superAdmin | Get policy enforcement data |
Referrals
| Procedure | Type | Input | Auth | Description |
|---|
listReferralPrograms | query | { page?, pageSize? } | superAdmin | List referral programs |
referralTracking | query | { page?, pageSize? } | superAdmin | Get referral tracking data |
listReferralPayouts | query | { page?, pageSize? } | superAdmin | List referral payouts |
SuperAdmin
| Procedure | Type | Input | Auth | Description |
|---|
listSuperAdmins | query | { page?, pageSize? } | superAdmin | List superadmin users |
superAdminLogs | query | { page?, pageSize? } | superAdmin | Get superadmin activity logs |
Unmounted Routers
The following router is defined but not mounted in the app router. It is exposed via the REST API only:
grantIngest
File: functions/src/api/routers/grantIngest.ts
| Procedure | Type | Input | Auth | Description |
|---|
ingest | mutation | GrantIngestPayload (grant data from n8n) | API key (public procedure with key validation) | Receive grant data from external ingestion workflows |
Maintenance
Update this document when adding or removing tRPC procedures. The canonical source of truth is functions/src/api/routers/index.ts (the root app router) and the individual router files in functions/src/api/routers/.
Input schemas are defined in packages/domain-schema/src/trpc/ and shared across the monorepo.