---
title: "Annotations"
description: "The annotations endpoints of the HTTP API."
---

> Documentation Index
> Fetch the complete documentation index at: https://slashobserve.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Annotations

## 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`](/docs/reference/api/schemas/#annotationlist) |
| `400` | The request is malformed or fails validation. | [`Error`](/docs/reference/api/schemas/#error) |
| `401` | Authentication is missing or invalid. | [`Error`](/docs/reference/api/schemas/#error) |
| `403` | The caller is not allowed to perform the request; a role that is too low is code `forbidden_role`. | [`Error`](/docs/reference/api/schemas/#error) |
| `404` | The dashboard is missing or the caller cannot see it (`not_found`). | [`Error`](/docs/reference/api/schemas/#error) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#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`](/docs/reference/api/schemas/#annotation) |
| `400` | The request is malformed or fails validation. | [`Error`](/docs/reference/api/schemas/#error) |
| `401` | Authentication is missing or invalid. | [`Error`](/docs/reference/api/schemas/#error) |
| `403` | The caller is not allowed to perform the request; a role that is too low is code `forbidden_role`. | [`Error`](/docs/reference/api/schemas/#error) |
| `404` | The dashboard is missing or the caller cannot see it (`not_found`). | [`Error`](/docs/reference/api/schemas/#error) |
| `413` | The request body exceeds the size limit. | [`Error`](/docs/reference/api/schemas/#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`](/docs/reference/api/schemas/#error) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#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`](/docs/reference/api/schemas/#annotation) |
| `400` | The request is malformed or fails validation. | [`Error`](/docs/reference/api/schemas/#error) |
| `401` | Authentication is missing or invalid. | [`Error`](/docs/reference/api/schemas/#error) |
| `403` | The caller did not create the annotation and is not an Admin (`not_creator`). | [`Error`](/docs/reference/api/schemas/#error) |
| `404` | The resource does not exist, or the caller cannot see it; the two are never told apart. | [`Error`](/docs/reference/api/schemas/#error) |
| `413` | The request body exceeds the size limit. | [`Error`](/docs/reference/api/schemas/#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`](/docs/reference/api/schemas/#error) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#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`](/docs/reference/api/schemas/#error) |
| `401` | Authentication is missing or invalid. | [`Error`](/docs/reference/api/schemas/#error) |
| `403` | The caller did not create the annotation and is not an Admin (`not_creator`). | [`Error`](/docs/reference/api/schemas/#error) |
| `404` | The resource does not exist, or the caller cannot see it; the two are never told apart. | [`Error`](/docs/reference/api/schemas/#error) |
| `500` | The server failed to handle the request. | [`Error`](/docs/reference/api/schemas/#error) |

Generated from [`api/openapi.yaml`](https://github.com/slashobserve/slashobserve/blob/c770e5e0/api/openapi.yaml) at `c770e5e0`. [Report a problem](https://github.com/slashobserve/slashobserve/issues/new).
