curl --request POST \
--url https://api.primeintellect.ai/api/v1/traces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'Idempotency-Key: <idempotency-key>' \
--form 'metadata={
"schema_version": 1,
"context": {
"source": "my-eval"
}
};type=application/json' \
--form 'traces=@example-file;type=application/x-ndjson'import requests
url = "https://api.primeintellect.ai/api/v1/traces"
files = { "traces": ("example-file", open("example-file", "rb"), "application/x-ndjson") }
files["metadata"] = (None, "{\n \"schema_version\": 1,\n \"context\": {\n \"source\": \"my-eval\"\n }\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": 1,
"context": {
"source": "my-eval"
}
}');
form.append('traces', '<string>');
const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
options.body = form;
fetch('https://api.primeintellect.ai/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://api.primeintellect.ai/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\": 1,\r\n \"context\": {\r\n \"source\": \"my-eval\"\r\n }\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://api.primeintellect.ai/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\": 1,\r\n \"context\": {\r\n \"source\": \"my-eval\"\r\n }\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://api.primeintellect.ai/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\": 1,\r\n \"context\": {\r\n \"source\": \"my-eval\"\r\n }\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://api.primeintellect.ai/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\": 1,\r\n \"context\": {\r\n \"source\": \"my-eval\"\r\n }\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": {}
}
}{
"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, one complete episode per line withX-Prime-Line-Format: episode, or one Prime Agent session per line withX-Prime-Line-Format: prime_agent(a JSON array of the session file’s lines, header first). 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 1100 MiB and a single line up to 1 GiB, both measured uncompressed.
201 means every line was stored; there is no partial success. 400 means the content was rejected and nothing was stored. 408 means the body did not finish arriving in time. 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://api.primeintellect.ai/api/v1/traces \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--header 'Idempotency-Key: <idempotency-key>' \
--form 'metadata={
"schema_version": 1,
"context": {
"source": "my-eval"
}
};type=application/json' \
--form 'traces=@example-file;type=application/x-ndjson'import requests
url = "https://api.primeintellect.ai/api/v1/traces"
files = { "traces": ("example-file", open("example-file", "rb"), "application/x-ndjson") }
files["metadata"] = (None, "{\n \"schema_version\": 1,\n \"context\": {\n \"source\": \"my-eval\"\n }\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": 1,
"context": {
"source": "my-eval"
}
}');
form.append('traces', '<string>');
const options = {
method: 'POST',
headers: {'Idempotency-Key': '<idempotency-key>', Authorization: 'Bearer <token>'}
};
options.body = form;
fetch('https://api.primeintellect.ai/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://api.primeintellect.ai/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\": 1,\r\n \"context\": {\r\n \"source\": \"my-eval\"\r\n }\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://api.primeintellect.ai/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\": 1,\r\n \"context\": {\r\n \"source\": \"my-eval\"\r\n }\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://api.primeintellect.ai/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\": 1,\r\n \"context\": {\r\n \"source\": \"my-eval\"\r\n }\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://api.primeintellect.ai/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\": 1,\r\n \"context\": {\r\n \"source\": \"my-eval\"\r\n }\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": {}
}
}{
"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
Headers
Body
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?