Skip to main content
Version: 1.3

Managing alerts

Overview​

Beyond receiving and querying alerts, ToBeAlert provides endpoints to change an alert's status, apply actions, manage tags and attributes, add notes, and delete alerts.

Authorization: Key YOUR_API_KEY_HERE

Change alert status​

PUT /api/alert/<alert_id>/status
Content-Type: application/json
Authorization: Key YOUR_API_KEY

Manually sets the status of an alert. Requires write:alerts scope.

Path parameters​

ParameterDescription
alert_idThe ID of the alert to update

Request body​

FieldTypeRequiredDescription
statusStringYesNew status to assign
textStringNoOptional comment explaining the change
timeoutIntegerNoOverride the alert timeout (seconds)

Supported status values​

StatusDescription
openAlert is active and unacknowledged
ackAlert has been acknowledged
closedAlert has been manually closed
expiredAlert has timed out
shelvedAlert is temporarily suppressed

Example​

Acknowledge an alert with a comment

curl -X PUT "http://your-tobealert.com:9000/api/alert/ALERT_ID/status" \
-H "Content-Type: application/json" \
-H "Authorization: Key YOUR_API_KEY" \
-d '{
"status": "ack",
"text": "Investigating the issue on web-01"
}'

Response​

{
"status": "ok"
}

Errors​

CodeReason
400Missing or invalid status field, or transition rejected by policy
404Alert not found
Effects are released

Setting a cause alert to closed or expired releases its effects: each one gets causeId: null and suppressed: false, plus a history entry by system. Changing the status of an effect does not touch its cause. See Sending alerts — Cause and effect.


Apply actions to alerts​

PUT /api/alert/action
Content-Type: application/json
Authorization: Key YOUR_API_KEY

Applies operator actions (e.g. acknowledge, close, watch) to one or more alerts in a single request. Requires write:alerts scope.

Request body​

FieldTypeRequiredDescription
alertsArrayYesList of alert action objects

Each item in alerts:

FieldTypeRequiredDescription
idStringYesAlert ID
actionStringYesAction to apply
textStringNoComment for the action. Defaults to "<action> operator action"
timeoutIntegerNoOverride the alert timeout

Example​

Apply actions to multiple alerts in a single request

curl -X PUT "http://your-tobealert.com:9000/api/alert/action" \
-H "Content-Type: application/json" \
-H "Authorization: Key YOUR_API_KEY" \
-d '{
"alerts": [
{
"id": "alert-uuid-1",
"action": "ack",
"text": "On-call engineer notified"
},
{
"id": "alert-uuid-2",
"action": "close"
}
]
}'

Response​

Returns a result per alert:

[
{
"id": "alert-uuid-1",
"status": "ok"
},
{
"id": "alert-uuid-2",
"status": "ok"
}
]

Failed items include a message field:

[
{
"id": "bad-uuid",
"status": "error",
"message": "alert not found"
}
]
note

Individual failures do not abort the entire batch. All alerts in the request are processed and each gets its own result entry.


Add tags to an alert​

PUT /api/alert/<alert_id>/tag
Content-Type: application/json
Authorization: Key YOUR_API_KEY

Adds tags to an existing alert. Requires write:alerts scope.

Request body​

FieldTypeRequiredDescription
tagsArrayYesList of tag strings to add

Example​

Add tags to an alert

curl -X PUT "http://your-tobealert.com:9000/api/alert/ALERT_ID/tag" \
-H "Content-Type: application/json" \
-H "Authorization: Key YOUR_API_KEY" \
-d '{
"tags": [
"escalated",
"sev1",
"on-call-paged"
]
}'

Response​

{
"status": "ok"
}

Remove tags from an alert​

PUT /api/alert/<alert_id>/untag
Content-Type: application/json
Authorization: Key YOUR_API_KEY

Removes specific tags from an alert. Requires write:alerts scope.

Request body​

FieldTypeRequiredDescription
tagsArrayYesList of tag strings to remove

Example​

Remove tags from an alert

curl -X PUT "http://your-tobealert.com:9000/api/alert/ALERT_ID/untag" \
-H "Content-Type: application/json" \
-H "Authorization: Key YOUR_API_KEY" \
-d '{
"tags": [
"escalated"
]
}'

Response​

{
"status": "ok"
}

Update alert attributes​

PUT /api/alert/<alert_id>/attributes
Content-Type: application/json
Authorization: Key YOUR_API_KEY

Merges new key-value pairs into an alert's attributes object. Existing keys are updated; new keys are added. Requires write:alerts scope.

Request body​

FieldTypeRequiredDescription
attributesObjectYesKey-value pairs to merge into the alert attributes

Example​

Merge new attributes into an alert

curl -X PUT "http://your-tobealert.com:9000/api/alert/ALERT_ID/attributes" \
-H "Content-Type: application/json" \
-H "Authorization: Key YOUR_API_KEY" \
-d '{
"attributes": {
"jira_ticket": "INFRA-4512",
"resolved_by": "john.doe",
"postmortem_url": "https://wiki.example.com/postmortems/INFRA-4512"
}
}'

Response​

{
"status": "ok"
}

Notes​

  • Attribute keys cannot contain . or $ characters.
  • Values can be strings, arrays, or objects (including link objects — see Sending Alerts).

Delete an alert​

DELETE /api/alert/<alert_id>
Authorization: Key YOUR_API_KEY

Permanently deletes an alert. Requires delete:alerts scope.

Deleting a cause alert releases its effects (causeId: null, suppressed: false, history entry by system). Deleting an effect does not change its cause. See Sending alerts — Cause and effect.

Example​

Permanently delete an alert

curl -X DELETE "http://your-tobealert.com:9000/api/alert/ALERT_ID" \
-H "Content-Type: application/json" \
-H "Authorization: Key YOUR_API_KEY"

Response​

{
"status": "ok"
}

Errors​

CodeReason
400Deletion rejected by a policy plugin
404Alert not found

Notes​

Notes are free-text annotations that operators can attach to alerts for collaboration and tracking.

List notes for an alert​

GET /api/alert/<alert_id>/notes
Authorization: Key YOUR_API_KEY

Example​

List all notes for an alert

curl -X GET "http://your-tobealert.com:9000/api/alert/ALERT_ID/notes" \
-H "Content-Type: application/json" \
-H "Authorization: Key YOUR_API_KEY"

Response​

{
"status": "ok",
"total": 2,
"notes": [
{
"id": "note-uuid-1",
"text": "Escalated to the infrastructure team",
"user": "alice",
"createTime": "2025-04-15T11:00:00Z",
"updateTime": "2025-04-15T11:00:00Z"
},
{
"id": "note-uuid-2",
"text": "Root cause identified: misconfigured load balancer",
"user": "bob",
"createTime": "2025-04-15T12:30:00Z",
"updateTime": "2025-04-15T12:35:00Z"
}
]
}

Add a note​

POST /api/alert/<alert_id>/note
Content-Type: application/json
Authorization: Key YOUR_API_KEY

Requires write:alerts scope.

Request body​

FieldTypeRequiredDescription
textStringYesThe note content (also accepted as note)

Example​

Add a note to an alert

curl -X POST "http://your-tobealert.com:9000/api/alert/ALERT_ID/note" \
-H "Content-Type: application/json" \
-H "Authorization: Key YOUR_API_KEY" \
-d '{
"text": "Paged the on-call engineer at 10:35 UTC"
}'

Response​

{
"status": "ok",
"id": "note-uuid-3",
"note": {
"id": "note-uuid-3",
"text": "Paged the on-call engineer at 10:35 UTC",
"user": "alice",
"createTime": "2025-04-15T10:35:00Z",
"updateTime": "2025-04-15T10:35:00Z"
}
}

Update a note​

PUT /api/alert/<alert_id>/note/<note_id>
Content-Type: application/json
Authorization: Key YOUR_API_KEY

Updates the text of an existing note. Requires write:alerts. Only the note author can update it: the caller's login must match the note user. The admin scope does not allow editing another user's note.

When the new text differs from the stored text, alert history gains a note_edited entry (shown as Note edited) that stores the new text, the same way note_added stores the note text. When the text is unchanged, the note is left as-is and no history row is written. The Web UI shows (edited) on the note when updateTime is more than one second after createTime.

Request body​

FieldTypeRequiredDescription
textStringYesUpdated note content (also accepted as note)

Example​

Update the text of an existing note

curl -X PUT "http://your-tobealert.com:9000/api/alert/ALERT_ID/note/NOTE_ID" \
-H "Content-Type: application/json" \
-H "Authorization: Key YOUR_API_KEY" \
-d '{
"text": "Paged the on-call engineer at 10:35 UTC — resolved at 11:10 UTC"
}'

Response​

{
"status": "ok",
"note": {
"id": "note-uuid-3",
"text": "Paged the on-call engineer at 10:35 UTC — resolved at 11:10 UTC",
"user": "alice",
"updateTime": "2025-04-15T11:15:00Z"
}
}

Errors​

CodeReason
400Missing note text
403Caller is not the note author (admin does not bypass this)
404Alert or note not found

Delete a note​

DELETE /api/alert/<alert_id>/note/<note_id>
Authorization: Key YOUR_API_KEY

Permanently removes a note from an alert. Requires write:alerts scope. Users can only delete their own notes unless they have admin scope.

Example​

Delete a note from an alert

curl -X DELETE "http://your-tobealert.com:9000/api/alert/ALERT_ID/note/NOTE_ID" \
-H "Content-Type: application/json" \
-H "Authorization: Key YOUR_API_KEY"

Response​

{
"status": "ok"
}

Errors​

CodeReason
403Trying to delete another user's note without admin scope
404Alert or note not found