Prerequisites
Before using the Annotations API, ensure you have:- Orq.ai API Key: Get your API key from the AI Studio
- Trace ID and Span ID: From your observability data (deployment invocations, trace queries, or OpenTelemetry instrumentation) or AI Studio
- Human Reviews: Human Review definitions must exist in the project for the annotation keys you want to use. Each annotation
keymust match an existing Human Review key. Create Human Reviews in Project Settings > Human Review.
API Constraints
- Batch Limits: Up to 10 annotations per create request, up to 10 keys per delete request
- String Length: String values are limited to 200 characters maximum
- Deployment Span Propagation: When annotating a deployment span, the associated log is automatically annotated with the same values
- Metadata Fields: Optional
metadataobject supportsidentityId,source, andreviewerIdfor tracking and attribution
Examples
Add a Quality Rating
Add Multiple Defects
Add a Numeric Score
Add a Text Correction
Batch Add Multiple Annotations
Remove Annotations
Error Handling
| Status Code | Error | Example Message | Solution |
|---|---|---|---|
| 404 | Human Review Not Found | The human review with key "rating" for workspace abc123 was not found. | Create a Human Review with the specified key before annotating. |
| 404 | Span Not Found | Span with id xyz789 for workspace abc123 was not found. | Verify the trace_id and span_id are correct and belong to your workspace. |
| 400 | Invalid Value | Invalid value: poor. Valid options are: good, bad. | Ensure the value matches the options defined in the Human Review. |
| 400 | Value Out of Range | Value 15 is out of range [0, 10]. | Provide a number within the defined min/max range for the Human Review. |
| 400 | String Too Long | String value exceeds maximum length of 200 characters. | Shorten the string annotation to 200 characters or less. |