Skip to main content

alerts

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

Overview

Namealerts
TypeResource
Idclickhouse.clickstack.alerts

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringUnique alert identifier. (example: 65f5e4a3b9e77c001a123456)
namestringHuman-friendly alert name. (example: Test Alert)
dashboard_idstringDashboard ID for tile-based alerts. (example: 65f5e4a3b9e77c001a567890) (wire: dashboardId)
saved_search_idstringSaved search ID for saved_search alerts. (example: 65f5e4a3b9e77c001a345678) (wire: savedSearchId)
team_idstringTeam identifier. (example: 65f5e4a3b9e77c001a345678) (wire: teamId)
tile_idstringTile ID for tile-based alerts. Must be a line, stacked bar, or number type tile. (example: 65f5e4a3b9e77c001a901234) (wire: tileId)
channelobject
created_atstring (date-time)Creation timestamp. (example: 2023-01-01T00:00:00.000Z) (wire: createdAt)
execution_errorsarrayErrors recorded during the most recent alert execution, if any. (wire: executionErrors)
group_bystringGroup-by key for saved search alerts. (example: ServiceName) (wire: groupBy)
intervalstringEvaluation interval for the alert. (1m, 5m, 15m, 30m, 1h, 6h, 12h, 1d) (example: 1h)
messagestringAlert message template. (example: Test Alert Message)
notestringFreeform note for the alert. Supports markdown formatting. (example: Threshold raised from 50 to 100 on 2026-01-15. See [runbook](https:​//wiki.example.com/runbook).)
num_consecutive_windowsintegerFire the alert only after its condition has been met for this many consecutive evaluation windows. While the condition is met but fewer than this many consecutive windows have violated, the alert is in the PENDING state. (wire: numConsecutiveWindows)
schedule_offset_minutesintegerOffset from the interval boundary in minutes. For example, 2 with a 5m interval evaluates windows at :02, :07, :12, etc. (UTC). (wire: scheduleOffsetMinutes)
schedule_start_atstring (date-time)Absolute UTC start time anchor. Alert windows start from this timestamp and repeat every interval. (example: 2026-02-08T10:00:00.000Z) (wire: scheduleStartAt)
silencedobject
sourcestringAlert source type (tile-based or saved search). (saved_search, tile) (example: tile)
statestringCurrent alert state. (ALERT, OK, INSUFFICIENT_DATA, DISABLED, PENDING) (example: ALERT)
thresholdnumberThreshold value for triggering the alert. For between and not_between threshold types, this is the lower bound.
threshold_maxnumberUpper bound for between and not_between threshold types. Required when thresholdType is between or not_between, must be >= threshold. (wire: thresholdMax)
threshold_typestringThreshold comparison direction. (above, below, above_exclusive, below_or_equal, equal, not_equal, between, not_between) (example: above) (wire: thresholdType)
updated_atstring (date-time)Last update timestamp. (example: 2023-01-01T00:00:00.000Z) (wire: updatedAt)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectservice_id, click_stack_alert_id, organization_idThis endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Retrieves a specific alert by ID
listselectservice_id, organization_idlimit, offsetThis endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Retrieves alerts for the authenticated team (paginated). Results are capped at limit (default and maximum 1000). When totalCount exceeds the number of returned items, page with limit/offset to retrieve them all.
createinsertservice_id, organization_idThis endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Creates a new alert
updateupdateservice_id, click_stack_alert_id, organization_idThis endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Updates an existing alert
deletedeleteservice_id, click_stack_alert_id, organization_idThis endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Deletes an alert

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
click_stack_alert_idstringClickStack Alert ID (wire: clickStackAlertId)
organization_idstringClickHouse Cloud organization ID. Resolved from the CLICKHOUSE_ORG_ID environment variable when it is set (x-stackQL-envVar); otherwise it must be supplied on every query as WHERE organization_id = <uuid>. A WHERE value always takes precedence over the environment. (x-stackQL-envVar: CLICKHOUSE_ORG_ID)
service_idstring (uuid)ID of the ClickStack service. (wire: serviceId)
limitintegerMaximum number of results to return.
offsetintegerNumber of results to skip before returning.

SELECT examples

This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Retrieves a specific alert by ID

SELECT
id,
name,
dashboard_id,
saved_search_id,
team_id,
tile_id,
channel,
created_at,
execution_errors,
group_by,
interval,
message,
note,
num_consecutive_windows,
schedule_offset_minutes,
schedule_start_at,
silenced,
source,
state,
threshold,
threshold_max,
threshold_type,
updated_at
FROM clickhouse.clickstack.alerts
WHERE service_id = '{{ service_id }}' -- required
AND click_stack_alert_id = '{{ click_stack_alert_id }}' -- required
AND organization_id = '{{ organization_id }}' -- required unless CLICKHOUSE_ORG_ID is set
;

INSERT examples

This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Creates a new alert

INSERT INTO clickhouse.clickstack.alerts (
dashboard_id,
tile_id,
saved_search_id,
group_by,
threshold,
threshold_max,
interval,
schedule_offset_minutes,
schedule_start_at,
source,
threshold_type,
channel,
name,
message,
note,
num_consecutive_windows,
service_id,
organization_id
)
SELECT
'{{ dashboard_id }}',
'{{ tile_id }}',
'{{ saved_search_id }}',
'{{ group_by }}',
{{ threshold }},
{{ threshold_max }},
'{{ interval }}',
{{ schedule_offset_minutes }},
'{{ schedule_start_at }}',
'{{ source }}',
'{{ threshold_type }}',
'{{ channel }}',
'{{ name }}',
'{{ message }}',
'{{ note }}',
{{ num_consecutive_windows }},
'{{ service_id }}',
'{{ organization_id }}'
RETURNING
request_id,
result,
status
;

UPDATE examples

This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Updates an existing alert

UPDATE clickhouse.clickstack.alerts
SET
dashboard_id = '{{ dashboard_id }}',
tile_id = '{{ tile_id }}',
saved_search_id = '{{ saved_search_id }}',
group_by = '{{ group_by }}',
threshold = {{ threshold }},
threshold_max = {{ threshold_max }},
interval = '{{ interval }}',
schedule_offset_minutes = {{ schedule_offset_minutes }},
schedule_start_at = '{{ schedule_start_at }}',
source = '{{ source }}',
threshold_type = '{{ threshold_type }}',
channel = '{{ channel }}',
name = '{{ name }}',
message = '{{ message }}',
note = '{{ note }}',
num_consecutive_windows = {{ num_consecutive_windows }}
WHERE
service_id = '{{ service_id }}' --required
AND click_stack_alert_id = '{{ click_stack_alert_id }}' --required
AND organization_id = '{{ organization_id }}' --required unless CLICKHOUSE_ORG_ID is set
RETURNING
request_id,
result,
status;

DELETE examples

This endpoint is in beta. API contract is stable, and no breaking changes are expected in the future. <br /><br /> ClickStack: Deletes an alert

DELETE FROM clickhouse.clickstack.alerts
WHERE service_id = '{{ service_id }}' --required
AND click_stack_alert_id = '{{ click_stack_alert_id }}' --required
AND organization_id = '{{ organization_id }}' --required unless CLICKHOUSE_ORG_ID is set
;