Skip to main content

create-annotation

dci create-annotation [body]

Creates a new annotation.

Pass the request body as name: value arguments or pipe JSON on stdin — see Command structure.

IDs, not names

reports and labels take IDs: get them from dci list-reports and dci list-labels. timestamp is an RFC 3339 date-time and is required.

Examples

# Record what happened on a date so it shows on report charts.
dci create-annotation content: "Moved batch jobs to Spot instances", timestamp: "2026-09-01T00:00:00Z"
# Attach the annotation to specific reports and tag it with labels.
dci create-annotation content: "Reserved Instances renewed", timestamp: "2026-09-01T00:00:00Z", reports: [<report-id>], labels: [<label-id>]
# Create it from a file and capture the new ID.
dci create-annotation --output json < annotation.json | jq -r .id
# annotation.json
{"content": "Moved batch jobs to Spot instances",
"timestamp": "2026-09-01T00:00:00Z",
"reports": ["<report-id>"],
"labels": ["<label-id>"]}

Request

Content-Type: application/json

FieldTypeRequiredDescription
contentstringyesThe content of the annotation.
timestampstring (date-time)yesThe date associated with the annotation.
reportsarray of stringList of report IDs associated with the annotation.
labelsarray of stringList of label IDs to associate with the annotation. Labels must already exist.
Raw JSON schema
{
"required": [
"content",
"timestamp"
],
"type": "object",
"description": "Request body to create an annotation.",
"properties": {
"content": {
"type": "string",
"description": "The content of the annotation."
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "The date associated with the annotation."
},
"reports": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of report IDs associated with the annotation."
},
"labels": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of label IDs to associate with the annotation. Labels must already exist."
}
}
}

Output

Created - Annotation created successfully.

By default dci renders the result as a table. Use --output json to get the full structure described below — see Output formats.

FieldTypeDescription
idstringThe unique identifier of the annotation.
contentstringThe content of the annotation.
timestampstring (date-time)The date associated with the annotation.
reportsarray of stringList of report IDs associated with the annotation.
labelsarray of objectList of labels associated with the annotation.
labels[].idstringThe unique identifier of the label.
labels[].namestringThe name of the label.
createTimestring (date-time)The creation time of the annotation.
updateTimestring (date-time)The time when the annotation was last updated.
Raw JSON schema
{
"required": [
"id",
"content",
"timestamp"
],
"type": "object",
"description": "Summary information about an annotation.",
"properties": {
"id": {
"type": "string",
"description": "The unique identifier of the annotation."
},
"content": {
"type": "string",
"description": "The content of the annotation."
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "The date associated with the annotation."
},
"reports": {
"type": "array",
"items": {
"type": "string"
},
"description": "List of report IDs associated with the annotation."
},
"labels": {
"type": "array",
"items": {
"required": [
"id",
"name"
],
"type": "object",
"description": "Metadata for a label.",
"properties": {
"id": {
"type": "string",
"description": "The unique identifier of the label."
},
"name": {
"type": "string",
"description": "The name of the label."
}
}
},
"description": "List of labels associated with the annotation."
},
"createTime": {
"type": "string",
"format": "date-time",
"description": "The creation time of the annotation."
},
"updateTime": {
"type": "string",
"format": "date-time",
"description": "The time when the annotation was last updated."
}
}
}

Errors

On failure, dci prints a single error message — with a hint when one is available — and exits with a typed code your scripts can branch on. See Errors and exit codes for the full contract.

HTTP status to exit code mapping
HTTP statusExit codeError codeMeaning
40030VALIDATION_ERRORThe arguments or request body were rejected. Review the command's flags and payload.
40110AUTHENTICATION_FAILEDNot signed in, or the API token is invalid. Run dci login or check DCI_API_KEY.
40311PERMISSION_DENIEDThe DoiT user or the active customer context does not have access.
40420RESOURCE_NOT_FOUNDThe requested resource does not exist. Check the identifier argument.

Aliases: createannotation