Skip to content

Reference

Annotations

The annotations endpoints of the HTTP API.

GET /annotations

List annotations, newest first.

Lists annotations ordered by time_from then id, newest first. With dashboard_id, returns that dashboard’s annotations and the global ones; without it, only the global ones. The caller must be able to see the dashboard: a dashboard that is missing or in a folder the caller cannot see is 404 not_found. An annotation is in the window when it starts at or before to and ends, or starts when it has no end, at or after from. created_by_name is read when the list is answered, so it follows a rename and is null once the person or service account is gone.

Parameters

Name In Type Description
dashboard_id query string (uuid)
from query string (date-time) RFC 3339 start of the window.
to query string (date-time) RFC 3339 end of the window, not before from.
tags query string Comma-separated tags; an annotation matches when it has any of them.
cursor query string The next_cursor of the previous page.
limit query integer Between 1 and 500. Default 100.

Responses

Status Description Body
200 One page of annotations. AnnotationList
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
403 The caller is not allowed to perform the request; a role that is too low is code forbidden_role. Error
404 The dashboard is missing or the caller cannot see it (not_found). Error
500 The server failed to handle the request. Error

POST /annotations

Add an annotation.

Adds an annotation to one dashboard, or a global one shown on every dashboard when dashboard_id is absent or null. A dashboard annotation needs Edit on the dashboard’s folder, and a global one needs the Editor role or higher; otherwise 403 forbidden_role. A dashboard that is missing or in a folder the caller cannot see is 404 not_found. panel_id must be a panel of the dashboard’s latest version, otherwise 422 unknown_panel. time_from defaults to the server’s current time when it is absent; a given time must be an RFC 3339 time from 1970-01-01 to 2099-12-31, never replaced by the current time.

Request body

application/json, required.

Field Type Description
dashboard_id string (uuid) or null
panel_id string A panel of the dashboard; needs dashboard_id.
time_from string (date-time)
time_to string (date-time) or null The end of a range annotation, not before time_from.
text (required) string 1 to 2000 visible characters once trimmed, without control or bidirectional override characters.
tags array of string At most 10 items.

Responses

Status Description Body
201 The annotation is added. Annotation
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
403 The caller is not allowed to perform the request; a role that is too low is code forbidden_role. Error
404 The dashboard is missing or the caller cannot see it (not_found). Error
413 The request body exceeds the size limit. Error
422 The text is empty, longer than 2000 characters or holds control characters (invalid_text), a tag is not valid or there are more than 10 (invalid_tags), a time is not RFC 3339, is before 1970, is after 2099 or time_to is before time_from (invalid_time), panel_id is too long or has no dashboard_id (invalid_panel_id), or panel_id is not a panel of the dashboard’s latest version (unknown_panel). Error
500 The server failed to handle the request. Error

PATCH /annotations/{id}

Change the text or tags of an annotation.

Changes the text, the tags or both of an annotation the caller created, or of any annotation for an Admin; anyone else gets 403 not_creator. A field that is absent stays as it was, and a given tags list replaces the old tags, so an empty list removes them. The time, the dashboard, the panel and the author never change. A body that gives neither field is 422 invalid_request, and a change that leaves both values as they were answers 200 and records nothing. An annotation that is missing, or on a dashboard the caller cannot see, is 404 not_found.

Parameters

Name In Type Description
id (required) path string (uuid)

Request body

application/json, required.

Field Type Description
text string 1 to 2000 characters once trimmed, without control or bidirectional override characters.
tags array of string At most 10 items.

Responses

Status Description Body
200 The annotation as it is now. Annotation
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
403 The caller did not create the annotation and is not an Admin (not_creator). Error
404 The resource does not exist, or the caller cannot see it; the two are never told apart. Error
413 The request body exceeds the size limit. Error
422 Neither text nor tags is given (invalid_request), the text is empty, longer than 2000 characters or holds control characters (invalid_text), or a tag is not valid or there are more than 10 (invalid_tags). Error
500 The server failed to handle the request. Error

DELETE /annotations/{id}

Delete an annotation.

Deletes an annotation the caller created, or any annotation for an Admin; anyone else gets 403 not_creator. An annotation that is missing, or on a dashboard the caller cannot see, is 404 not_found.

Parameters

Name In Type Description
id (required) path string (uuid)

Responses

Status Description Body
204 The annotation is deleted.
400 The request is malformed or fails validation. Error
401 Authentication is missing or invalid. Error
403 The caller did not create the annotation and is not an Admin (not_creator). Error
404 The resource does not exist, or the caller cannot see it; the two are never told apart. Error
500 The server failed to handle the request. Error

Generated from api/openapi.yaml at c770e5e0. Report a problem.

Reading this as an agent? Every page is in /llms.txt and /llms-full.txt as plain text.

/observeOpen source under Apache-2.0.Grafana is a trademark of Grafana Labs. Elasticsearch and Kibana are trademarks of Elasticsearch B.V. OpenSearch is a trademark of LF Projects, LLC. SlashObserve is not affiliated with or endorsed by any of them.

Search pages and headings.