AI Chat
const url = 'https://indepai.app/api/v1/ai/chat';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"message":"How can I optimize my savings rate for FIRE?","conversationId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","category":"fi-planning","snapshotId":"example","enabledToolIds":["get_city_costs","calculate_fire_number"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://indepai.app/api/v1/ai/chat \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "message": "How can I optimize my savings rate for FIRE?", "conversationId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "category": "fi-planning", "snapshotId": "example", "enabledToolIds": [ "get_city_costs", "calculate_fire_number" ] }'Send a message to the AI financial coach. Returns a streamed response. Subject to monthly AI rate limits based on subscription tier.
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”object
User message to the AI coach
Example
How can I optimize my savings rate for FIRE?Existing conversation ID for follow-up messages
AI coach category for context
Example
fi-planningAI FI Snapshot hash to attach as source-of-truth context for money-snapshot questions
Tool IDs the user has enabled in tool settings. Omit to allow all tools. The server intersects this with the known toolset and consent gates.
Example
[ "get_city_costs", "calculate_fire_number"]Responses
Section titled “Responses”AI chat response (streamed SSE)
object
object
Conversation ID for follow-up messages
AI response text
Example
{ "success": true}Validation error
object
Always false for error responses
Error type
Machine-readable error code
Detailed validation errors
object
Path to the invalid field
Error message
Example
{ "success": false, "error": "Validation error", "code": "VALIDATION_ERROR", "details": [ { "path": "currentAge", "message": "Must be between 18 and 100" } ]}Unauthorized
object
Always false for error responses
Error type
Machine-readable error code
Detailed validation errors
object
Path to the invalid field
Error message
Example
{ "success": false, "error": "Validation error", "code": "VALIDATION_ERROR", "details": [ { "path": "currentAge", "message": "Must be between 18 and 100" } ]}AI rate limit exceeded
object
Always false for error responses
Error type
Machine-readable error code
Detailed validation errors
object
Path to the invalid field
Error message
Example
{ "success": false, "error": "Validation error", "code": "VALIDATION_ERROR", "details": [ { "path": "currentAge", "message": "Must be between 18 and 100" } ]}