tRPC Endpoints
tRPC User Onboarding API
Authenticated user-onboarding profile generation for the welcome flow.
POST
The
userOnboarding namespace currently exposes the AI-assisted profile
generation procedure used by the /welcome/preferences step in webapp-v2.
- Base endpoint:
POST /v1/trpc - Namespace:
userOnboarding.* - Auth: wallet-authenticated
Procedure
userOnboarding.generateInvestingProfile- Purpose: convert a structured onboarding quiz plus optional notes into a
normalized
InvestingProfileV1payload and narrative copy - Used by:
/welcome/preferences- future settings-based profile editing flows
- Response shape:
headlinesummaryprofile
- Purpose: convert a structured onboarding quiz plus optional notes into a
normalized
Input Contract
generateInvestingProfile accepts:
avatarId: stringquizprimaryGoal:growth | balanced | income | preservation | explorationtimeHorizon:lt_1y | 1_3y | 3_5y | 5y_plusriskTolerance:conservative | moderate | aggressiveautomationStyle:hands_on | guided | delegatedstrategyInterests: string[] from:core_large_capyield_incomeindex_likedefithematicexperimental
notes:string | nullexistingProfile?: optional priorInvestingProfileV1payload used when the user regenerates summary copy from an already-edited board
Output Contract
The returnedprofile is normalized and ready to persist as the user-scoped
generic preference investing_profile_v1.
InvestingProfileV1 fields:
versioncompletionModeavatarIdprimaryGoaltimeHorizonriskToleranceautomationStylestrategyInterestspreferredChainsguardrailsnotesheadlinesummaryupdatedAt
Persistence Notes
This procedure generates the profile, but does not persist it directly.webapp-v2 now saves the confirmed profile through the dedicated builder
surface:
v2.portfolio.builder.saveProfileprofile: InvestingProfileV1
v2.portfolio.builder.getProfile
and used to drive the onboarding handoff into /start.
Generation Behavior
- Deterministic normalization always runs first and is the source of truth for the structured profile fields.
- Vertex AI is used only for the narrative
headlineandsummary. - If model output is unavailable or invalid, the backend falls back to
deterministic copy and still returns a valid
InvestingProfileV1. - “Use balanced defaults” maps to
completionMode: "balanced_defaults"when the request matches the built-in default quiz and omits notes.