Chat API
Core endpoint for the MarketIntell AI analyst desk — stocks, options, and crypto
Chat API
The Chat API is the core endpoint of MarketIntell. Send any market question — stocks, options, or crypto — and receive a multi-specialist, correlated analysis routed through 26 specialists across 27+ external services. The API auto-detects the domain from your query (e.g., "AAPL trade setup" routes to US equities, "BTC analysis" routes to crypto), or you can force a domain explicitly.
POST /v1/chat
Send a message to the MarketIntell reasoning pipeline.
Request Headers
| Header | Required | Description |
|---|---|---|
Content-Type | Yes | Must be application/json |
X-API-Key | Yes | Your API key |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
message | string | Yes | Your market question (stocks, options, or crypto) |
session_id | string (UUID) | No | Continue a previous conversation session |
stream | boolean | No | Enable Server-Sent Events streaming (default: false) |
domain | string | No | Force domain: crypto or us_equities (covers stocks + options). Auto-detected from query if omitted. |
mode | string | No | "deep" forces the T3 supervisor pipeline (Pro+ only). Use for high-complexity queries that benefit from multi-specialist debate. |
portfolio_id | string | No | Inject a specific portfolio's context into the prompt. Must be owned by the calling key — cross-owner ids are silently ignored. |
include_portfolio | boolean | No | When true (and no portfolio_id supplied), automatically inject the calling key's most-recently-updated portfolio. |
response_format | object | No | { type: "json_schema", schema: {...} } for structured output. Built-in schemas: trade_setup, market_analysis, token_screen. |
Example Request — Crypto
curl -X POST https://api.marketintell.ai/v1/chat \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"message": "What is the risk/reward for a long ETH position here?",
"stream": false
}'Example Request — US Equities
curl -X POST https://api.marketintell.ai/v1/chat \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"message": "NVDA trade setup — long or short with options flow?",
"stream": false
}'Example Request — Explicit Domain
curl -X POST https://api.marketintell.ai/v1/chat \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"message": "Compare AAPL vs MSFT earnings growth",
"domain": "us_equities",
"stream": false
}'Non-Streaming Response
When stream is false (default), the API returns a single JSON response after the full pipeline completes.
Response Body
| Field | Type | Description |
|---|---|---|
success | boolean | Whether the request succeeded |
data.session_id | string | Session ID for follow-up messages |
data.domain | string | Detected or forced domain: crypto or us_equities |
data.content | string | The full analysis in Markdown format |
data.specialists_used | string[] | Which specialists contributed |
data.classification | object | How the query was classified |
data.correlation | object | Cross-specialist correlation results |
data.latency_ms | number | Total processing time in milliseconds |
data.timestamp | string | ISO 8601 timestamp |
Example Response — Crypto
{
"success": true,
"data": {
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"domain": "crypto",
"content": "## ETH Long Position Risk/Reward Analysis\n\n**Entry:** $3,245\n**Target:** $3,800 (+17.1%)\n**Stop Loss:** $3,050 (-6.0%)\n**Risk/Reward Ratio:** 2.85:1\n\n### Technical Analysis\nETH is holding above the 200-day MA with rising volume...",
"specialists_used": ["technical", "fundamental", "quantitative"],
"classification": {
"specialists": ["technical", "fundamental", "quantitative"],
"tokens": ["ETH"],
"timeframe": "medium",
"intent": "trade_setup"
},
"correlation": {
"alignment": "bullish",
"score": 6.5,
"confirming": [
"Price above key moving averages",
"Rising TVL and protocol revenue",
"Positive risk-adjusted momentum"
],
"contradicting": [
"Declining gas usage trend"
],
"sizing_multiplier": 1.2,
"summary": "Moderate bullish alignment across technical and fundamental signals with minor on-chain usage concern."
},
"latency_ms": 4210,
"timestamp": "2025-01-15T14:22:00.000Z"
}
}Example Response — US Equities
{
"success": true,
"data": {
"session_id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"domain": "us_equities",
"content": "## NVDA Trade Setup\n\n**Bias:** Long\n**Entry:** $135.20\n**Target:** $152.00 (+12.4%)\n**Stop Loss:** $128.50 (-4.9%)\n**Risk/Reward Ratio:** 2.51:1\n\n### Technical Analysis\nNVDA is consolidating above the 50-day MA with a bullish MACD crossover...\n\n### Fundamental Context\nRevenue grew 122% YoY with data center segment driving 87% of total revenue. Forward P/E of 35x vs sector median 28x...\n\n### Options Flow\nUnusual call activity at $150 strike for next month expiry, 3.2x average volume...",
"specialists_used": ["technical", "fundamental", "quantitative"],
"classification": {
"specialists": ["technical", "fundamental", "quantitative"],
"tickers": ["NVDA"],
"timeframe": "medium",
"intent": "trade_setup"
},
"correlation": {
"alignment": "bullish",
"score": 7.1,
"confirming": [
"Price above key moving averages with rising volume",
"Strong revenue growth and margin expansion",
"Bullish options flow with heavy call buying"
],
"contradicting": [
"Elevated valuation vs historical range"
],
"sizing_multiplier": 1.3,
"summary": "Strong bullish alignment across technicals, fundamentals, and options flow. Valuation stretch is the primary risk factor."
},
"latency_ms": 5340,
"timestamp": "2025-07-15T14:22:00.000Z"
}
}Classification Object
Every response includes a classification that describes how the query was routed through the pipeline.
| Field | Type | Description |
|---|---|---|
specialists | string[] | Specialists activated for this query |
tokens | string[] | Crypto tokens identified (crypto domain) |
tickers | string[] | Stock tickers identified (equities domain) |
timeframe | string | Detected timeframe: short, medium, or long |
intent | string | One of 16 classified intents (see Intents) |
Note: The classification object includes
tokensfor crypto queries andtickersfor equities queries. Both may be present if the query spans domains.
Correlation Object
The correlation object describes how signals from multiple specialists align or conflict.
| Field | Type | Description |
|---|---|---|
alignment | string | Overall direction: bullish, bearish, neutral, or mixed |
score | number | Alignment score from -10 (max bearish) to +10 (max bullish) |
confirming | string[] | Signals that agree across specialists |
contradicting | string[] | Signals that conflict across specialists |
sizing_multiplier | number | Position sizing suggestion: 0.5 (low conviction) to 2.0 (high conviction) |
summary | string | Human-readable correlation summary |
A high
sizing_multiplier(above 1.5) indicates strong cross-specialist agreement. Values below 0.8 suggest conflicting signals — proceed with caution.
Streaming Response
When stream is true, the API returns a stream of Server-Sent Events (SSE).
# Crypto streaming example
curl -N -X POST https://api.marketintell.ai/v1/chat \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"message": "BTC whale activity analysis",
"stream": true
}'
# Equities streaming example
curl -N -X POST https://api.marketintell.ai/v1/chat \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"message": "AAPL earnings preview — what to expect?",
"stream": true
}'SSE Event Types
The exact set of events depends on which path the brain takes (fast agent vs. CoT pipeline vs. T3 supervisor). All paths terminate with a single done frame.
| Event | Path | Description |
|---|---|---|
tool_call_started | T1 fast agent | The agent has begun processing |
tool_call_completed | T1 fast agent | Agent processing finished, prose about to begin |
plan | All | Initial intent classification (intent + specialists) |
meta | T2 CoT | Early metadata (direction, confidence, convergence, fact/tension counts) emitted as soon as Steps 1–4 complete, before the prose stream begins |
specialist_started | T3 supervisor | A specialist agent began work |
specialist_completed | T3 supervisor | A specialist agent returned a verdict |
synthesis_started | T3 supervisor | The supervisor began synthesizing specialist outputs |
text_delta | All | A chunk of the response content |
done | All | Stream complete — includes session_id, specialists_used, latency_ms, and (for CoT) top-level direction / confidence / citedFacts |
error | All | An error occurred during processing |
Event Format
Each SSE event uses a named event: field and a JSON data: payload with an incrementing id::
event: tool_call_started
data: {"tool":"agent"}
id: 0
event: tool_call_completed
data: {"tool":"agent","latencyMs":2150}
id: 1
event: text_delta
data: {"delta":"## BTC Whale Activity\n\nLarge wallets have accumulated **12,400 BTC** in the past 48 hours..."}
id: 2
event: done
data: {"session_id":"a1b2c3d4-...","specialists_used":["technical","onchain"],"latency_ms":5120,"timestamp":"2025-01-15T14:22:00.000Z","direction":"bullish","confidence":0.74,"citedFacts":18}
id: 3For CoT-routed queries, the done payload includes top-level direction ("bullish" / "bearish" / "neutral"), confidence (0–1), and citedFacts. The legacy fast-agent path nests these under a correlation object instead — accept both shapes when integrating.
JavaScript Streaming Example
const response = await fetch("https://api.marketintell.ai/v1/chat", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY",
},
body: JSON.stringify({
message: "BTC whale activity analysis",
stream: true,
}),
});
const reader = response.body!.getReader();
const decoder = new TextDecoder();
let buffer = "";
let currentEvent = "";
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split("\n");
buffer = lines.pop() || "";
for (const line of lines) {
if (line.startsWith("event: ")) {
currentEvent = line.slice(7);
} else if (line.startsWith("data: ")) {
const data = JSON.parse(line.slice(6));
switch (currentEvent) {
case "tool_call_started":
console.log(`[Started] ${data.tool}`);
break;
case "tool_call_completed":
console.log(`[Completed] ${data.tool} in ${data.latencyMs}ms`);
break;
case "text_delta":
process.stdout.write(data.delta);
break;
case "done":
console.log("\n\nSpecialists:", data.specialists_used);
console.log("Latency:", data.latency_ms, "ms");
break;
case "error":
console.error("Error:", data.error);
break;
}
}
}
}Sessions
Pass a session_id to continue a conversation:
curl -X POST https://api.marketintell.ai/v1/chat \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"message": "What about the short-term outlook?",
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}'The pipeline retains context from previous messages in the session, enabling follow-up questions and multi-turn analysis.