curl --request POST \
--url https://prime-traces.pintel.dev/api/v1/traces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'Idempotency-Key: <idempotency-key>' \
--form 'metadata={
"schema_version": 123,
"context": {}
};type=application/json' \
--form 'traces=@example-file;type=application/x-ndjson'import requests
url = "https://prime-traces.pintel.dev/api/v1/traces"
files = { "traces": ("example-file", open("example-file", "rb"), "application/x-ndjson") }
files["metadata"] = (None, "{\n \"schema_version\": 123,\n \"context\": {}\n}", "application/json")
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('metadata', '{
"schema_version": 123,
"context": {}
}');
form.append('traces', '<string>');
const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
options.body = form;
fetch('https://prime-traces.pintel.dev/api/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://prime-traces.pintel.dev/api/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 => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"schema_version\": 123,\r\n \"context\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"traces\"; filename=\"example-file\"\r\nContent-Type: application/x-ndjson\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"Idempotency-Key: <idempotency-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://prime-traces.pintel.dev/api/v1/traces"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"schema_version\": 123,\r\n \"context\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"traces\"; filename=\"example-file\"\r\nContent-Type: application/x-ndjson\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.post("https://prime-traces.pintel.dev/api/v1/traces")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"schema_version\": 123,\r\n \"context\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"traces\"; filename=\"example-file\"\r\nContent-Type: application/x-ndjson\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://prime-traces.pintel.dev/api/v1/traces")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"schema_version\": 123,\r\n \"context\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"traces\"; filename=\"example-file\"\r\nContent-Type: application/x-ndjson\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"upload_id": "<string>",
"status": "committed"
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}Upload traces
Upload traces as a multipart/form-data request with two parts:
metadata(application/json):{"schema_version": 1, "context": {...}}.contextis an optional flat string map stored on every trace in the upload.traces(application/x-ndjson): one complete trace per line, or one complete episode per line withX-Prime-Line-Format: episode. The part may be sent withContent-Encoding: gzip.
Idempotency-Key is sha256:<64 lowercase hex> of the uncompressed traces bytes, newlines included, and is also the upload ID. A request can be up to 256 MiB and a single line up to 64 MiB, both measured uncompressed.
201 means every line was stored; there is no partial success. 400 means the content was rejected and nothing was stored. 409 means the same bytes were already uploaded with a different line format. 429 and 503 are safe to retry with the same bytes after Retry-After.
curl --request POST \
--url https://prime-traces.pintel.dev/api/v1/traces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'Idempotency-Key: <idempotency-key>' \
--form 'metadata={
"schema_version": 123,
"context": {}
};type=application/json' \
--form 'traces=@example-file;type=application/x-ndjson'import requests
url = "https://prime-traces.pintel.dev/api/v1/traces"
files = { "traces": ("example-file", open("example-file", "rb"), "application/x-ndjson") }
files["metadata"] = (None, "{\n \"schema_version\": 123,\n \"context\": {}\n}", "application/json")
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>"
}
response = requests.post(url, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('metadata', '{
"schema_version": 123,
"context": {}
}');
form.append('traces', '<string>');
const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
options.body = form;
fetch('https://prime-traces.pintel.dev/api/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://prime-traces.pintel.dev/api/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 => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"schema_version\": 123,\r\n \"context\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"traces\"; filename=\"example-file\"\r\nContent-Type: application/x-ndjson\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data",
"Idempotency-Key: <idempotency-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://prime-traces.pintel.dev/api/v1/traces"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"schema_version\": 123,\r\n \"context\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"traces\"; filename=\"example-file\"\r\nContent-Type: application/x-ndjson\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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.post("https://prime-traces.pintel.dev/api/v1/traces")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"schema_version\": 123,\r\n \"context\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"traces\"; filename=\"example-file\"\r\nContent-Type: application/x-ndjson\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://prime-traces.pintel.dev/api/v1/traces")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"metadata\"\r\nContent-Type: application/json\r\n\r\n{\r\n \"schema_version\": 123,\r\n \"context\": {}\r\n}\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"traces\"; filename=\"example-file\"\r\nContent-Type: application/x-ndjson\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"upload_id": "<string>",
"status": "committed"
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}{
"error": {
"code": "upload_too_large",
"message": "<string>",
"details": {}
}
}Authorizations
A Prime Intellect API key with the Prime Traces permission.
Headers
trace (the default) or episode.
Act on this team's traces instead of your personal ones. You must be a member of the team.
sha256:<64 lowercase hex> of the uncompressed traces part; it is also the upload ID.
^sha256:[0-9a-f]{64}$Body
The metadata part: { schema_version, context? }.
The digest is not restated here — it is the Idempotency-Key, and it is
also the upload ID.
Show child attributes
Show child attributes
JSONL: one trace per line, or one episode per line under X-Prime-Line-Format: episode. May be gzip-encoded.
Response
Successful Response
201 body. status is always committed: there is no partial success.
States an upload can hold in upload_events.
Content addressing bounds an upload at two events: received, then one
terminal state. A refused upload appends nothing — the rejection is raised
at the first bad line, before the digest that would prove the upload was
this upload — so the upload simply stays received and the next attempt is
read again.
received, committed, indexed, invalidated, index_requeued, index_skipped Was this page helpful?