Export OTLP traces
curl --request POST \
--url https://api.zespan.com/v1/traces \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"resourceSpans": [
{
"resource": {
"attributes": [
{
"key": "gen_ai.system",
"value": {}
}
]
},
"scopeSpans": [
{
"scope": {
"name": "<string>",
"version": "<string>"
},
"spans": [
{
"traceId": "<string>",
"spanId": "<string>",
"name": "chat.completions",
"startTimeUnixNano": "1751716800000000000",
"parentSpanId": "<string>",
"kind": 123,
"endTimeUnixNano": "<string>",
"attributes": [
{
"key": "gen_ai.system",
"value": {}
}
],
"status": {
"code": 123,
"message": "<string>"
}
}
]
}
]
}
]
}
'import requests
url = "https://api.zespan.com/v1/traces"
payload = { "resourceSpans": [
{
"resource": { "attributes": [
{
"key": "gen_ai.system",
"value": {}
}
] },
"scopeSpans": [
{
"scope": {
"name": "<string>",
"version": "<string>"
},
"spans": [
{
"traceId": "<string>",
"spanId": "<string>",
"name": "chat.completions",
"startTimeUnixNano": "1751716800000000000",
"parentSpanId": "<string>",
"kind": 123,
"endTimeUnixNano": "<string>",
"attributes": [
{
"key": "gen_ai.system",
"value": {}
}
],
"status": {
"code": 123,
"message": "<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({
resourceSpans: [
{
resource: {attributes: [{key: 'gen_ai.system', value: {}}]},
scopeSpans: [
{
scope: {name: '<string>', version: '<string>'},
spans: [
{
traceId: '<string>',
spanId: '<string>',
name: 'chat.completions',
startTimeUnixNano: '1751716800000000000',
parentSpanId: '<string>',
kind: 123,
endTimeUnixNano: '<string>',
attributes: [{key: 'gen_ai.system', value: {}}],
status: {code: 123, message: '<string>'}
}
]
}
]
}
]
})
};
fetch('https://api.zespan.com/v1/traces', 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.zespan.com/v1/traces",
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([
'resourceSpans' => [
[
'resource' => [
'attributes' => [
[
'key' => 'gen_ai.system',
'value' => [
]
]
]
],
'scopeSpans' => [
[
'scope' => [
'name' => '<string>',
'version' => '<string>'
],
'spans' => [
[
'traceId' => '<string>',
'spanId' => '<string>',
'name' => 'chat.completions',
'startTimeUnixNano' => '1751716800000000000',
'parentSpanId' => '<string>',
'kind' => 123,
'endTimeUnixNano' => '<string>',
'attributes' => [
[
'key' => 'gen_ai.system',
'value' => [
]
]
],
'status' => [
'code' => 123,
'message' => '<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.zespan.com/v1/traces"
payload := strings.NewReader("{\n \"resourceSpans\": [\n {\n \"resource\": {\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ]\n },\n \"scopeSpans\": [\n {\n \"scope\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\"\n },\n \"spans\": [\n {\n \"traceId\": \"<string>\",\n \"spanId\": \"<string>\",\n \"name\": \"chat.completions\",\n \"startTimeUnixNano\": \"1751716800000000000\",\n \"parentSpanId\": \"<string>\",\n \"kind\": 123,\n \"endTimeUnixNano\": \"<string>\",\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ],\n \"status\": {\n \"code\": 123,\n \"message\": \"<string>\"\n }\n }\n ]\n }\n ]\n }\n ]\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.zespan.com/v1/traces")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"resourceSpans\": [\n {\n \"resource\": {\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ]\n },\n \"scopeSpans\": [\n {\n \"scope\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\"\n },\n \"spans\": [\n {\n \"traceId\": \"<string>\",\n \"spanId\": \"<string>\",\n \"name\": \"chat.completions\",\n \"startTimeUnixNano\": \"1751716800000000000\",\n \"parentSpanId\": \"<string>\",\n \"kind\": 123,\n \"endTimeUnixNano\": \"<string>\",\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ],\n \"status\": {\n \"code\": 123,\n \"message\": \"<string>\"\n }\n }\n ]\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zespan.com/v1/traces")
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 \"resourceSpans\": [\n {\n \"resource\": {\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ]\n },\n \"scopeSpans\": [\n {\n \"scope\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\"\n },\n \"spans\": [\n {\n \"traceId\": \"<string>\",\n \"spanId\": \"<string>\",\n \"name\": \"chat.completions\",\n \"startTimeUnixNano\": \"1751716800000000000\",\n \"parentSpanId\": \"<string>\",\n \"kind\": 123,\n \"endTimeUnixNano\": \"<string>\",\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ],\n \"status\": {\n \"code\": 123,\n \"message\": \"<string>\"\n }\n }\n ]\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"partialSuccess": {
"rejectedSpans": 0,
"errorMessage": ""
}
}{
"error": "Unauthorized",
"code": "rate_limit_exceeded"
}{
"error": "Unauthorized",
"code": "rate_limit_exceeded"
}{
"error": "Unauthorized",
"code": "rate_limit_exceeded"
}{
"error": "Unauthorized",
"code": "rate_limit_exceeded"
}{
"error": "Unauthorized",
"code": "rate_limit_exceeded"
}Export OTLP traces
OTLP-compatible trace export endpoint. Accepts an ExportTraceServiceRequest payload as JSON (application/json) or protobuf (application/x-protobuf). Spans are converted to Zespan events and queued asynchronously.
Authenticated with x-api-key. Rate limited to 300 requests/minute per API key, capped at 1 MB and 100 spans per request, and counted against the organization’s monthly event quota. Spans beyond the 100-span cap are reported in partialSuccess.rejectedSpans.
POST
/
v1
/
traces
Export OTLP traces
curl --request POST \
--url https://api.zespan.com/v1/traces \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"resourceSpans": [
{
"resource": {
"attributes": [
{
"key": "gen_ai.system",
"value": {}
}
]
},
"scopeSpans": [
{
"scope": {
"name": "<string>",
"version": "<string>"
},
"spans": [
{
"traceId": "<string>",
"spanId": "<string>",
"name": "chat.completions",
"startTimeUnixNano": "1751716800000000000",
"parentSpanId": "<string>",
"kind": 123,
"endTimeUnixNano": "<string>",
"attributes": [
{
"key": "gen_ai.system",
"value": {}
}
],
"status": {
"code": 123,
"message": "<string>"
}
}
]
}
]
}
]
}
'import requests
url = "https://api.zespan.com/v1/traces"
payload = { "resourceSpans": [
{
"resource": { "attributes": [
{
"key": "gen_ai.system",
"value": {}
}
] },
"scopeSpans": [
{
"scope": {
"name": "<string>",
"version": "<string>"
},
"spans": [
{
"traceId": "<string>",
"spanId": "<string>",
"name": "chat.completions",
"startTimeUnixNano": "1751716800000000000",
"parentSpanId": "<string>",
"kind": 123,
"endTimeUnixNano": "<string>",
"attributes": [
{
"key": "gen_ai.system",
"value": {}
}
],
"status": {
"code": 123,
"message": "<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({
resourceSpans: [
{
resource: {attributes: [{key: 'gen_ai.system', value: {}}]},
scopeSpans: [
{
scope: {name: '<string>', version: '<string>'},
spans: [
{
traceId: '<string>',
spanId: '<string>',
name: 'chat.completions',
startTimeUnixNano: '1751716800000000000',
parentSpanId: '<string>',
kind: 123,
endTimeUnixNano: '<string>',
attributes: [{key: 'gen_ai.system', value: {}}],
status: {code: 123, message: '<string>'}
}
]
}
]
}
]
})
};
fetch('https://api.zespan.com/v1/traces', 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.zespan.com/v1/traces",
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([
'resourceSpans' => [
[
'resource' => [
'attributes' => [
[
'key' => 'gen_ai.system',
'value' => [
]
]
]
],
'scopeSpans' => [
[
'scope' => [
'name' => '<string>',
'version' => '<string>'
],
'spans' => [
[
'traceId' => '<string>',
'spanId' => '<string>',
'name' => 'chat.completions',
'startTimeUnixNano' => '1751716800000000000',
'parentSpanId' => '<string>',
'kind' => 123,
'endTimeUnixNano' => '<string>',
'attributes' => [
[
'key' => 'gen_ai.system',
'value' => [
]
]
],
'status' => [
'code' => 123,
'message' => '<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.zespan.com/v1/traces"
payload := strings.NewReader("{\n \"resourceSpans\": [\n {\n \"resource\": {\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ]\n },\n \"scopeSpans\": [\n {\n \"scope\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\"\n },\n \"spans\": [\n {\n \"traceId\": \"<string>\",\n \"spanId\": \"<string>\",\n \"name\": \"chat.completions\",\n \"startTimeUnixNano\": \"1751716800000000000\",\n \"parentSpanId\": \"<string>\",\n \"kind\": 123,\n \"endTimeUnixNano\": \"<string>\",\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ],\n \"status\": {\n \"code\": 123,\n \"message\": \"<string>\"\n }\n }\n ]\n }\n ]\n }\n ]\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.zespan.com/v1/traces")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"resourceSpans\": [\n {\n \"resource\": {\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ]\n },\n \"scopeSpans\": [\n {\n \"scope\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\"\n },\n \"spans\": [\n {\n \"traceId\": \"<string>\",\n \"spanId\": \"<string>\",\n \"name\": \"chat.completions\",\n \"startTimeUnixNano\": \"1751716800000000000\",\n \"parentSpanId\": \"<string>\",\n \"kind\": 123,\n \"endTimeUnixNano\": \"<string>\",\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ],\n \"status\": {\n \"code\": 123,\n \"message\": \"<string>\"\n }\n }\n ]\n }\n ]\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.zespan.com/v1/traces")
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 \"resourceSpans\": [\n {\n \"resource\": {\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ]\n },\n \"scopeSpans\": [\n {\n \"scope\": {\n \"name\": \"<string>\",\n \"version\": \"<string>\"\n },\n \"spans\": [\n {\n \"traceId\": \"<string>\",\n \"spanId\": \"<string>\",\n \"name\": \"chat.completions\",\n \"startTimeUnixNano\": \"1751716800000000000\",\n \"parentSpanId\": \"<string>\",\n \"kind\": 123,\n \"endTimeUnixNano\": \"<string>\",\n \"attributes\": [\n {\n \"key\": \"gen_ai.system\",\n \"value\": {}\n }\n ],\n \"status\": {\n \"code\": 123,\n \"message\": \"<string>\"\n }\n }\n ]\n }\n ]\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"partialSuccess": {
"rejectedSpans": 0,
"errorMessage": ""
}
}{
"error": "Unauthorized",
"code": "rate_limit_exceeded"
}{
"error": "Unauthorized",
"code": "rate_limit_exceeded"
}{
"error": "Unauthorized",
"code": "rate_limit_exceeded"
}{
"error": "Unauthorized",
"code": "rate_limit_exceeded"
}{
"error": "Unauthorized",
"code": "rate_limit_exceeded"
}Authorizations
Project API key. Manage keys in the Zespan dashboard under project settings.
Body
application/jsonapplication/x-protobuf
OTLP ExportTraceServiceRequest (JSON encoding).
Show child attributes
Show child attributes
Response
Spans accepted.
Show child attributes
Show child attributes
Was this page helpful?
⌘I

