Create Annotation
POSThttps://api.confident-ai.com/v1/annotations
Creates a new annotation for a trace, span, or thread in your Confident AI project. Annotations capture human feedback including ratings, expected outputs/outcomes, and explanations.
Important validation rules:
- For traces and spans: Use
expectedOutput(notexpectedOutcome) - For threads: Use
expectedOutcome(notexpectedOutput) - Rating must be 0 or 1 for THUMBS_RATING, or 1-5 for FIVE_STAR_RATING
- You must provide either
traceUuid,spanUuid, orthreadId
curl -X POST "https://api.confident-ai.com/v1/annotations" \
-H "CONFIDENT_API_KEY: <PROJECT-API-KEY>" \
-H "Content-Type: application/json" \
-d '{
"traceUuid": "<TRACE-UUID>",
"rating": 1,
"type": "THUMBS_RATING",
"expectedOutput": "Provide a clear, step-by-step password reset flow.",
"explanation": "Response acknowledges issue and guides the user through reset steps."
}'{
"success": true,
"data": {
"id": "ANNOTATION-ID"
},
"deprecated": false
}Headers
CONFIDENT_API_KEYstringRequiredThe API key of your Confident AI project.
Request body
traceUuidstringThis is the trace UUID to annotate. Exactly one of traceUuid, spanUuid, or threadId must be provided.
spanUuidstringThis is the span UUID to annotate. Exactly one of traceUuid, spanUuid, or threadId must be provided.
threadIdstringThis is the thread ID to annotate. Exactly one of traceUuid, spanUuid, or threadId must be provided.
ratingnumberRequiredThis is the annotated rating score, which must be 0 or 1 if the annotation is a thumb rating and an integer from 1 to 5 if the annotation is a five star rating.
typeenumThis is the annotation typem which defaults to THUMBS_RATING.
Show 2 enum valuesHide 2 enum values
THUMBS_RATINGFIVE_STAR_RATING
expectedOutputstringThis is the expected output for trace/span annotations, which mustn't be provided when annotating a thread.
expectedOutcomestringThis is the expected outcome for thread annotations, which mustn't be provided when annotating a trace or span.
explanationstringThis is an explanation for the annotation.
userIdstringThis can be any user ID that you want to associate with the annotation.
Response
Successfully created annotation
successbooleanThis is true if the annotation was successfully created.
dataobjectThis maps to the id of the created annotation.
Show 1 propertyHide 1 property
idstringThis is the id of the created annotation.
deprecatedbooleanThis is true if this endpoint is deprecated.