openapi: 3.1.0 info: # Do not change the title, if the title changes, the import paths will be broken title: Api version: 0.1.0 description: Decision Twin API servers: - url: /api description: Base API path tags: - name: health description: Health operations - name: decisions description: Decision management - name: profile description: User profile paths: /healthz: get: operationId: healthCheck tags: [health] summary: Health check responses: "200": description: Healthy content: application/json: schema: $ref: "#/components/schemas/HealthStatus" /decisions: get: operationId: listDecisions tags: [decisions] summary: List all saved decisions responses: "200": description: List of decisions content: application/json: schema: type: array items: $ref: "#/components/schemas/Decision" post: operationId: createDecision tags: [decisions] summary: Create a new decision from wizard input requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/DecisionInput" responses: "201": description: Created decision with AI analysis content: application/json: schema: $ref: "#/components/schemas/DecisionWithAnalysis" /decisions/stats: get: operationId: getDecisionStats tags: [decisions] summary: Get summary stats across all decisions responses: "200": description: Decision statistics content: application/json: schema: $ref: "#/components/schemas/DecisionStats" /decisions/{id}: get: operationId: getDecision tags: [decisions] summary: Get a decision with its full analysis parameters: - name: id in: path required: true schema: type: integer responses: "200": description: Decision with analysis content: application/json: schema: $ref: "#/components/schemas/DecisionWithAnalysis" "404": description: Not found content: application/json: schema: $ref: "#/components/schemas/ErrorResponse" delete: operationId: deleteDecision tags: [decisions] summary: Delete a decision parameters: - name: id in: path required: true schema: type: integer responses: "204": description: Deleted /profile: get: operationId: getProfile tags: [profile] summary: Get user profile responses: "200": description: User profile content: application/json: schema: $ref: "#/components/schemas/Profile" patch: operationId: updateProfile tags: [profile] summary: Update user profile requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/ProfileUpdate" responses: "200": description: Updated profile content: application/json: schema: $ref: "#/components/schemas/Profile" components: schemas: HealthStatus: type: object required: [status] properties: status: type: string ErrorResponse: type: object required: [error] properties: error: type: string DecisionInput: type: object required: [question, options] properties: question: type: string description: The core decision question options: type: array items: type: string description: The two or more options being considered timeline: type: ["string", "null"] description: When the decision needs to be made goals: type: ["string", "null"] description: Long-term goals relevant to this decision financialConcerns: type: ["string", "null"] description: Financial factors at play personalPriorities: type: ["string", "null"] description: What matters most personally riskTolerance: type: ["string", "null"] enum: [low, medium, high, null] description: Risk appetite additionalContext: type: ["string", "null"] description: Any extra context Decision: type: object required: [id, question, options, createdAt, confidenceScore] properties: id: type: integer question: type: string options: type: array items: type: string timeline: type: ["string", "null"] goals: type: ["string", "null"] financialConcerns: type: ["string", "null"] personalPriorities: type: ["string", "null"] riskTolerance: type: ["string", "null"] additionalContext: type: ["string", "null"] confidenceScore: type: integer description: 0-100 confidence in the recommendation recommendedOption: type: ["string", "null"] description: The AI-recommended option createdAt: type: string format: date-time Scenario: type: object required: [id, decisionId, optionLabel, pros, cons, risks, financialImpact, lifestyleImpact, stressLevel, careerImpact, relationshipImpact, score] properties: id: type: integer decisionId: type: integer optionLabel: type: string pros: type: array items: type: string cons: type: array items: type: string risks: type: array items: type: string financialImpact: type: string lifestyleImpact: type: string stressLevel: type: integer description: 1-10 stress level careerImpact: type: string relationshipImpact: type: string score: type: integer description: 0-100 overall scenario score Reflection101010: type: object required: [tenMinutes, tenMonths, tenYears] properties: tenMinutes: type: string tenMonths: type: string tenYears: type: string WrapData: type: object required: - alternativeOptions - brightSpots - wideningInsight - confirmationBias - counterArguments - realisticOutcomeComparison - experimentSuggestion - reflection101010 - bestFriendAdvice - valuesAlignment - worstCase - bestCase - mostLikelyCase - premortem - successPreparation - tripwires properties: alternativeOptions: type: array items: type: string description: Stage 1 - Options the user may not have considered brightSpots: type: array items: type: string description: Stage 1 - Successful examples of similar decisions wideningInsight: type: string description: Stage 1 - Key insight from the widening exercise confirmationBias: type: string description: Stage 2 - Bias that may be affecting this decision counterArguments: type: array items: type: string description: Stage 2 - Arguments against the preferred option realisticOutcomeComparison: type: string description: Stage 2 - Comparing with realistic outcomes experimentSuggestion: type: string description: Stage 2 - Small experiment to try before deciding reflection101010: $ref: "#/components/schemas/Reflection101010" bestFriendAdvice: type: string description: Stage 3 - What would you tell your best friend? valuesAlignment: type: string description: Stage 3 - How this decision aligns with stated values worstCase: type: string description: Stage 4 - Worst-case scenario bestCase: type: string description: Stage 4 - Best-case scenario mostLikelyCase: type: string description: Stage 4 - Most likely outcome premortem: type: string description: Stage 4 - If this failed, what probably caused it? successPreparation: type: string description: Stage 4 - If wildly successful, prepare for... tripwires: type: array items: type: string description: Stage 4 - Measurable signals to reconsider the decision DecisionWithAnalysis: type: object required: [decision, scenarios, recommendation, confidenceScore, thingsToInvestigate, actionPlan] properties: decision: $ref: "#/components/schemas/Decision" scenarios: type: array items: $ref: "#/components/schemas/Scenario" recommendation: type: string description: Final AI recommendation text confidenceScore: type: integer description: 0-100 confidence score thingsToInvestigate: type: array items: type: string description: What to research before deciding actionPlan: type: array items: type: string description: Concrete next steps wrapData: oneOf: - $ref: "#/components/schemas/WrapData" - type: "null" description: Full AI-WRAP framework analysis DecisionStats: type: object required: [total, avgConfidence, topCategory, recentCount] properties: total: type: integer avgConfidence: type: integer topCategory: type: ["string", "null"] recentCount: type: integer description: Decisions made in the last 30 days Profile: type: object required: [id, name, theme, language] properties: id: type: integer name: type: string email: type: ["string", "null"] theme: type: string enum: [dark, light, system] language: type: string emailReports: type: ["boolean", "null"] description: Whether to send decision reports by email ProfileUpdate: type: object properties: name: type: string email: type: ["string", "null"] theme: type: string enum: [dark, light, system] language: type: string emailReports: type: ["boolean", "null"] description: Whether to send decision reports by email