---
title: "Edit Annotation"
method: PATCH
path: "/preview/annotations/{trace_id}"
tags: ["Annotations"]
---

# Edit Annotation

`PATCH /preview/annotations/{trace_id}`

## Path parameters

- `trace_id` string, required

## Query parameters

- `span_id` string, nullable

## Request body

- AnnotationEditRequest
  - `annotation` AnnotationEdit, required
    - `tags` object, nullable
    - `meta` object, nullable
    - `data` object, required

## Response `200`

Successful Response

- AnnotationResponse
  - `count` integer
  - `annotation` Annotation
    - `created_at` string, date-time, nullable
    - `updated_at` string, date-time, nullable
    - `deleted_at` string, date-time, nullable
    - `created_by_id` string, uuid, nullable
    - `updated_by_id` string, uuid, nullable
    - `deleted_by_id` string, uuid, nullable
    - `span_id` string, nullable
    - `trace_id` string, nullable
    - `origin` 'custom' | 'human' | 'auto'
    - `kind` 'adhoc' | 'eval' | 'play'
    - `channel` 'otlp' | 'web' | 'sdk' | 'api'
    - `tags` object, nullable
    - `meta` object, nullable
    - `data` object, required
    - `references` SimpleTraceReferences, required
      - `query` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `query_variant` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `query_revision` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `testset` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `testset_variant` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `testset_revision` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `application` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `application_variant` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `application_revision` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `evaluator` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `evaluator_variant` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `evaluator_revision` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
      - `testcase` AgentaSdkModelsSharedReference
        - `version` string, nullable
        - `slug` string, nullable
        - `id` string, uuid, nullable
    - `links` union, required
      - object
      - Link[]
        - `span_id` string, nullable
        - `trace_id` string, nullable

## Other responses

- `422` — Validation Error

## Changes

- **2026-02-13** `72fe88316d15` — 2 info
  - added the optional property `detail/items/ctx` to the response with the `422` status
  - added the optional property `detail/items/input` to the response with the `422` status
- **2026-01-14** `53da4c9de2b7` — 1 breaking, 27 info
  - request property `annotation/tags/anyOf[subschema #1]/additionalProperties/` list-of-types was narrowed by removing types `integer, null and number` from media type `application/json`
  - added `#/components/schemas/agenta__sdk__models__shared__Reference` to the `annotation/anyOf[subschema #1: Annotation]/references/application` response property `anyOf` list for the response status `200`
  - added `#/components/schemas/agenta__sdk__models__shared__Reference` to the `annotation/anyOf[subschema #1: Annotation]/references/application_revision` response property `anyOf` list for the response status `200`
  - added `#/components/schemas/agenta__sdk__models__shared__Reference` to the `annotation/anyOf[subschema #1: Annotation]/references/application_variant` response property `anyOf` list for the response status `200`
  - …24 more
- **2025-11-05** `e62506c24377` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/agenta-ai/apis/agenta-api/changes/preview/annotations/:trace_id/patch.md)

---

[API](https://skmtc.dev/agenta-ai/apis/agenta-api.md) · [All operations](https://skmtc.dev/agenta-ai/apis/agenta-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/agenta-ai/agenta-api/revisions/72fe88316d15/schema)
