Get Trace or Span Detail
curl --request GET \
--url https://api.example.com/traces/{trace_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/traces/{trace_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/traces/{trace_id}', 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.example.com/traces/{trace_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.example.com/traces/{trace_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/traces/{trace_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/traces/{trace_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"trace_id": "a1b2c3d4",
"name": "Stock_Price_Agent.run",
"status": "OK",
"duration": "1.2s",
"start_time": "2025-11-19T10:30:00.000000+00:00",
"end_time": "2025-11-19T10:30:01.200000+00:00",
"total_spans": 4,
"error_count": 0,
"input": "What is Tesla stock price?",
"output": "The current price of Tesla (TSLA) is $245.67.",
"run_id": "run123",
"session_id": "session456",
"user_id": "user789",
"agent_id": "stock_agent",
"created_at": "2025-11-19T10:30:00+00:00",
"tree": [
{
"id": "span1",
"name": "Stock_Price_Agent.run",
"type": "AGENT",
"duration": "1.2s",
"status": "OK",
"spans": []
}
]
}Traces
Get Trace or Span Detail
Retrieve detailed trace information with hierarchical span tree, or a specific span within the trace.
Without span_id parameter: Returns the full trace with hierarchical span tree:
- Trace metadata (ID, status, duration, context)
- Hierarchical tree of all spans
- Each span includes timing, status, and type-specific metadata
With span_id parameter: Returns details for a specific span within the trace:
- Span metadata (ID, name, type, timing)
- Status and error information
- Type-specific attributes (model, tokens, tool params, etc.)
Span Hierarchy (full trace):
The tree field contains root spans, each with potential children.
This recursive structure represents the execution flow:
Agent.run (root)
├─ LLM.invoke
├─ Tool.execute
│ └─ LLM.invoke (nested)
└─ LLM.invoke
Span Types:
AGENT: Agent execution with input/outputLLM: Model invocations with tokens and promptsTOOL: Tool calls with parameters and results
GET
/
traces
/
{trace_id}
Get Trace or Span Detail
curl --request GET \
--url https://api.example.com/traces/{trace_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.example.com/traces/{trace_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.example.com/traces/{trace_id}', 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.example.com/traces/{trace_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$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.example.com/traces/{trace_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
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.example.com/traces/{trace_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/traces/{trace_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"trace_id": "a1b2c3d4",
"name": "Stock_Price_Agent.run",
"status": "OK",
"duration": "1.2s",
"start_time": "2025-11-19T10:30:00.000000+00:00",
"end_time": "2025-11-19T10:30:01.200000+00:00",
"total_spans": 4,
"error_count": 0,
"input": "What is Tesla stock price?",
"output": "The current price of Tesla (TSLA) is $245.67.",
"run_id": "run123",
"session_id": "session456",
"user_id": "user789",
"agent_id": "stock_agent",
"created_at": "2025-11-19T10:30:00+00:00",
"tree": [
{
"id": "span1",
"name": "Stock_Price_Agent.run",
"type": "AGENT",
"duration": "1.2s",
"status": "OK",
"spans": []
}
]
}Authorizations
Query Parameters
Response
Trace or span detail retrieved successfully
- TraceDetail
- TraceNode
Detailed trace information with hierarchical span tree
Was this page helpful?