Skip to main content
GET
/
api
/
v1
/
x402
/
tasks
/
{id}
Get Task Status
curl --request GET \
  --url https://thinkexchange.ai/api/v1/x402/tasks/{id}
{
  "404": {},
  "500": {},
  "id": "<string>",
  "room_id": "<string>",
  "status": "<string>",
  "user_prompt": "<string>",
  "created_at": "<string>",
  "updated_at": "<string>",
  "payment_method": "<string>",
  "result": {
    "summary": "<string>",
    "consensus": "<string>",
    "disagreements": [
      {}
    ],
    "recommendations": [
      {}
    ],
    "confidence": "<string>",
    "perspectives": {}
  }
}

Overview

Get the current status and results of a debate task. Poll this endpoint to check if your debate has completed.
This endpoint is FREE - No payment requiredUse this to monitor task progress after creation.

Authentication

No authentication required - Tasks are publicly accessible by ID

Request

id
string
required
The unique task identifier returned when creating the task

Example Request

curl https://thinkexchange.ai/api/v1/x402/tasks/task_abc123def456

Response

Success (200 OK)

id
string
Unique task identifier
room_id
string
ID of the council room used
status
string
Current task status:
  • pending - Task created, waiting to start
  • in_progress - Debate is currently running
  • completed - Debate finished successfully
  • failed - Task failed (error details in response)
user_prompt
string
The original question/prompt submitted
created_at
string
ISO 8601 timestamp of task creation
updated_at
string
ISO 8601 timestamp of last update
payment_method
string
Payment method used: x402
result
object
Only present when status is completedContains the final debate results

Example Response (In Progress)

{
  "id": "task_abc123def456",
  "room_id": "room_tech_leadership_001",
  "status": "in_progress",
  "user_prompt": "Should we use microservices or monolithic architecture?",
  "created_at": "2025-10-30T13:23:28.000Z",
  "updated_at": "2025-10-30T13:23:45.000Z",
  "payment_method": "x402"
}

Example Response (Completed)

{
  "id": "task_abc123def456",
  "room_id": "room_tech_leadership_001",
  "status": "completed",
  "user_prompt": "Should we use microservices or monolithic architecture?",
  "created_at": "2025-10-30T13:23:28.000Z",
  "updated_at": "2025-10-30T13:25:10.000Z",
  "payment_method": "x402",
  "result": {
    "summary": "The council recommends starting with a modular monolith and migrating to microservices only when clear scaling needs emerge.",
    "consensus": "Starting with a monolith is lower risk for new projects. Microservices add operational complexity that may not be justified initially.",
    "disagreements": [
      "Innovation Lead advocates for microservices to enable faster iteration",
      "Security Engineer concerned about increased attack surface with microservices"
    ],
    "recommendations": [
      "Begin with a well-structured modular monolith",
      "Design with clear domain boundaries for future service extraction",
      "Set concrete metrics (team size, request volume) to trigger migration",
      "Invest in observability infrastructure early"
    ],
    "confidence": "high",
    "perspectives": {
      "CTO": "Focus on time-to-market and team velocity. Monolith enables faster initial delivery.",
      "Security Engineer": "Monolith has smaller attack surface and simpler security model to audit.",
      "Solutions Architect": "Modular monolith provides flexibility without distributed system complexity.",
      "DevOps Lead": "Deployment, monitoring, and debugging are significantly simpler with monolith.",
      "Innovation Lead": "Microservices enable independent scaling and technology choices per service."
    }
  }
}

Polling Strategy

1

Create task

Create task and store the task ID
2

Wait initial delay

Wait 5-10 seconds before first poll (gives debate time to start)
3

Poll periodically

Check status every 3-5 seconds until completed or failed
4

Handle completion

When status is completed, retrieve the result object

Example Polling Code

async function waitForCompletion(taskId, maxWaitMs = 120000) {
  const startTime = Date.now();
  const pollInterval = 3000; // 3 seconds

  while (Date.now() - startTime < maxWaitMs) {
    const response = await fetch(`https://thinkexchange.ai/api/v1/x402/tasks/${taskId}`);
    const task = await response.json();

    console.log(`Status: ${task.status}`);

    if (task.status === 'completed') {
      return task.result;
    }

    if (task.status === 'failed') {
      throw new Error('Task failed');
    }

    // Wait before next poll
    await new Promise(resolve => setTimeout(resolve, pollInterval));
  }

  throw new Error('Task timeout');
}

// Usage
const result = await waitForCompletion('task_id_here');
console.log('Debate completed:', result.summary);
Don’t poll too frequently!Recommended: 3-5 seconds between requestsExcessive polling may hit rate limits (100 req/min)

Typical Completion Times

Simple Questions

30-60 secondsStraightforward technical questions

Complex Debates

60-90 secondsArchitecture decisions, trade-off analysis

Maximum

120 secondsHard timeout enforced

WebSocket Alternative

Instead of polling, you can connect to the WebSocket URL returned when creating the task:
const ws = new WebSocket(task.websocket_url);

ws.on('message', (data) => {
  const event = JSON.parse(data);

  if (event.type === 'task_completed') {
    console.log('Debate finished!', event.result);
  }

  if (event.type === 'agent_message') {
    console.log(`${event.agent}: ${event.content}`);
  }
});
WebSockets provide real-time updates without polling overhead. See WebSocket documentation for details.

Error Responses

404
Not Found
Task ID doesn’t exist or is not an x402 task
500
Internal Server Error
Server error. Retry or contact support if persistent.
Pro tip: Store task IDs in your database to review past debates and track spending!