Skip to main content
Applies a partial update to the specified annotation using PATCH semantics — only fields included in the request body are modified. Returns the updated Annotation object.

Path parameters

indicator_id
string
required
The indicator’s unique identifier. Must be a valid MongoDB ObjectId.
annotation_id
string
required
The annotation’s unique identifier. Must be a valid MongoDB ObjectId.

Request body

All fields are optional. Omit fields you do not want to change.
value
string | number
New position for the annotation line.
  • For xaxis annotations: an ISO 8601 datetime string.
  • For yaxis annotations: a numeric value.
label
string
New label text.
color
string
New CSS hex color (e.g., "#3498DB").
stroke_dasharray
integer
New dash pattern. 0 for solid line.
opacity
number
New opacity, from 0.0 to 1.0.

Response

Returns the full updated Annotation object.
id
string
Annotation identifier.
indicator_id
string
required
The ObjectId of the parent indicator.
type
string
required
xaxis or yaxis. The type cannot be changed after creation.
value
string | number
required
Updated annotation position.
label
string
required
Updated label.
color
string
required
Updated hex color.
stroke_dasharray
integer
required
Updated dash length.
opacity
number
required
Updated opacity.

Error responses

StatusDescription
400 Bad RequestEither ID is not a valid ObjectId, or value cannot be parsed.
404 Not FoundThe annotation does not exist or does not belong to the specified indicator.
The endpoint returns 404 when the annotation exists but belongs to a different indicator. This prevents cross-indicator annotation modifications.

Examples

curl -X PATCH \
  "https://api.example.com/indicators/64b1f2c3d4e5f6a7b8c9d0e1/annotations/64c2f3a1b5e6d7f8e9a0b1c2" \
  -H "Content-Type: application/json" \
  -d '{
    "label": "Pandemic declared — WHO",
    "color": "#C0392B",
    "opacity": 1.0
  }'

Example response

200
{
  "id": "64c2f3a1b5e6d7f8e9a0b1c2",
  "indicator_id": "64b1f2c3d4e5f6a7b8c9d0e1",
  "type": "xaxis",
  "value": "2020-03-11T00:00:00",
  "label": "Pandemic declared — WHO",
  "color": "#C0392B",
  "stroke_dasharray": 4,
  "opacity": 1.0
}
404
{
  "detail": "Annotation not found"
}

Build docs developers (and LLMs) love