curl --request POST \
--url https://api.egp.scale.com/v5/span-assessments \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"trace_id": "<string>",
"comment": "<string>",
"rating": 3,
"rubric": {},
"metadata": {},
"overwrite": {},
"span_id": "<string>"
}
'import requests
url = "https://api.egp.scale.com/v5/span-assessments"
payload = {
"trace_id": "<string>",
"comment": "<string>",
"rating": 3,
"rubric": {},
"metadata": {},
"overwrite": {},
"span_id": "<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({
trace_id: '<string>',
comment: '<string>',
rating: 3,
rubric: {},
metadata: {},
overwrite: {},
span_id: '<string>'
})
};
fetch('https://api.egp.scale.com/v5/span-assessments', 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/span-assessments",
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([
'trace_id' => '<string>',
'comment' => '<string>',
'rating' => 3,
'rubric' => [
],
'metadata' => [
],
'overwrite' => [
],
'span_id' => '<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/span-assessments"
payload := strings.NewReader("{\n \"trace_id\": \"<string>\",\n \"comment\": \"<string>\",\n \"rating\": 3,\n \"rubric\": {},\n \"metadata\": {},\n \"overwrite\": {},\n \"span_id\": \"<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/span-assessments")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"trace_id\": \"<string>\",\n \"comment\": \"<string>\",\n \"rating\": 3,\n \"rubric\": {},\n \"metadata\": {},\n \"overwrite\": {},\n \"span_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v5/span-assessments")
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 \"trace_id\": \"<string>\",\n \"comment\": \"<string>\",\n \"rating\": 3,\n \"rubric\": {},\n \"metadata\": {},\n \"overwrite\": {},\n \"span_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"assessment_id": "<string>",
"trace_id": "<string>",
"span_id": "<string>",
"created_by": "<string>",
"assessment_type": "comment",
"object": "span.assessment",
"comment": "<string>",
"rating": 3,
"approval": "approved",
"rubric": {},
"metadata": {},
"overwrite": {},
"account_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create span assessment
Attach a new assessment to a span within a trace.
A span assessment records feedback on a single span’s output. Its assessment_type selects one of comment, rating (an integer 1-5), approval (approved or rejected), rubric (key-value rule pairs), metadata (arbitrary JSON), or overwrite (a corrected span output), and exactly the content field matching that type must be supplied; a free-text comment may additionally accompany any type. trace_id is required, while span_id is optional and, when omitted, the assessment is attached to the trace’s root span. The call returns 404 if the given span_id and trace_id do not identify an existing span, or if no root span is found for the trace. At most one user per span may hold an overwrite assessment, so creating an overwrite for a span another user has already overwritten returns 409. Use the list endpoint to read a span’s or trace’s existing assessments.
curl --request POST \
--url https://api.egp.scale.com/v5/span-assessments \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"trace_id": "<string>",
"comment": "<string>",
"rating": 3,
"rubric": {},
"metadata": {},
"overwrite": {},
"span_id": "<string>"
}
'import requests
url = "https://api.egp.scale.com/v5/span-assessments"
payload = {
"trace_id": "<string>",
"comment": "<string>",
"rating": 3,
"rubric": {},
"metadata": {},
"overwrite": {},
"span_id": "<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({
trace_id: '<string>',
comment: '<string>',
rating: 3,
rubric: {},
metadata: {},
overwrite: {},
span_id: '<string>'
})
};
fetch('https://api.egp.scale.com/v5/span-assessments', 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/span-assessments",
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([
'trace_id' => '<string>',
'comment' => '<string>',
'rating' => 3,
'rubric' => [
],
'metadata' => [
],
'overwrite' => [
],
'span_id' => '<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/span-assessments"
payload := strings.NewReader("{\n \"trace_id\": \"<string>\",\n \"comment\": \"<string>\",\n \"rating\": 3,\n \"rubric\": {},\n \"metadata\": {},\n \"overwrite\": {},\n \"span_id\": \"<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/span-assessments")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"trace_id\": \"<string>\",\n \"comment\": \"<string>\",\n \"rating\": 3,\n \"rubric\": {},\n \"metadata\": {},\n \"overwrite\": {},\n \"span_id\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.egp.scale.com/v5/span-assessments")
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 \"trace_id\": \"<string>\",\n \"comment\": \"<string>\",\n \"rating\": 3,\n \"rubric\": {},\n \"metadata\": {},\n \"overwrite\": {},\n \"span_id\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"assessment_id": "<string>",
"trace_id": "<string>",
"span_id": "<string>",
"created_by": "<string>",
"assessment_type": "comment",
"object": "span.assessment",
"comment": "<string>",
"rating": 3,
"approval": "approved",
"rubric": {},
"metadata": {},
"overwrite": {},
"account_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Authorizations
Headers
Body
Request model for creating span assessment
Type of assessment
comment, rating, approval, rubric, metadata, overwrite The ID of the trace this assessment is attached to
Raw text feedback
Numerical rating (1-5)
1 <= x <= 5Approval status (approved/rejected)
approved, rejected Rule key-value pairs for rubric evaluation
Show child attributes
Show child attributes
Arbitrary JSON object for additional data
User corrections to span output
The ID of the span this assessment is attached to. If omitted, the assessment is attached to the root span of the trace.
Response
Successful Response
Response model for span assessment
Unique identifier for the assessment
The trace this assessment is attached to
The span this assessment is attached to
User who submitted the assessment
Type of assessment
comment, rating, approval, rubric, metadata, overwrite "span.assessment"Raw text feedback
Numerical rating (1-5)
1 <= x <= 5Approval status (approved/rejected)
approved, rejected Rule key-value pairs for rubric evaluation
Show child attributes
Show child attributes
Arbitrary JSON object for additional data
User corrections to span output
Account this assessment belongs to
When this assessment was created
When this assessment was last updated

