Overview
The Parse Goal endpoint uses AI to extract structured parameters from natural language financial goal descriptions. It intelligently parses the goal type, target amount, timeline, and any constraints mentioned by the user.Endpoint
Request Body
Natural language description of the financial goal. Examples:
- “Save $50k for a house down payment in 3 years”
- “Retire comfortably in 30 years”
- “Build a $15,000 emergency fund”
- “Pay off my debt within 5 years”
Response
The categorized goal type. One of:
retirement- retiring, stop working, financial independencemajor_purchase- house, car, boat, etc.emergency_fund- rainy day fund, safety net, 6 months expensesdebt_payoff- pay off loans, become debt freetravel- vacation, trip, sabbaticaleducation- college, degree, certificationinvestment- grow wealth, portfolio targetcustom- anything else
Target amount in USD. Returns
null if amount cannot be determined from the goal description.For vague descriptions, the AI estimates reasonable defaults:- “comfortable retirement” → $1,000,000
- “house down payment” → $60,000
- “emergency fund” → $15,000
Timeline in months. Returns
null if timeline cannot be determined.For vague timelines, the AI estimates:- “in a few years” → 36 months
- “by retirement” → 420 months (35 years)
- “soon” → 12 months
- “long term” → 120 months (10 years)
Array of any constraints or conditions mentioned in the goal description. Empty array if none mentioned.
Indicates whether the goal description is ambiguous and requires clarification from the user.Set to
true when:- Target amount is unrealistically low for the goal type
- Timeline is missing for a time-sensitive goal
- Goal description is too vague to estimate amounts
Array of questions to ask the user for clarification. Only present when
needsClarification is true.Examples:- “A corvette typically costs 100,000. Did you mean 100,000?”
- “When would you like to buy this car?”
Examples
Clear Goal with All Parameters
Vague Goal Requiring Clarification
Retirement Goal with Vague Timeline
Emergency Fund Goal
Travel Goal
Error Responses
Error message describing what went wrong.
Missing Goal Parameter
400 Bad Request
Server Error
500 Internal Server Error
Implementation Notes
- The endpoint uses Google’s Gemini 2.0 Flash model for parsing
- If the Gemini API is unavailable, it falls back to rule-based parsing
- The AI considers realistic cost ranges for different goal types
- Clarification is requested when amounts seem unrealistic (e.g., $3 for a car)
- The parser handles various formats: “$50k”, “50000”, “50,000”
- Timeline can be specified in years or months