Create Annotation
Creates a new annotation for a trace, span, or thread in your Confident AI project. Annotations capture human feedback including ratings, expected outputs/outcomes, explanations, and flags.
**Important validation rules:**
- For traces and spans: Use `expectedOutput` (not `expectedOutcome`)
- For threads: Use `expectedOutcome` (not `expectedOutput`)
- Rating must be 0 or 1 for THUMBS_RATING, or 1-5 for FIVE_STAR_RATING
- You must provide either `traceUuid`, `spanUuid`, or `threadId`
Headers
CONFIDENT_API_KEY
The API key of your Confident AI project.
Request
This endpoint expects an object.
rating
This 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.
traceUuid
This is the trace UUID to annotate. Exactly one of traceUuid, spanUuid, or threadId must be provided.
spanUuid
This is the span UUID to annotate. Exactly one of traceUuid, spanUuid, or threadId must be provided.
threadId
This is the thread ID to annotate. Exactly one of traceUuid, spanUuid, or threadId must be provided.
type
This is the annotation typem which defaults to THUMBS_RATING.
Allowed values:
expectedOutput
This is the expected output for trace/span annotations, which mustn’t be provided when annotating a thread.
expectedOutcome
This is the expected outcome for thread annotations, which mustn't be provided when annotating a trace or span.
explanation
This is an explanation for the annotation.
userId
This can be any user ID that you want to associate with the annotation.
Response
Successfully created annotation
success
This is true if the annotation was successfully created.
data
This maps to the id of the created annotation.
deprecated
This is true if this endpoint is deprecated.