curl --request POST \
--url https://api.galtea.ai/traces/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"traces": [
{
"inferenceResultId": "ir_123",
"name": "<string>",
"id": "id_123",
"description": "Example Name",
"inputData": {},
"outputData": {},
"error": "Error message",
"latencyMs": 123,
"metadata": {},
"parentTraceId": "<string>",
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z"
}
]
}
'import requests
url = "https://api.galtea.ai/traces/batch"
payload = { "traces": [
{
"inferenceResultId": "ir_123",
"name": "<string>",
"id": "id_123",
"description": "Example Name",
"inputData": {},
"outputData": {},
"error": "Error message",
"latencyMs": 123,
"metadata": {},
"parentTraceId": "<string>",
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
traces: [
{
inferenceResultId: 'ir_123',
name: '<string>',
id: 'id_123',
description: 'Example Name',
inputData: {},
outputData: {},
error: 'Error message',
latencyMs: 123,
metadata: {},
parentTraceId: '<string>',
startTime: '2023-11-07T05:31:56Z',
endTime: '2023-11-07T05:31:56Z'
}
]
})
};
fetch('https://api.galtea.ai/traces/batch', 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.galtea.ai/traces/batch",
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([
'traces' => [
[
'inferenceResultId' => 'ir_123',
'name' => '<string>',
'id' => 'id_123',
'description' => 'Example Name',
'inputData' => [
],
'outputData' => [
],
'error' => 'Error message',
'latencyMs' => 123,
'metadata' => [
],
'parentTraceId' => '<string>',
'startTime' => '2023-11-07T05:31:56Z',
'endTime' => '2023-11-07T05:31:56Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.galtea.ai/traces/batch"
payload := strings.NewReader("{\n \"traces\": [\n {\n \"inferenceResultId\": \"ir_123\",\n \"name\": \"<string>\",\n \"id\": \"id_123\",\n \"description\": \"Example Name\",\n \"inputData\": {},\n \"outputData\": {},\n \"error\": \"Error message\",\n \"latencyMs\": 123,\n \"metadata\": {},\n \"parentTraceId\": \"<string>\",\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.galtea.ai/traces/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"traces\": [\n {\n \"inferenceResultId\": \"ir_123\",\n \"name\": \"<string>\",\n \"id\": \"id_123\",\n \"description\": \"Example Name\",\n \"inputData\": {},\n \"outputData\": {},\n \"error\": \"Error message\",\n \"latencyMs\": 123,\n \"metadata\": {},\n \"parentTraceId\": \"<string>\",\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/traces/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"traces\": [\n {\n \"inferenceResultId\": \"ir_123\",\n \"name\": \"<string>\",\n \"id\": \"id_123\",\n \"description\": \"Example Name\",\n \"inputData\": {},\n \"outputData\": {},\n \"error\": \"Error message\",\n \"latencyMs\": 123,\n \"metadata\": {},\n \"parentTraceId\": \"<string>\",\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"id": "trace_123",
"inferenceResultId": "ir_123",
"name": "fetch_user_data",
"type": "TOOL",
"description": "Fetches user data from the database by ID",
"inputData": {
"user_id": "123"
},
"outputData": {
"name": "John Doe",
"email": "john@example.com"
},
"error": "Connection timeout",
"latencyMs": 45.5,
"metadata": {
"model": "gpt-4",
"temperature": 0.7
},
"parentTraceId": "trace_parent_123",
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
}
]{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}Create spans batch
Create multiple spans in a single API call. Partial success, not all-or-nothing: a span refused for a data problem (empty name, negative latency, oversize payload, unknown trace) does not stop its siblings, and its trace records how many of its spans were dropped. Set includeRejected=true to read which spans were refused. A span you are not allowed to write is the one exception and refuses the whole batch with a 403. See Spans. These endpoints serve spans, the steps inside a trace. Their REST path /traces keeps the old name of this entity.
curl --request POST \
--url https://api.galtea.ai/traces/batch \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"traces": [
{
"inferenceResultId": "ir_123",
"name": "<string>",
"id": "id_123",
"description": "Example Name",
"inputData": {},
"outputData": {},
"error": "Error message",
"latencyMs": 123,
"metadata": {},
"parentTraceId": "<string>",
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z"
}
]
}
'import requests
url = "https://api.galtea.ai/traces/batch"
payload = { "traces": [
{
"inferenceResultId": "ir_123",
"name": "<string>",
"id": "id_123",
"description": "Example Name",
"inputData": {},
"outputData": {},
"error": "Error message",
"latencyMs": 123,
"metadata": {},
"parentTraceId": "<string>",
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z"
}
] }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
traces: [
{
inferenceResultId: 'ir_123',
name: '<string>',
id: 'id_123',
description: 'Example Name',
inputData: {},
outputData: {},
error: 'Error message',
latencyMs: 123,
metadata: {},
parentTraceId: '<string>',
startTime: '2023-11-07T05:31:56Z',
endTime: '2023-11-07T05:31:56Z'
}
]
})
};
fetch('https://api.galtea.ai/traces/batch', 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.galtea.ai/traces/batch",
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([
'traces' => [
[
'inferenceResultId' => 'ir_123',
'name' => '<string>',
'id' => 'id_123',
'description' => 'Example Name',
'inputData' => [
],
'outputData' => [
],
'error' => 'Error message',
'latencyMs' => 123,
'metadata' => [
],
'parentTraceId' => '<string>',
'startTime' => '2023-11-07T05:31:56Z',
'endTime' => '2023-11-07T05:31:56Z'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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.galtea.ai/traces/batch"
payload := strings.NewReader("{\n \"traces\": [\n {\n \"inferenceResultId\": \"ir_123\",\n \"name\": \"<string>\",\n \"id\": \"id_123\",\n \"description\": \"Example Name\",\n \"inputData\": {},\n \"outputData\": {},\n \"error\": \"Error message\",\n \"latencyMs\": 123,\n \"metadata\": {},\n \"parentTraceId\": \"<string>\",\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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.galtea.ai/traces/batch")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"traces\": [\n {\n \"inferenceResultId\": \"ir_123\",\n \"name\": \"<string>\",\n \"id\": \"id_123\",\n \"description\": \"Example Name\",\n \"inputData\": {},\n \"outputData\": {},\n \"error\": \"Error message\",\n \"latencyMs\": 123,\n \"metadata\": {},\n \"parentTraceId\": \"<string>\",\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.galtea.ai/traces/batch")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"traces\": [\n {\n \"inferenceResultId\": \"ir_123\",\n \"name\": \"<string>\",\n \"id\": \"id_123\",\n \"description\": \"Example Name\",\n \"inputData\": {},\n \"outputData\": {},\n \"error\": \"Error message\",\n \"latencyMs\": 123,\n \"metadata\": {},\n \"parentTraceId\": \"<string>\",\n \"startTime\": \"2023-11-07T05:31:56Z\",\n \"endTime\": \"2023-11-07T05:31:56Z\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body[
{
"id": "trace_123",
"inferenceResultId": "ir_123",
"name": "fetch_user_data",
"type": "TOOL",
"description": "Fetches user data from the database by ID",
"inputData": {
"user_id": "123"
},
"outputData": {
"name": "John Doe",
"email": "john@example.com"
},
"error": "Connection timeout",
"latencyMs": 45.5,
"metadata": {
"model": "gpt-4",
"temperature": 0.7
},
"parentTraceId": "trace_parent_123",
"startTime": "2023-11-07T05:31:56Z",
"endTime": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"deletedAt": "2023-11-07T05:31:56Z"
}
]{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}{
"error": "Error type",
"message": "Error message description"
}Authorizations
Query Parameters
Body
Response
At least one span was created. The default body is the bare array of created spans; with includeRejected=true it is the object form. Each parentTraceId is the value the span was stored with: a span whose parent arrives in a concurrent request can be attached after this body is built, so read the span back to see the settled parent.
- object[]
- object
A span: one step inside a trace, such as a tool call, a retrieval or an LLM call. The schema name and the /traces path still carry the old name of this entity, "trace". The parent trace is inferenceResultId; the parentTraceId field is the parent span, not the trace. Span ids start with trace_, so a trace_ id belongs here and never to a trace.