Overview
The Chat API provides AI-powered financial analysis using a RAG (Retrieval-Augmented Generation) system. It searches across earnings transcripts, 10-K filings, and financial news to answer complex financial questions.
Stream Chat Message (Authenticated)
Stream an AI-generated response with real-time progress updates.
Endpoint : POST /message/stream-v2
Authentication : Required
curl -N -X POST https://api.financeagent.com/message/stream-v2 \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"message": "What were Tesla' \' s revenue trends in Q4 2024?",
"comprehensive": true,
"conversation_id": null
}'
Request Body
User question (max 1000 characters)
Whether to use comprehensive search (slower but more thorough)
Existing conversation ID to continue a thread (null for new conversation)
Streaming Response Events
The endpoint returns Server-Sent Events (SSE) in the following format:
data: {"type": "event_type", "message": "...", "data": {...}}
Event Types
Search and analysis progress updates { "type" : "progress" , "message" : "Searching earnings transcripts..." }
AI reasoning steps during analysis { "type" : "reasoning" , "message" : "Analyzing Tesla Q4 2024 data" }
Streaming answer tokens (word-by-word) { "type" : "token" , "data" : { "token" : "revenue" }}
Final complete answer with citations {
"type" : "result" ,
"conversation_id" : "uuid" ,
"data" : {
"response" : {
"answer" : "Tesla's Q4 2024 revenue was $25.7B..." ,
"citations" : [
{
"company" : "TSLA" ,
"quarter" : "2024_q4" ,
"chunk_text" : "Revenue for Q4 2024 was..." ,
"relevance_score" : 0.95 ,
"citation_type" : "transcript"
}
]
},
"timing" : {
"total_time" : 3.45 ,
"search_time" : 1.2 ,
"generation_time" : 2.25
}
}
}
Error during processing {
"type" : "error" ,
"message" : "Rate limit exceeded" ,
"error" : "RATE_LIMIT_EXCEEDED"
}
Content-Type: text/event-stream
Cache-Control: no-cache
Connection: keep-alive
X-Accel-Buffering: no
Stream Demo Chat (Public)
Public demo endpoint with limited functionality.
Endpoint : POST /landing/demo/stream-v2
Authentication : Not required
curl -N -X POST https://api.financeagent.com/landing/demo/stream-v2 \
-H "Content-Type: application/json" \
-d '{
"message": "What is Apple' \' s market cap?",
"comprehensive": false,
"session_id": "demo-session-123"
}'
Search mode (limited in demo)
Client-generated session ID for rate limiting
Demo endpoint is limited to 5 messages per session and may have reduced functionality.
Get Chat History
Retrieve past chat messages with filtering and pagination.
Endpoint : GET /history
Authentication : Required
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
"https://api.financeagent.com/history?limit=50&offset=0&search=Tesla"
Query Parameters
Maximum number of messages to return (max 100)
Number of messages to skip for pagination
Search term to filter messages
Filter messages from date (YYYY-MM-DD)
Filter messages to date (YYYY-MM-DD)
Response
Array of chat history items Array of citation objects
Get Chat Statistics
Retrieve chat usage statistics for the current user.
Endpoint : GET /stats
Authentication : Required
curl -H "Authorization: Bearer YOUR_JWT_TOKEN" \
https://api.financeagent.com/stats
Response
Usage statistics Number of days with activity
Timestamp of first message
Timestamp of most recent message
Average question length in characters
Average response length in characters
Citation Types
The chat API returns citations from three sources:
Transcript Citations
{
"citation_type" : "transcript" ,
"company" : "AAPL" ,
"year" : 2024 ,
"quarter" : "2024_q4" ,
"chunk_text" : "Revenue increased 6% year over year..." ,
"relevance_score" : 0.92 ,
"transcript_available" : true
}
News Citations
{
"citation_type" : "news" ,
"title" : "Apple Reports Q4 Earnings Beat" ,
"url" : "https://news.example.com/apple-earnings" ,
"published_date" : "2024-11-01" ,
"chunk_text" : "Apple Inc. reported better than expected..." ,
"relevance_score" : 0.88
}
10-K Citations
{
"citation_type" : "10-K" ,
"ticker" : "MSFT" ,
"fiscal_year" : 2024 ,
"section" : "Risk Factors" ,
"chunk_text" : "Our business is subject to various risks..." ,
"relevance_score" : 0.85
}
Rate Limiting
Chat endpoints are subject to rate limits:
Authenticated : 20 requests/month (standard), 100 requests/month (admin)
Demo : 5 messages per session
When rate limited, you’ll receive an error event:
{
"type" : "error" ,
"error" : "RATE_LIMIT_EXCEEDED" ,
"message" : "Monthly limit exceeded. Maximum 20 requests per month."
}