Skip to main content
GET
/
v1
/
tasks
/
{task_id}
/
thread
/
full
Get Task'S Full Thread
curl --request GET \
  --url https://api.xpander.ai/v1/tasks/{task_id}/thread/full \
  --header 'x-api-key: <api-key>'
[
  {
    "role": "user",
    "content": "How do I reset my password?"
  },
  {
    "role": "assistant",
    "content": "To reset your password, visit the login page and click 'Forgot Password'. You'll receive a reset link via email.",
    "tool_calls": []
  }
]
Retrieve the complete conversation thread for a task including all messages from the root task and all sub-tasks. Returns a nested object structure with tool calls and internal routing visible. This endpoint is particularly useful for debugging multi-agent workflows.

Path Parameters

task_id
string
required
Unique identifier of the task (UUID format)

Response

Returns a nested object where each key is either root (for the main task) or a sub-task UUID:
root
array
Array of messages from the root task
[sub_task_id]
array
For each sub-task, an array of messages with the same structure as root. Key is the UUID of the sub-task.

Example Request

curl -X GET -H "x-api-key: <your-api-key>" \
  "https://api.xpander.ai/v1/tasks/<task-id>/thread/full"

Example Response

{
  "root": [
    {
      "id": "7479540a-92ca-4e39-86f4-ad2340988919",
      "role": "user",
      "content": "What is xpander.ai?",
      "metrics": {
        "input_tokens": 0,
        "output_tokens": 0,
        "total_tokens": 0
      },
      "created_at": 1770430379
    },
    {
      "id": "5a7c3386-25d2-441a-afaf-cd4b6805c514",
      "role": "assistant",
      "content": "xpander.ai is a full-stack agent platform...",
      "metrics": {
        "input_tokens": 9828,
        "output_tokens": 664,
        "total_tokens": 10492
      },
      "created_at": 1770430379
    }
  ]
}

Parsing Examples

Get all task IDs (root + sub-tasks):
curl -s -H "x-api-key: <your-api-key>" \
  "https://api.xpander.ai/v1/tasks/<task-id>/thread/full" | \
  jq 'keys'
Count messages in each task:
curl -s -H "x-api-key: <your-api-key>" \
  "https://api.xpander.ai/v1/tasks/<task-id>/thread/full" | \
  jq 'map_values(length)'
Calculate total tokens across all tasks:
curl -s -H "x-api-key: <your-api-key>" \
  "https://api.xpander.ai/v1/tasks/<task-id>/thread/full" | \
  jq '[.. | .metrics?.total_tokens? // 0] | add'
Extract system messages:
curl -s -H "x-api-key: <your-api-key>" \
  "https://api.xpander.ai/v1/tasks/<task-id>/thread/full" | \
  jq '.[] | .[] | select(.role == "system")'

Use Cases

  • Debug multi-agent workflows - See the complete execution tree with all sub-agents
  • Analyze token usage - Track token consumption across all sub-tasks and calculate costs
  • Audit conversations - Review complete interaction history including internal routing
  • Performance analysis - Measure response times and token efficiency per sub-task
  • Troubleshoot failures - See all tool calls and system messages that led to errors

Comparison with /thread Endpoint

Feature/thread/thread/full
Root task messages
Sub-task messages
Token metrics
Tool call details
System messages
Response structureSimple arrayNested object

Notes

  • This endpoint includes all sub-tasks spawned by the root task
  • Each sub-task has its own message array keyed by its UUID
  • The root key always contains the main task’s conversation
  • Token metrics help you track and forecast LLM API costs
  • Messages are ordered chronologically within each task

See Also

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

task_id
string
required

Response

Successful Response