Annotate a batch of project spans
Write human annotations to a batch of spans in a project.
Idempotency: Writes use upsert semantics — submitting the same annotation config name for the same span overwrites the previous value. Retrying on network failure will not create duplicates.
202 Accepted: The annotations have been accepted and will be written. Visibility in read queries may lag by a short interval.
Partial failure: Writes are grouped by calendar day and processed sequentially. A non-2xx response means the request failed during the write phase — annotations for earlier calendar-day buckets may already be saved while later ones are not. It is safe to retry the full request; re-submitting a record that was already saved will overwrite it with the same value (no duplicates).
Payload Requirements
project_idis required and must identify a project the caller has span annotation access to.annotationsis a list of per-span annotation inputs. Each entry identifies one span by itsrecord_idand provides one or more annotation values.- Each
record_idmust be unique within the request (duplicates return 400). - Each record’s
valueslist must not contain duplicate annotation config names (returns 400). start_time/end_timeconstrain the Druid time range for span lookup. If omitted,start_timedefaults to 31 days ago andend_timeto now. Bothstart_timeandend_timemay not be in the future. The window may not exceed 31 days. If ANY span ID cannot be located within the given range, the entire request is rejected with 404 and no annotations are written (all-or-nothing pre-validation). Only after all spans are confirmed does the write phase begin.- Annotation names must match existing annotation configs in the project’s space.
- Up to 1000 span records may be annotated per request.
Valid example
{
"project_id": "proj_abc123",
"annotations": [
{"record_id": "span_abc", "values": [{"name": "relevance", "label": "good", "score": 1.0}]}
]
}
Invalid example (annotation name not found in space)
{
"project_id": "proj_abc123",
"annotations": [
{"record_id": "span_abc", "values": [{"name": "nonexistent_config"}]}
]
}
Invalid example (time window exceeds 31 days)
{
"project_id": "proj_abc123",
"start_time": "2025-01-01T00:00:00Z",
"end_time": "2025-03-01T00:00:00Z",
"annotations": [
{"record_id": "span_abc", "values": [{"name": "relevance", "label": "good"}]}
]
}
Authorizations
Most Arize AI endpoints require authentication. For those endpoints that require authentication, include your API key in the request header using the format
Body
Body containing span annotation batch
Batch annotation request for project spans.
The project (model) ID whose spans are being annotated.
"proj_abc123"
Batch of span annotations to write. Up to 1000 spans per request.
1 - 1000 elementsStart of the time range for span lookup. Optional; defaults to 31 days ago.
"2024-01-01T00:00:00Z"
End of the time range for span lookup. Optional; defaults to now.
"2024-01-08T00:00:00Z"
Response
Annotations accepted. Writes are idempotent; retry on failure is safe.