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>'
import requests

url = "https://api.xpander.ai/v1/tasks/{task_id}/thread/full"

headers = {"x-api-key": "<api-key>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {'x-api-key': '<api-key>'}};

fetch('https://api.xpander.ai/v1/tasks/{task_id}/thread/full', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.xpander.ai/v1/tasks/{task_id}/thread/full",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"x-api-key: <api-key>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.xpander.ai/v1/tasks/{task_id}/thread/full"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("x-api-key", "<api-key>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.xpander.ai/v1/tasks/{task_id}/thread/full")
.header("x-api-key", "<api-key>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.xpander.ai/v1/tasks/{task_id}/thread/full")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-api-key"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "detail": [
    {
      "loc": [
        "<string>"
      ],
      "msg": "<string>",
      "type": "<string>"
    }
  ]
}
Retrieve the complete conversation thread for a task/thread ID, including the root conversation and any sub-task message buckets. This is the authoritative message-history endpoint for multi-turn conversations continued with the same invocation id.

Path Parameters

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

Response

Returns an object where root contains the main conversation and additional keys may appear for sub-task IDs:
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. The 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": "<task-id>_user_1",
      "role": "user",
      "content": "Reply with exactly FIRST",
      "created_at": 1774226722
    },
    {
      "id": "<task-id>_agent_1",
      "role": "assistant",
      "content": "FIRST",
      "created_at": 1774226726
    },
    {
      "id": "<task-id>_user_2",
      "role": "user",
      "content": "Reply with exactly SECOND",
      "created_at": 1774226726
    },
    {
      "id": "<task-id>_agent_2",
      "role": "assistant",
      "content": "SECOND",
      "created_at": 1774226730
    }
  ]
}

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)'
Print the root conversation:
curl -s -H "x-api-key: <your-api-key>" \
  "https://api.xpander.ai/v1/tasks/<task-id>/thread/full" | \
  jq '.root[] | "\(.role): \(.content)"'
Flatten all messages across root and sub-tasks:
curl -s -H "x-api-key: <your-api-key>" \
  "https://api.xpander.ai/v1/tasks/<task-id>/thread/full" | \
  jq 'to_entries | map(.value[]) | .[] | "\(.role): \(.content)"'

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
Multi-turn root conversation
Sub-task message buckets
Response structureArrayObject keyed by root and sub-task IDs

Notes

  • The root key contains the main conversation for the task/thread ID you requested
  • Continuing a conversation with the same invocation id appends new turns to root
  • Multi-agent or delegated runs can add extra keys for sub-task IDs
  • Messages are ordered chronologically within each task bucket

See Also

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

task_id
string
required

Response

Successful Response