Alerts API
Create and manage alert rules, and view alert history.
POST
/rest/v1/rpc/list_alert_rules
List all alert rules for the current tenant.
Authentication
Requires JWT token (Bearer token)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| p_tenant_id | string | Required | Tenant ID (extracted from JWT if not provided) |
Responses
200List of alert rules
[
{
"rule_id": "uuid",
"tenant_id": "tenant-123",
"name": "High Error Rate",
"description": "Alert when error rate exceeds threshold",
"query_dsl": "level = 'error'",
"threshold": 100,
"comparison": "gt",
"window_minutes": 5,
"cooldown_minutes": 15,
"enabled": true,
"notification_destinations": ["email", "webhook"],
"notification_config": {
"email": "admin@example.com",
"webhook_url": "https://example.com/webhook"
},
"created_at": "2025-01-15T10:00:00Z",
"updated_at": "2025-01-15T10:00:00Z"
}
]POST
/rest/v1/rpc/get_alert_rule
Get a specific alert rule by ID.
Authentication
Requires JWT token (Bearer token)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| p_rule_id | string (UUID) | Required | Alert rule ID |
Responses
200Alert rule details
404Alert rule not found
POST
/rest/v1/rpc/create_alert_rule
Create a new alert rule.
Authentication
Requires JWT token (Bearer token)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| p_tenant_id | string | Required | Tenant ID |
| p_name | string | Required | Alert rule name |
| p_description | string | Optional | Alert description |
| p_query_dsl | string | Required | DSL query to evaluate |
| p_threshold | number | Required | Threshold value |
| p_comparison | string | Required | Comparison operator: gt, gte, lt, lte, eq, neq |
| p_window_minutes | number | Required | Time window in minutes |
| p_cooldown_minutes | number | Required | Cooldown period in minutes |
| p_enabled | boolean | Required | Whether the rule is enabled |
| p_notification_destinations | string[] | Optional | Array of notification channels (e.g., ["email", "webhook"]) |
| p_notification_config | object | Optional | Notification configuration (e.g., email addresses, webhook URLs) |
Request Body
interface CreateAlertRuleRequest {
p_tenant_id: string
p_name: string
p_description?: string
p_query_dsl: string
p_threshold: number
p_comparison: 'gt' | 'gte' | 'lt' | 'lte' | 'eq' | 'neq'
p_window_minutes: number
p_cooldown_minutes: number
p_enabled: boolean
p_notification_destinations: string[]
p_notification_config: Record<string, any>
}Example
{
"p_tenant_id": "tenant-123",
"p_name": "High Error Rate",
"p_description": "Alert when error rate exceeds 100 in 5 minutes",
"p_query_dsl": "level = 'error'",
"p_threshold": 100,
"p_comparison": "gt",
"p_window_minutes": 5,
"p_cooldown_minutes": 15,
"p_enabled": true,
"p_notification_destinations": ["email", "webhook"],
"p_notification_config": {
"email": "admin@example.com",
"webhook_url": "https://example.com/webhook"
}
}Responses
200Created alert rule
400Invalid input
POST
/rest/v1/rpc/update_alert_rule
Update an existing alert rule.
Authentication
Requires JWT token (Bearer token)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| p_rule_id | string (UUID) | Required | Alert rule ID |
| p_name | string | Optional | Alert rule name |
| p_description | string | Optional | Alert description |
| p_query_dsl | string | Optional | DSL query to evaluate |
| p_threshold | number | Optional | Threshold value |
| p_comparison | string | Optional | Comparison operator |
| p_window_minutes | number | Optional | Time window in minutes |
| p_cooldown_minutes | number | Optional | Cooldown period in minutes |
| p_enabled | boolean | Optional | Whether the rule is enabled |
| p_notification_destinations | string[] | Optional | Array of notification channels |
| p_notification_config | object | Optional | Notification configuration |
Responses
200Updated alert rule
404Alert rule not found
POST
/rest/v1/rpc/delete_alert_rule
Delete an alert rule.
Authentication
Requires JWT token (Bearer token)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| p_rule_id | string (UUID) | Required | Alert rule ID |
Responses
200Successfully deleted
404Alert rule not found
POST
/rest/v1/rpc/list_alert_history
List alert history with optional filters.
Authentication
Requires JWT token (Bearer token)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| p_tenant_id | string | Required | Tenant ID |
| p_rule_id | string (UUID) | Optional | Filter by alert rule ID |
| p_ts_from | string | Optional | Start timestamp (ISO 8601) |
| p_ts_to | string | Optional | End timestamp (ISO 8601) |
| p_acknowledged | boolean | Optional | Filter by acknowledgment status |
| p_limit | number | Optional | Maximum number of results (default: 100) |
Responses
200List of alert history entries
[
{
"alert_id": "uuid",
"rule_id": "uuid",
"tenant_id": "tenant-123",
"triggered_at": "2025-01-15T10:30:00Z",
"value": 150,
"threshold": 100,
"acknowledged": false,
"acknowledged_at": null,
"acknowledged_by": null,
"notification_sent": true,
"notification_sent_at": "2025-01-15T10:30:05Z",
"notification_channels": ["email", "webhook"]
}
]POST
/rest/v1/rpc/acknowledge_alert
Acknowledge an alert to mark it as resolved.
Authentication
Requires JWT token (Bearer token)
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| p_alert_id | string (UUID) | Required | Alert history ID |
Responses
200Successfully acknowledged
404Alert not found