Write scores
const url = 'http://localhost:8080/api/v1/projects/example/scores';const options = { method: 'POST', headers: { cookie: 'cetra_session=<cetra_session>', 'Content-Type': 'application/json' }, body: '{"scores":[{"dataset_item_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","experiment_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","metadata":{"additionalProperty":"example"},"name":"example","queue_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","reason":"example","score_id":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","session_id":"example","source":"api","target":{"span_id":"example","trace_id":"example","type":"span"},"user_id":"example","value":{"data_type":"numeric","value":1}}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/projects/example/scores \ --header 'Content-Type: application/json' \ --cookie cetra_session=<cetra_session> \ --data '{ "scores": [ { "dataset_item_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "experiment_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "metadata": { "additionalProperty": "example" }, "name": "example", "queue_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "reason": "example", "score_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "session_id": "example", "source": "api", "target": { "span_id": "example", "trace_id": "example", "type": "span" }, "user_id": "example", "value": { "data_type": "numeric", "value": 1 } } ] }'Writes 1–1000 scores in one batch. The answer has one id per item, in input order. With a session or a personal access token, a score_id that names another user’s human score is refused with 403 unless the caller is a project admin.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Project UUID, URL-encoded org-slug/project-slug, or current.
Request Bodyrequired
Section titled “Request Bodyrequired”POST …/scores and POST /api/v1/scores body.
object
Between 1 and 1000 scores.
One score to write. Spec 06 § Scores, D-F-1, D-G-28.
object
Dataset item (stable id) the score is about; set together with experiment_id.
Experiment the score belongs to; set together with dataset_item_id, on a trace target
(D-J-12).
String metadata stored with the score.
object
Score name.
Annotation queue the score is written from (D-AQ-6). Not part of the derived id.
Free-text reason for the value.
Client id; a UUIDv7 gives created_at from its time (D-G-26). Derived when absent.
Session of a span or trace target. Ignored for a session target.
Who wrote the score. Defaults by caller (D-G-27).
Span, trace or session the score is attached to.
One span. Both ids are required.
object
The span.
Trace that owns the span.
One trace.
object
The trace.
One session.
object
Session id.
End user the score is about, when known.
The score value.
A finite number.
object
A finite number.
True or false. Stored numerically as 1 or 0.
object
True or false. Stored numerically as 1 or 0.
A label and an optional numeric mapping.
object
A label and an optional numeric mapping.
object
Category label. Stored in value_str.
Optional numeric mapping. Stored in value_num. Omitted from JSON when absent.
Free text.
object
Free text.
Responses
Section titled “Responses”The id of each written score, in input order.
Answer of a score write: one id per input item, in input order.
object
One id per input item, in input order.
Example generated
{ "score_ids": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ]}The request is malformed or a filter is invalid.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}No credentials, or the credentials are invalid.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The organization reached its monthly units cap (code quota_exceeded). Retry-After gives the seconds until it resets.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The credentials do not allow this operation, or the organization’s plan does not include it (code plan_required).
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The resource does not exist.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The request body is larger than the limit.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}Too many requests.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}The server is busy or a dependency is unavailable. Retry later.
RFC 7807 problem document.
Spec 09 § Conventions.
object
Machine-readable error code.
Extra explanation. Omitted when absent.
Field errors. Omitted when empty, because RFC 7807 clients expect the member to be absent.
One field that failed validation.
Spec 09 § Conventions.
object
Request field, query parameter, or expression the error refers to.
What is wrong with the field.
Location inside the field value, for filter and SQL errors.
object
1-based column number, in characters.
1-based line number, in characters.
HTTP status code.
Short human-readable summary, the reason phrase of status.
Problem type URI. Always about:blank in this version.
Example
{ "code": "bad_request"}