curl --request POST \
--url https://api.egp.scale.com/v5/spans/export \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"parents_only": true,
"span_ids": [
"<string>"
],
"trace_ids": [
"<string>"
],
"excluded_span_ids": [
"<string>"
],
"excluded_trace_ids": [
"<string>"
],
"spans": [
{
"trace_id": "<string>",
"span_id": "<string>"
}
],
"excluded_spans": [
{
"trace_id": "<string>",
"span_id": "<string>"
}
],
"group_id": "<string>",
"parent_ids": [
"<string>"
],
"names": [
"<string>"
],
"statuses": [],
"types": [],
"search_texts": [
"<string>"
],
"extra_metadata": {},
"application_variant_ids": [
"<string>"
],
"assessment_types": [
"<string>"
],
"acp_types": [
"<string>"
],
"agentex_agent_names": [
"<string>"
],
"agentex_agent_ids": [
"<string>"
],
"obs_trace_ids": [
"<string>"
],
"obs_span_ids": [
"<string>"
],
"min_duration_ms": 123,
"max_duration_ms": 123,
"from_ts": "2023-11-07T05:31:56Z",
"to_ts": "2023-11-07T05:31:56Z",
"export_method": "direct",
"export_format": "json",
"with_children": false,
"include_assessments": false,
"staged_destination": {
"workspace_id": "<string>",
"grant": {}
},
"resume_after": "<string>"
}
'import requests
url = "https://api.egp.scale.com/v5/spans/export"
payload = {
"parents_only": True,
"span_ids": ["<string>"],
"trace_ids": ["<string>"],
"excluded_span_ids": ["<string>"],
"excluded_trace_ids": ["<string>"],
"spans": [
{
"trace_id": "<string>",
"span_id": "<string>"
}
],
"excluded_spans": [
{
"trace_id": "<string>",
"span_id": "<string>"
}
],
"group_id": "<string>",
"parent_ids": ["<string>"],
"names": ["<string>"],
"statuses": [],
"types": [],
"search_texts": ["<string>"],
"extra_metadata": {},
"application_variant_ids": ["<string>"],
"assessment_types": ["<string>"],
"acp_types": ["<string>"],
"agentex_agent_names": ["<string>"],
"agentex_agent_ids": ["<string>"],
"obs_trace_ids": ["<string>"],
"obs_span_ids": ["<string>"],
"min_duration_ms": 123,
"max_duration_ms": 123,
"from_ts": "2023-11-07T05:31:56Z",
"to_ts": "2023-11-07T05:31:56Z",
"export_method": "direct",
"export_format": "json",
"with_children": False,
"include_assessments": False,
"staged_destination": {
"workspace_id": "<string>",
"grant": {}
},
"resume_after": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
parents_only: true,
span_ids: ['<string>'],
trace_ids: ['<string>'],
excluded_span_ids: ['<string>'],
excluded_trace_ids: ['<string>'],
spans: [{trace_id: '<string>', span_id: '<string>'}],
excluded_spans: [{trace_id: '<string>', span_id: '<string>'}],
group_id: '<string>',
parent_ids: ['<string>'],
names: ['<string>'],
statuses: [],
types: [],
search_texts: ['<string>'],
extra_metadata: {},
application_variant_ids: ['<string>'],
assessment_types: ['<string>'],
acp_types: ['<string>'],
agentex_agent_names: ['<string>'],
agentex_agent_ids: ['<string>'],
obs_trace_ids: ['<string>'],
obs_span_ids: ['<string>'],
min_duration_ms: 123,
max_duration_ms: 123,
from_ts: '2023-11-07T05:31:56Z',
to_ts: '2023-11-07T05:31:56Z',
export_method: 'direct',
export_format: 'json',
with_children: false,
include_assessments: false,
staged_destination: {workspace_id: '<string>', grant: {}},
resume_after: '<string>'
})
};
fetch('https://api.egp.scale.com/v5/spans/export', 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.egp.scale.com/v5/spans/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'parents_only' => true,
'span_ids' => [
'<string>'
],
'trace_ids' => [
'<string>'
],
'excluded_span_ids' => [
'<string>'
],
'excluded_trace_ids' => [
'<string>'
],
'spans' => [
[
'trace_id' => '<string>',
'span_id' => '<string>'
]
],
'excluded_spans' => [
[
'trace_id' => '<string>',
'span_id' => '<string>'
]
],
'group_id' => '<string>',
'parent_ids' => [
'<string>'
],
'names' => [
'<string>'
],
'statuses' => [
],
'types' => [
],
'search_texts' => [
'<string>'
],
'extra_metadata' => [
],
'application_variant_ids' => [
'<string>'
],
'assessment_types' => [
'<string>'
],
'acp_types' => [
'<string>'
],
'agentex_agent_names' => [
'<string>'
],
'agentex_agent_ids' => [
'<string>'
],
'obs_trace_ids' => [
'<string>'
],
'obs_span_ids' => [
'<string>'
],
'min_duration_ms' => 123,
'max_duration_ms' => 123,
'from_ts' => '2023-11-07T05:31:56Z',
'to_ts' => '2023-11-07T05:31:56Z',
'export_method' => 'direct',
'export_format' => 'json',
'with_children' => false,
'include_assessments' => false,
'staged_destination' => [
'workspace_id' => '<string>',
'grant' => [
]
],
'resume_after' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.egp.scale.com/v5/spans/export"
payload := strings.NewReader("{\n \"parents_only\": true,\n \"span_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"excluded_span_ids\": [\n \"<string>\"\n ],\n \"excluded_trace_ids\": [\n \"<string>\"\n ],\n \"spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"excluded_spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"group_id\": \"<string>\",\n \"parent_ids\": [\n \"<string>\"\n ],\n \"names\": [\n \"<string>\"\n ],\n \"statuses\": [],\n \"types\": [],\n \"search_texts\": [\n \"<string>\"\n ],\n \"extra_metadata\": {},\n \"application_variant_ids\": [\n \"<string>\"\n ],\n \"assessment_types\": [\n \"<string>\"\n ],\n \"acp_types\": [\n \"<string>\"\n ],\n \"agentex_agent_names\": [\n \"<string>\"\n ],\n \"agentex_agent_ids\": [\n \"<string>\"\n ],\n \"obs_trace_ids\": [\n \"<string>\"\n ],\n \"obs_span_ids\": [\n \"<string>\"\n ],\n \"min_duration_ms\": 123,\n \"max_duration_ms\": 123,\n \"from_ts\": \"2023-11-07T05:31:56Z\",\n \"to_ts\": \"2023-11-07T05:31:56Z\",\n \"export_method\": \"direct\",\n \"export_format\": \"json\",\n \"with_children\": false,\n \"include_assessments\": false,\n \"staged_destination\": {\n \"workspace_id\": \"<string>\",\n \"grant\": {}\n },\n \"resume_after\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v5/spans/export")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"parents_only\": true,\n \"span_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"excluded_span_ids\": [\n \"<string>\"\n ],\n \"excluded_trace_ids\": [\n \"<string>\"\n ],\n \"spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"excluded_spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"group_id\": \"<string>\",\n \"parent_ids\": [\n \"<string>\"\n ],\n \"names\": [\n \"<string>\"\n ],\n \"statuses\": [],\n \"types\": [],\n \"search_texts\": [\n \"<string>\"\n ],\n \"extra_metadata\": {},\n \"application_variant_ids\": [\n \"<string>\"\n ],\n \"assessment_types\": [\n \"<string>\"\n ],\n \"acp_types\": [\n \"<string>\"\n ],\n \"agentex_agent_names\": [\n \"<string>\"\n ],\n \"agentex_agent_ids\": [\n \"<string>\"\n ],\n \"obs_trace_ids\": [\n \"<string>\"\n ],\n \"obs_span_ids\": [\n \"<string>\"\n ],\n \"min_duration_ms\": 123,\n \"max_duration_ms\": 123,\n \"from_ts\": \"2023-11-07T05:31:56Z\",\n \"to_ts\": \"2023-11-07T05:31:56Z\",\n \"export_method\": \"direct\",\n \"export_format\": \"json\",\n \"with_children\": false,\n \"include_assessments\": false,\n \"staged_destination\": {\n \"workspace_id\": \"<string>\",\n \"grant\": {}\n },\n \"resume_after\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v5/spans/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"parents_only\": true,\n \"span_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"excluded_span_ids\": [\n \"<string>\"\n ],\n \"excluded_trace_ids\": [\n \"<string>\"\n ],\n \"spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"excluded_spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"group_id\": \"<string>\",\n \"parent_ids\": [\n \"<string>\"\n ],\n \"names\": [\n \"<string>\"\n ],\n \"statuses\": [],\n \"types\": [],\n \"search_texts\": [\n \"<string>\"\n ],\n \"extra_metadata\": {},\n \"application_variant_ids\": [\n \"<string>\"\n ],\n \"assessment_types\": [\n \"<string>\"\n ],\n \"acp_types\": [\n \"<string>\"\n ],\n \"agentex_agent_names\": [\n \"<string>\"\n ],\n \"agentex_agent_ids\": [\n \"<string>\"\n ],\n \"obs_trace_ids\": [\n \"<string>\"\n ],\n \"obs_span_ids\": [\n \"<string>\"\n ],\n \"min_duration_ms\": 123,\n \"max_duration_ms\": 123,\n \"from_ts\": \"2023-11-07T05:31:56Z\",\n \"to_ts\": \"2023-11-07T05:31:56Z\",\n \"export_method\": \"direct\",\n \"export_format\": \"json\",\n \"with_children\": false,\n \"include_assessments\": false,\n \"staged_destination\": {\n \"workspace_id\": \"<string>\",\n \"grant\": {}\n },\n \"resume_after\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"filename": "<string>",
"signed_url": "<string>",
"content": "<string>"
}{
"export_id": "<string>",
"run_id": "<string>",
"window_truncated": true,
"effective_from_ts": "2023-11-07T05:31:56Z",
"effective_to_ts": "2023-11-07T05:31:56Z"
}{
"detail": "<string>",
"error_code": "TRACES_SERVICE_CONFIGURATION_ERROR"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>",
"error_code": "TRACES_SERVICE_CONFIGURATION_ERROR"
}Export spans
Export spans matching the given filters, either synchronously or as an async job.
For accounts on the tracing service the export runs as a
background job: the endpoint returns 202 with an export_id to poll via
GET /v5/spans/export/, and only signed_url output is supported
(a direct request is rejected with 422, and a request with no authorized
traces returns 403). For accounts still on the legacy trace store the export
is synchronous and returns 200 with either the raw content
(direct) or a pre-signed URL (signed_url); a signed_url request in
an environment without object storage returns 501, and requests filtering on
5000 or more trace ids are rejected with 422. A reversed time window (from_ts
after to_ts) is rejected with 422 on either path. Set with_children to
expand matched root spans to their full trace and include_assessments to
attach assessments inline.
x-project-id narrows the result to traces whose root span carries that project,
when PROJECT_SCOPED_SPAN_LISTING is on for the account, on either store.
curl --request POST \
--url https://api.egp.scale.com/v5/spans/export \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"parents_only": true,
"span_ids": [
"<string>"
],
"trace_ids": [
"<string>"
],
"excluded_span_ids": [
"<string>"
],
"excluded_trace_ids": [
"<string>"
],
"spans": [
{
"trace_id": "<string>",
"span_id": "<string>"
}
],
"excluded_spans": [
{
"trace_id": "<string>",
"span_id": "<string>"
}
],
"group_id": "<string>",
"parent_ids": [
"<string>"
],
"names": [
"<string>"
],
"statuses": [],
"types": [],
"search_texts": [
"<string>"
],
"extra_metadata": {},
"application_variant_ids": [
"<string>"
],
"assessment_types": [
"<string>"
],
"acp_types": [
"<string>"
],
"agentex_agent_names": [
"<string>"
],
"agentex_agent_ids": [
"<string>"
],
"obs_trace_ids": [
"<string>"
],
"obs_span_ids": [
"<string>"
],
"min_duration_ms": 123,
"max_duration_ms": 123,
"from_ts": "2023-11-07T05:31:56Z",
"to_ts": "2023-11-07T05:31:56Z",
"export_method": "direct",
"export_format": "json",
"with_children": false,
"include_assessments": false,
"staged_destination": {
"workspace_id": "<string>",
"grant": {}
},
"resume_after": "<string>"
}
'import requests
url = "https://api.egp.scale.com/v5/spans/export"
payload = {
"parents_only": True,
"span_ids": ["<string>"],
"trace_ids": ["<string>"],
"excluded_span_ids": ["<string>"],
"excluded_trace_ids": ["<string>"],
"spans": [
{
"trace_id": "<string>",
"span_id": "<string>"
}
],
"excluded_spans": [
{
"trace_id": "<string>",
"span_id": "<string>"
}
],
"group_id": "<string>",
"parent_ids": ["<string>"],
"names": ["<string>"],
"statuses": [],
"types": [],
"search_texts": ["<string>"],
"extra_metadata": {},
"application_variant_ids": ["<string>"],
"assessment_types": ["<string>"],
"acp_types": ["<string>"],
"agentex_agent_names": ["<string>"],
"agentex_agent_ids": ["<string>"],
"obs_trace_ids": ["<string>"],
"obs_span_ids": ["<string>"],
"min_duration_ms": 123,
"max_duration_ms": 123,
"from_ts": "2023-11-07T05:31:56Z",
"to_ts": "2023-11-07T05:31:56Z",
"export_method": "direct",
"export_format": "json",
"with_children": False,
"include_assessments": False,
"staged_destination": {
"workspace_id": "<string>",
"grant": {}
},
"resume_after": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
parents_only: true,
span_ids: ['<string>'],
trace_ids: ['<string>'],
excluded_span_ids: ['<string>'],
excluded_trace_ids: ['<string>'],
spans: [{trace_id: '<string>', span_id: '<string>'}],
excluded_spans: [{trace_id: '<string>', span_id: '<string>'}],
group_id: '<string>',
parent_ids: ['<string>'],
names: ['<string>'],
statuses: [],
types: [],
search_texts: ['<string>'],
extra_metadata: {},
application_variant_ids: ['<string>'],
assessment_types: ['<string>'],
acp_types: ['<string>'],
agentex_agent_names: ['<string>'],
agentex_agent_ids: ['<string>'],
obs_trace_ids: ['<string>'],
obs_span_ids: ['<string>'],
min_duration_ms: 123,
max_duration_ms: 123,
from_ts: '2023-11-07T05:31:56Z',
to_ts: '2023-11-07T05:31:56Z',
export_method: 'direct',
export_format: 'json',
with_children: false,
include_assessments: false,
staged_destination: {workspace_id: '<string>', grant: {}},
resume_after: '<string>'
})
};
fetch('https://api.egp.scale.com/v5/spans/export', 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.egp.scale.com/v5/spans/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'parents_only' => true,
'span_ids' => [
'<string>'
],
'trace_ids' => [
'<string>'
],
'excluded_span_ids' => [
'<string>'
],
'excluded_trace_ids' => [
'<string>'
],
'spans' => [
[
'trace_id' => '<string>',
'span_id' => '<string>'
]
],
'excluded_spans' => [
[
'trace_id' => '<string>',
'span_id' => '<string>'
]
],
'group_id' => '<string>',
'parent_ids' => [
'<string>'
],
'names' => [
'<string>'
],
'statuses' => [
],
'types' => [
],
'search_texts' => [
'<string>'
],
'extra_metadata' => [
],
'application_variant_ids' => [
'<string>'
],
'assessment_types' => [
'<string>'
],
'acp_types' => [
'<string>'
],
'agentex_agent_names' => [
'<string>'
],
'agentex_agent_ids' => [
'<string>'
],
'obs_trace_ids' => [
'<string>'
],
'obs_span_ids' => [
'<string>'
],
'min_duration_ms' => 123,
'max_duration_ms' => 123,
'from_ts' => '2023-11-07T05:31:56Z',
'to_ts' => '2023-11-07T05:31:56Z',
'export_method' => 'direct',
'export_format' => 'json',
'with_children' => false,
'include_assessments' => false,
'staged_destination' => [
'workspace_id' => '<string>',
'grant' => [
]
],
'resume_after' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.egp.scale.com/v5/spans/export"
payload := strings.NewReader("{\n \"parents_only\": true,\n \"span_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"excluded_span_ids\": [\n \"<string>\"\n ],\n \"excluded_trace_ids\": [\n \"<string>\"\n ],\n \"spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"excluded_spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"group_id\": \"<string>\",\n \"parent_ids\": [\n \"<string>\"\n ],\n \"names\": [\n \"<string>\"\n ],\n \"statuses\": [],\n \"types\": [],\n \"search_texts\": [\n \"<string>\"\n ],\n \"extra_metadata\": {},\n \"application_variant_ids\": [\n \"<string>\"\n ],\n \"assessment_types\": [\n \"<string>\"\n ],\n \"acp_types\": [\n \"<string>\"\n ],\n \"agentex_agent_names\": [\n \"<string>\"\n ],\n \"agentex_agent_ids\": [\n \"<string>\"\n ],\n \"obs_trace_ids\": [\n \"<string>\"\n ],\n \"obs_span_ids\": [\n \"<string>\"\n ],\n \"min_duration_ms\": 123,\n \"max_duration_ms\": 123,\n \"from_ts\": \"2023-11-07T05:31:56Z\",\n \"to_ts\": \"2023-11-07T05:31:56Z\",\n \"export_method\": \"direct\",\n \"export_format\": \"json\",\n \"with_children\": false,\n \"include_assessments\": false,\n \"staged_destination\": {\n \"workspace_id\": \"<string>\",\n \"grant\": {}\n },\n \"resume_after\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.egp.scale.com/v5/spans/export")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"parents_only\": true,\n \"span_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"excluded_span_ids\": [\n \"<string>\"\n ],\n \"excluded_trace_ids\": [\n \"<string>\"\n ],\n \"spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"excluded_spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"group_id\": \"<string>\",\n \"parent_ids\": [\n \"<string>\"\n ],\n \"names\": [\n \"<string>\"\n ],\n \"statuses\": [],\n \"types\": [],\n \"search_texts\": [\n \"<string>\"\n ],\n \"extra_metadata\": {},\n \"application_variant_ids\": [\n \"<string>\"\n ],\n \"assessment_types\": [\n \"<string>\"\n ],\n \"acp_types\": [\n \"<string>\"\n ],\n \"agentex_agent_names\": [\n \"<string>\"\n ],\n \"agentex_agent_ids\": [\n \"<string>\"\n ],\n \"obs_trace_ids\": [\n \"<string>\"\n ],\n \"obs_span_ids\": [\n \"<string>\"\n ],\n \"min_duration_ms\": 123,\n \"max_duration_ms\": 123,\n \"from_ts\": \"2023-11-07T05:31:56Z\",\n \"to_ts\": \"2023-11-07T05:31:56Z\",\n \"export_method\": \"direct\",\n \"export_format\": \"json\",\n \"with_children\": false,\n \"include_assessments\": false,\n \"staged_destination\": {\n \"workspace_id\": \"<string>\",\n \"grant\": {}\n },\n \"resume_after\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v5/spans/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"parents_only\": true,\n \"span_ids\": [\n \"<string>\"\n ],\n \"trace_ids\": [\n \"<string>\"\n ],\n \"excluded_span_ids\": [\n \"<string>\"\n ],\n \"excluded_trace_ids\": [\n \"<string>\"\n ],\n \"spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"excluded_spans\": [\n {\n \"trace_id\": \"<string>\",\n \"span_id\": \"<string>\"\n }\n ],\n \"group_id\": \"<string>\",\n \"parent_ids\": [\n \"<string>\"\n ],\n \"names\": [\n \"<string>\"\n ],\n \"statuses\": [],\n \"types\": [],\n \"search_texts\": [\n \"<string>\"\n ],\n \"extra_metadata\": {},\n \"application_variant_ids\": [\n \"<string>\"\n ],\n \"assessment_types\": [\n \"<string>\"\n ],\n \"acp_types\": [\n \"<string>\"\n ],\n \"agentex_agent_names\": [\n \"<string>\"\n ],\n \"agentex_agent_ids\": [\n \"<string>\"\n ],\n \"obs_trace_ids\": [\n \"<string>\"\n ],\n \"obs_span_ids\": [\n \"<string>\"\n ],\n \"min_duration_ms\": 123,\n \"max_duration_ms\": 123,\n \"from_ts\": \"2023-11-07T05:31:56Z\",\n \"to_ts\": \"2023-11-07T05:31:56Z\",\n \"export_method\": \"direct\",\n \"export_format\": \"json\",\n \"with_children\": false,\n \"include_assessments\": false,\n \"staged_destination\": {\n \"workspace_id\": \"<string>\",\n \"grant\": {}\n },\n \"resume_after\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"filename": "<string>",
"signed_url": "<string>",
"content": "<string>"
}{
"export_id": "<string>",
"run_id": "<string>",
"window_truncated": true,
"effective_from_ts": "2023-11-07T05:31:56Z",
"effective_to_ts": "2023-11-07T05:31:56Z"
}{
"detail": "<string>",
"error_code": "TRACES_SERVICE_CONFIGURATION_ERROR"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"detail": "<string>",
"error_code": "TRACES_SERVICE_CONFIGURATION_ERROR"
}Query Parameters
Body
TEXT_INPUT, TEXT_OUTPUT, COMPLETION_INPUT, COMPLETION, KB_RETRIEVAL, KB_INPUT, RERANKING, EXTERNAL_ENDPOINT, PROMPT_ENGINEERING, DOCUMENT_INPUT, MAP_REDUCE, DOCUMENT_SEARCH, DOCUMENT_PROMPT, CUSTOM, CODE_EXECUTION, DATA_MANIPULATION, EVALUATION, FILE_RETRIEVAL, KB_ADD_CHUNK, KB_MANAGEMENT, GUARDRAIL, OUTPUT_GUARDRAIL, TRACER, AGENT_TRACER, AGENT_WORKFLOW, STANDALONE Case-insensitive text search across span name, input, output, and metadata. A single-word term of ASCII letters and digits matches as a whole word in input, output, and metadata, and as a substring of the name. A term of up to 8 such words matches as a contiguous phrase whose words each appear as whole words. All other terms (punctuated, non-ASCII, longer) match as substrings, where mid-word fragments match and an inflected form such as a plural matches only where it appears literally. Wrapping a term in double quotes makes it a phrase: the quotes mark the phrase and are never matched, a backslash escapes a quote or a backslash inside them, the phrase must appear contiguously inside one searched value (the input, the output, or the metadata), a phrase of up to 8 ASCII letter-and-digit words additionally requires each of those words to appear there as a whole word, and a UUID-shaped phrase stays a text search. A term whose quote is unterminated or left unescaped mid-term is matched literally, quotes included. Multiple terms are ANDed, and UUID-shaped terms match trace IDs instead. A span must match every non-UUID term, and each term may match any of the searched fields. UUID matches are ORed onto the text match. Each term must be at least 2 characters, measured between the quotes and ignoring outer whitespace for a phrase, and at most 10 terms are supported. For exact trace ID lookup, use the trace_ids filter. The tracing service runs on either ClickHouse or Postgres, and the two engines match differently. On Postgres deployments the whole-word match uses the simple text-search parser, which keeps hosts, e-mail addresses, file paths, version strings, hyphenated compounds, URLs and query strings as single words (https://x.com/path?q=1 yields x.com/path?q=1, x.com and /path?q=1, never path, q or 1; user@example.com and v1.2.3 are one word each; gpt-4o yields the compound and its parts), whereas ClickHouse deployments split on every non-alphanumeric ASCII byte. A single word inside such a value is a whole-word hit on ClickHouse and a miss on Postgres; the substring forms behave identically on both. On Postgres deployments a value over 80000 bytes has only its first 20000 characters indexed for whole-word matching; text past that is reachable only by the substring forms. Words longer than 2047 bytes are matched as substrings, never as whole words. Case folding of non-ASCII text follows the database's LC_CTYPE on Postgres deployments, for the whole-word index, the quoted-phrase and substring forms and the word-boundary check alike; under a C-locale database non-ASCII letters are not folded. ASCII folds everywhere. Input and output behave identically on both engines. A substring-form term, or a text-filtered metrics request, reads every row of the time window that survives the other filters. A term that matches too many rows in the window is refused by the tracing service as QUERY_TOO_BROAD, at an engine-specific threshold, and on Postgres deployments a read whose sorts or hashes, the text candidate sets included, outgrow the deployment's work memory and its temp-file bound is refused as QUERY_TEMP_FILE_LIMIT_EXCEEDED, a code ClickHouse deployments never return and one a read without text can also earn. This API relays either refusal as a 400 carrying the tracing service's detail, never as a page from the legacy trace store, and an export's refusal is reported as the failed export's reason on the export status, not on the POST. On Postgres deployments each term is counted on its own, in every class (whole word, phrase and substring alike) and on every read that carries text, and is refused when it alone matches more than 50000 rows of the window that survive the other filters, with or without assessment_types. On ClickHouse deployments the refusal is the candidate-set cap, a deployment-configured limit counted over the matches of all terms together: a search page bounds its candidates to the page, so there the cap is a backstop rather than a limit a common term meets; metrics and by-span resolve every match and can trip it; and an export runs under its own 2000000-row set cap on every request, assessment_types included. Accounts still served by the legacy trace store match differently until migrated: every term matches as stemmed whole words (so inflected forms match and multi-word terms match word-adjacent), only input and output are searched, the 2-character minimum is not enforced, quoting a term changes nothing (the quotes are stripped and a multi-word term is already matched word-adjacent), and characters like :, |, or ! inside a term may be interpreted as query operators or cause an error.
Filter on custom metadata: each key must equal its value, or any value of an array, and keys are ANDed. On the ClickHouse read path $or and $and also compose nested groups of predicates. On Postgres a $-prefixed key is an ordinary metadata key matched literally. Array values match element-wise; a negative zero inside an array equals zero on Postgres-served accounts and not on ClickHouse-served ones.
Filter to the business spans that executed in any of these observability traces (the obs-to-business reverse lookup). Each id must be 32 lowercase hex characters. Served only by the sgp-traces service, so a request using this filter against an account still on the legacy store returns 422 rather than silently ignoring it.
Filter to the business spans that executed in any of these observability spans. Each id must be 16 lowercase hex characters. A W3C span id is unique per trace only, so combine with obs_trace_ids for exact identity, the same looseness span_ids carries versus the spans pair filter. ANDs with obs_trace_ids when both are set. Served only by the sgp-traces service, so a request using this filter against an account still on the legacy store returns 422 rather than silently ignoring it.
The format of the exported spans. json is a single JSON array and jsonl one JSON object per span per line (both flat); trace_jsonl is trace-grouped, one line per trace {trace_id, spans:[...]} with the trace's spans in pre-order DFS (reconstruct the tree from parent_id); trace_jsonl cannot be combined with include_assessments. trace_jsonl also excludes spans with an empty trace_id (they cannot be grouped), so its row count may be lower than jsonl's, and any single trace exceeding the internal size cap is emitted truncated with "truncated": true.
json, jsonl, csv, trace_jsonl Opaque token from a truncated export's status (truncated.resume_after). Send it with the identical filters, window, format and options to export the rows after the truncation point as a new async export. A token minted for a different request or account is rejected. If the first page reported window_truncated, resend its effective_from_ts and effective_to_ts as from_ts and to_ts, since the token covers the exact window. Async ClickHouse path only.
Response
Successful Response
200 response for the synchronous Postgres export of POST /v5/spans/export.
filename is always set; signed_url or content carries the result
depending on the export method. The async sgp-traces export uses the separate
202 SpansExportAcceptedResponse shape instead.