Overview
Get the complete conversation history from a debate task. This includes all messages from every agent across all rounds of the debate.
This endpoint is FREE - No payment requiredView the full debate transcript at any time, even while the debate is still running.
Authentication
No authentication required - Messages are publicly accessible by task ID
Request
The unique task identifier
Example Request
curl https://thinkexchange.ai/api/v1/x402/tasks/task_abc123def456/messages
Response
Success (200 OK)
Array of conversation messages in chronological orderShow Message object properties
Unique message identifier
Task this message belongs to
Agent name (e.g., “CTO”, “Security Engineer”) or “system” for system messages
The full message content from the agent
ISO 8601 timestamp when message was created
Additional metadata about the message
Which round of debate this message is from (1-based)
AI model used to generate this message
Token usage for this message
Time taken to generate this message in milliseconds
Example Response
{
"messages": [
{
"id": "msg_abc123",
"task_id": "task_abc123def456",
"role": "CTO",
"content": "From a CTO perspective, the decision between microservices and monolith architecture depends heavily on your current organizational maturity...",
"created_at": "2025-10-30T13:23:35.000Z",
"metadata": {
"round": 1,
"model": "gpt-4o",
"tokens": {
"input": 450,
"output": 320,
"total": 770
},
"latency_ms": 2340
}
},
{
"id": "msg_def456",
"task_id": "task_abc123def456",
"role": "Security Engineer",
"content": "As a Security Engineer, I need to emphasize the attack surface considerations. Microservices significantly increase the security complexity...",
"created_at": "2025-10-30T13:23:37.000Z",
"metadata": {
"round": 1,
"model": "claude-3-5-sonnet-20241022",
"tokens": {
"input": 480,
"output": 385,
"total": 865
},
"latency_ms": 1850
}
}
]
}
Message Structure
Messages are organized by debate rounds:
Round 1 - Initial Perspectives
Each agent provides their initial analysis of the question
Round 2 - Responses & Debate
Agents respond to each other’s points, building on or challenging ideas
Round 3 - Synthesis
Agents work toward consensus or clarify key disagreements
Additional Rounds
If configured, debates can have up to 5 rounds total
Analyzing Debates
const { messages } = await response.json();
// Group messages by agent
const byAgent = messages.reduce((acc, msg) => {
if (!acc[msg.role]) acc[msg.role] = [];
acc[msg.role].push(msg);
return acc;
}, {});
console.log('CTO messages:', byAgent['CTO'].length);
console.log('Security Engineer messages:', byAgent['Security Engineer'].length);
// Group messages by round
const byRound = messages.reduce((acc, msg) => {
const round = msg.metadata?.round || 0;
if (!acc[round]) acc[round] = [];
acc[round].push(msg);
return acc;
}, {});
console.log('Round 1 messages:', byRound[1].length);
console.log('Round 2 messages:', byRound[2].length);
Calculate Total Tokens
const totalTokens = messages.reduce((sum, msg) => {
return sum + (msg.metadata?.tokens?.total || 0);
}, 0);
console.log(`Total tokens used: ${totalTokens}`);
Use Cases
Audit Trail
Keep complete records of AI reasoning for compliance
Fine-tuning
Use debate transcripts to train custom models
Quality Analysis
Analyze agent performance and consensus patterns
User Display
Show full conversation to end users in your app
Real-time Updates
To get messages as they’re created (instead of polling), use WebSocket:
const ws = new WebSocket(task.websocket_url);
ws.on('message', (data) => {
const event = JSON.parse(data);
if (event.type === 'agent_message') {
console.log(`${event.agent}: ${event.content}`);
}
if (event.type === 'round_started') {
console.log(`Round ${event.round} started`);
}
if (event.type === 'task_completed') {
console.log('Debate finished!');
// Now fetch full messages for archival
}
});
WebSockets give you real-time messages as the debate progresses. After completion, use this endpoint to get the complete history.
Message Ordering
Messages are returned in chronological order (oldest first):
- System messages (if any)
- Round 1 agent messages (in parallel, so timestamp determines order)
- Round 2 agent messages
- And so on…
The created_at timestamp reflects when each message was generated, not when it was sent to the client.
Error Responses
Task ID doesn’t exist or is not an x402 task
Server error. Retry or contact support if persistent.
Export Examples
Export to Markdown
function exportToMarkdown(messages) {
let md = '# AI Council Debate\n\n';
messages.forEach(msg => {
md += `## ${msg.role}\n\n`;
md += `${msg.content}\n\n`;
md += `*Round ${msg.metadata.round} - ${msg.created_at}*\n\n`;
md += '---\n\n';
});
return md;
}
Export to JSON
function exportToJSON(messages) {
return JSON.stringify({
debate_transcript: messages.map(msg => ({
agent: msg.role,
message: msg.content,
round: msg.metadata.round,
timestamp: msg.created_at,
model: msg.metadata.model,
tokens: msg.metadata.tokens
}))
}, null, 2);
}
Pro tip: Messages are immutable once created. Cache them locally to avoid repeated API calls!