API Documentation for Advanced Features
Notification API
Create Notification Rule
POST /api/v1/notifications/rules
Content-Type: application/json
Request:
{
"slo_id": 1,
"rule_id": null,
"channel_id": 1,
"alert_type": "violation",
"priority": "high",
"subject": "SLO Violation Alert",
"message": "API response time exceeded threshold of 99.95%"
}
Response:
{
"success": true,
"message": "Notification created successfully",
"data": {
"id": 123,
"slo_id": 1,
"channel_id": 1,
"status": "pending",
"priority": "high",
"created_at": "2026-06-09T14:30:00Z"
}
}Test Notification
POST /api/v1/notifications/test
Content-Type: application/json
Request:
{
"channel_id": 1,
"subject": "Test Notification",
"message": "This is a test alert"
}
Response:
{
"success": true,
"message": "Test notification sent successfully"
}Get Notification History
GET /api/v1/notifications/history?slo_id=1&page=1&page_size=10
Response:
{
"notifications": [
{
"id": 123,
"slo_id": 1,
"rule_id": null,
"channel_id": 1,
"status": "delivered",
"alert_type": "violation",
"priority": "high",
"subject": "SLO Violation Alert",
"message": "API response time exceeded threshold",
"sent_at": "2026-06-09T14:30:00Z",
"delivered_at": "2026-06-09T14:30:05Z",
"retry_count": 0,
"created_at": "2026-06-09T14:30:00Z"
}
],
"total": 1,
"page": 1,
"page_size": 10,
"has_next": false
}Get Notification Channels
GET /api/v1/notifications/channels
Response:
{
"success": true,
"count": 3,
"data": [
{
"id": 1,
"name": "Production Email Alerts",
"channel_type": "email",
"organization_id": 1,
"configuration": {
"to": "alerts@company.com",
"from": "slozy@company.com"
},
"enabled": true,
"max_retries": 3,
"created_at": "2026-06-09T14:30:00Z"
},
{
"id": 2,
"name": "Slack Channel",
"channel_type": "slack",
"organization_id": 1,
"configuration": {
"webhook_url": "https://hooks.slack.com/services/..."
},
"enabled": true,
"max_retries": 3,
"created_at": "2026-06-09T14:30:00Z"
}
]
}Create Notification Channel
POST /api/v1/notifications/channels
Content-Type: application/json
Request (Telegram example):
{
"name": "DevOps Telegram",
"channel_type": "telegram",
"configuration": {
"bot_token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz",
"chat_id": "-1001234567890"
}
}
Request (Mattermost example):
{
"name": "Mattermost Alerts",
"channel_type": "mattermost",
"configuration": {
"webhook_url": "https://mattermost.example.com/hooks/xxx",
"username": "SLOzy Bot"
}
}
Response:
{
"success": true,
"data": {
"id": 4,
"name": "DevOps Telegram",
"channel_type": "telegram",
"configuration": {
"bot_token": "123456789:ABCdefGHIjklMNOpqrsTUVwxyz",
"chat_id": "-1001234567890"
},
"enabled": true,
"created_at": "2026-06-16T12:00:00Z"
}
}Update Notification Channel
PUT /api/v1/notifications/channels/:id
Content-Type: application/json
Request:
{
"name": "DevOps Telegram (Updated)",
"channel_type": "telegram",
"configuration": {
"bot_token": "new-token",
"chat_id": "-1001234567890"
},
"enabled": true
}
Response:
{
"success": true,
"message": "Channel updated"
}Delete Notification Channel
DELETE /api/v1/notifications/channels/:id
Response:
{
"success": true,
"message": "Channel deleted"
}Retry Failed Notifications
POST /api/v1/notifications/retry-failed
Content-Type: application/json
Request:
{
"max_age_seconds": 3600
}
Response:
{
"success": true,
"message": "Retry initiated for failed notifications",
"data": {
"max_age_seconds": 3600
}
}Get Notification Statistics
GET /api/v1/notifications/statistics
Response:
{
"success": true,
"data": {
"total_notifications": 150,
"pending_notifications": 5,
"sent_notifications": 120,
"failed_notifications": 25,
"delivered_notifications": 115,
"success_rate": 0.76,
"average_delivery_time_ms": 250,
"channel_usage": {
"email": 80,
"slack": 45,
"webhook": 25
}
}
}Cache API
Get Cache Statistics
GET /api/v1/cache/statistics
Response:
{
"success": true,
"data": {
"total_entries": 1250,
"total_hits": 15000,
"total_misses": 3500,
"hit_rate": 0.81,
"average_ttl": 300,
"average_entry_size": 2048,
"memory_usage_mb": 2.5,
"is_fresh_count": 1100,
"expired_count": 150,
"hot_entries_count": 300,
"cold_entries_count": 950
}
}Invalidate Cache
POST /api/v1/cache/invalidate
Content-Type: application/json
Request (by key):
{
"type": "key",
"key": "query:1:24h:abc123..."
}
Request (by SLO):
{
"type": "slo",
"slo_id": 1
}
Request (by pattern):
{
"type": "pattern",
"pattern": "query:1:"
}
Request (expired entries):
{
"type": "expired"
}
Request (all cache):
{
"type": "all"
}
Response:
{
"success": true,
"message": "Cache invalidated successfully",
"data": {
"type": "slo",
"invalidations": 15,
"timestamp": "2026-06-09T14:30:00Z"
}
}Warmup Cache
POST /api/v1/cache/warmup
Content-Type: application/json
Request:
{
"queries": [
{
"query": "rate(http_requests_total{job=\"api\"}[5m])",
"slo_id": 1,
"time_window": "24h",
"ttl": 300000000000 // 5 minutes in nanoseconds
},
{
"query": "histogram_quantile(0.95, rate(http_request_duration_seconds_bucket[5m]))",
"slo_id": 2,
"time_window": "1h",
"ttl": 600000000000
}
]
}
Response:
{
"success": true,
"message": "Cache warmed up successfully",
"data": {
"queries_warmed": 2,
"timestamp": "2026-06-09T14:30:00Z"
}
}Get Cache Configuration
GET /api/v1/cache/config
Response:
{
"success": true,
"data": {
"default_ttl": 300,
"max_entries": 10000,
"cleanup_interval": 3600,
"enable_memory_cache": true,
"enable_compression": true,
"compression_threshold": 1024,
"enable_warmup": true,
"analytics_retention": 2592000
}
}Update Cache Configuration
PUT /api/v1/cache/config
Content-Type: application/json
Request:
{
"default_ttl": 600,
"max_entries": 20000,
"cleanup_interval": 1800,
"enable_compression": false
}
Response:
{
"success": true,
"message": "Cache configuration updated successfully"
}Get Cache Entry
GET /api/v1/cache/entry/:key
Response:
{
"success": true,
"data": {
"key": "query:1:24h:abc123...",
"query_hash": "xyz789...",
"query": "rate(http_requests_total[5m])",
"slo_id": 1,
"time_window": "24h",
"result": {
"current_value": 0.998,
"target_value": 0.995,
"status": "healthy"
},
"cached_at": "2026-06-09T14:30:00Z",
"expires_at": "2026-06-09T14:35:00Z",
"hit_count": 250,
"last_hit": "2026-06-09T14:34:55Z",
"is_fresh": true
}
}Create Cache Entry
POST /api/v1/cache/entry
Content-Type: application/json
Request:
{
"key": "manual:entry:1",
"query": "up{job=\"api\"}",
"slo_id": 1,
"time_window": "5m",
"result": {
"value": 1
},
"ttl": 120000000000 // 2 minutes in nanoseconds
}
Response:
{
"success": true,
"message": "Cache entry created successfully"
}List Cache Entries
GET /api/v1/cache/entries?page=1&page_size=20&slo_id=1&fresh=true
Response:
{
"success": true,
"data": {
"entries": [
{
"key": "query:1:24h:abc123...",
"query": "rate(http_requests_total[5m])",
"slo_id": 1,
"time_window": "24h",
"cached_at": "2026-06-09T14:30:00Z",
"expires_at": "2026-06-09T14:35:00Z",
"hit_count": 250,
"is_fresh": true
}
],
"total": 1250,
"page": 1,
"page_size": 20,
"has_next": true
}
}Delete Cache Entry
DELETE /api/v1/cache/entry/:key
Response:
{
"success": true,
"message": "Cache entry deleted successfully"
}WebSocket API
WebSocket Connection
WS /api/v1/ws/subscribe
Connection example:
const ws = new WebSocket('ws://localhost:8080/api/v1/ws/subscribe');Subscribe to SLO Updates
Client -> Server:
{
"type": "subscribe",
"data": {
"slo_id": 1,
"channels": ["status", "metrics"]
}
}
Server -> Client:
{
"type": "subscription_confirmed",
"data": {
"slo_id": 1,
"channels": ["status", "metrics"],
"client_id": "client_1623478901234"
}
}Real-time SLO Updates
Server -> Client:
{
"type": "slo_update",
"data": {
"slo_id": 1,
"status": "warning",
"current_value": 0.992,
"target_value": 0.995,
"error_budget_used": 60.0,
"timestamp": "2026-06-09T14:30:00Z"
}
}Notification Broadcast
Server -> Client:
{
"type": "notification",
"data": {
"notification_id": 123,
"slo_id": 1,
"alert_type": "warning",
"priority": "high",
"subject": "SLO Warning",
"message": "SLO approaching threshold",
"timestamp": "2026-06-09T14:30:00Z"
}
}Unsubscribe from SLO Updates
Client -> Server:
{
"type": "unsubscribe",
"data": {
"slo_id": 1
}
}
Server -> Client:
{
"type": "unsubscription_confirmed",
"data": {
"slo_id": 1,
"message": "Successfully unsubscribed from SLO updates"
}
}Health Check Ping/Pong
Client -> Server:
{
"type": "ping",
"data": {
"client_id": "client_1623478901234"
}
}
Server -> Client:
{
"type": "pong",
"data": {
"timestamp": "2026-06-09T14:30:00Z",
"client_id": "client_1623478901234"
}
}Error Responses
All endpoints may return errors in the following format:
json
{
"success": false,
"error": "Error description",
"details": "Additional error details"
}Common HTTP status codes:
200 OK- Successful request400 Bad Request- Invalid request format404 Not Found- Resource not found500 Internal Server Error- Server error
Rate Limiting
API endpoints may have rate limiting:
- GET requests: 100 requests per minute per IP
- POST requests: 50 requests per minute per IP
- WebSocket connections: 100 concurrent connections per user
Rate limit headers are included in responses:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1623479160