Skip to main content

annotations

Creates, updates, deletes, gets or lists an annotations resource.

Overview

Nameannotations
TypeResource
Iddatadog.dashboards.annotations

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstring (uuid)Unique identifier of the annotation. (example: 00000000-0000-0000-0000-000000000000)
attributesobjectAttributes of an annotation returned in a response.
typestringAnnotation resource type. (annotation) (example: annotation)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_annotationsselectpage_id, start_time, end_timewidget_idReturns a flat list of annotations matching the given page, time window, and optional widget filter.
create_annotationinsertdataCreates a new annotation on a dashboard or notebook page.<br />Valid color values: gray, blue, purple, green, yellow, red.<br />Valid type values: pointInTime (marks a single moment) or timeRegion (spans a range and requires end_time).
update_annotationreplaceannotation_id, dataUpdates an existing annotation.<br />Valid color values: gray, blue, purple, green, yellow, red.<br />Valid type values: pointInTime (marks a single moment) or timeRegion (spans a range and requires end_time).
delete_annotationdeleteannotation_idDeletes an existing annotation by ID.<br />Returns 204 No Content if the annotation does not exist (idempotent).

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
annotation_idstring (uuid)The ID of the annotation. (example: 00000000-0000-0000-0000-000000000000)
end_timeinteger (int64)End of the time window in milliseconds since the Unix epoch. (example: 1704153600000)
page_idstringID of the page to list annotations for, prefixed with the page type and joined by a colon (for example, dashboard:abc-def-xyz or notebook:1234567890). (example: dashboard:abc-def-xyz)
sitestringThe Datadog site (region) for your organization, for example datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, ap1.datadoghq.com, ap2.datadoghq.com, datadoghq.eu, ddog-gov.com. Resolved from the DD_SITE environment variable when set. Optional: defaults to datadoghq.com, or the value of the DD_SITE environment variable when set; a WHERE value overrides both.
start_timeinteger (int64)Start of the time window in milliseconds since the Unix epoch. (example: 1704067200000)
widget_idstringOptional widget ID to restrict results to annotations on a specific widget.

SELECT examples

Returns a flat list of annotations matching the given page, time window, and optional widget filter.

SELECT
id,
attributes,
type
FROM datadog.dashboards.annotations
WHERE page_id = '{{ page_id }}' -- required
AND start_time = '{{ start_time }}' -- required
AND end_time = '{{ end_time }}' -- required
AND widget_id = '{{ widget_id }}'
;

INSERT examples

Creates a new annotation on a dashboard or notebook page.<br />Valid color values: gray, blue, purple, green, yellow, red.<br />Valid type values: pointInTime (marks a single moment) or timeRegion (spans a range and requires end_time).

INSERT INTO datadog.dashboards.annotations (
data
)
SELECT
'{{ data }}' /* required */
RETURNING
data
;

REPLACE examples

Updates an existing annotation.<br />Valid color values: gray, blue, purple, green, yellow, red.<br />Valid type values: pointInTime (marks a single moment) or timeRegion (spans a range and requires end_time).

REPLACE datadog.dashboards.annotations
SET
data = '{{ data }}'
WHERE
annotation_id = '{{ annotation_id }}' --required
AND data = '{{ data }}' --required
RETURNING
data;

DELETE examples

Deletes an existing annotation by ID.<br />Returns 204 No Content if the annotation does not exist (idempotent).

DELETE FROM datadog.dashboards.annotations
WHERE annotation_id = '{{ annotation_id }}' --required
;