API Documentation
Documents four REST endpoints for monitoring service health, activity logs, AI insights, and a Kestra webhook, plus data models and curl examples.
What this file does
Documents four REST endpoints for monitoring service health, activity logs, AI insights, and a Kestra webhook, plus data models and curl examples.
When to use it
- You need a reference for a backend API that reports service health and incidents
- You want to document a webhook endpoint that receives workflow results from Kestra
- You are building a monitoring dashboard and need a client-facing API spec
- You want to include curl test commands and JavaScript usage snippets in your docs
Assumes this stack
API Documentation
Overview
Sentinel Backend API provides endpoints to monitor service health, manage incidents, and receive AI analysis reports.
Base URL: http://localhost:4000 (development)
Authentication: Currently none (future: JWT tokens)
π Endpoints
Health & Status
Get System Status
GET /api/status
Description: Get current health status of all monitored services
Response:
{
"services": {
"auth": {
"status": "healthy",
"code": 200,
"lastUpdated": "2026-02-01T10:30:00Z"
},
"payment": {
"status": "healthy",
"code": 200,
"lastUpdated": "2026-02-01T10:30:00Z"
},
"notification": {
"status": "degraded",
"code": 429,
"lastUpdated": "2026-02-01T10:29:55Z"
}
},
"aiAnalysis": "DEGRADED: Notification service experiencing rate limiting",
"lastUpdated": "2026-02-01T10:30:00Z"
}
Status Values:
healthy- Service responding normally (HTTP 200-299)degraded- Service experiencing issues (HTTP 400-499)critical- Service down (HTTP 500+)unknown- Never checked or unreachable
Activity & Events
Get Activity Log
GET /api/activity
Description: Get recent activity events and alerts
Query Parameters:
limit(optional): Number of events to return (default: 50, max: 100)offset(optional): Pagination offset (default: 0)
Response:
{
"activity": [
{
"id": 1706781000000,
"message": "AUTH service is DOWN (HTTP 500)",
"type": "alert",
"severity": "critical",
"timestamp": "2026-02-01T10:30:00Z"
},
{
"id": 1706780950000,
"message": "PAYMENT service is DEGRADED (HTTP 429)",
"type": "alert",
"severity": "warning",
"timestamp": "2026-02-01T10:29:10Z"
}
]
}
Fields:
id- Unique event ID (timestamp)message- Human-readable event messagetype- Event type (alert,info,warning)severity- Alert severity (critical,warning,info)timestamp- ISO 8601 timestamp
AI Insights
Get AI Analysis
GET /api/insights
Description: Get AI analysis from Kestra workflow executions
Query Parameters:
limit(optional): Number of insights to return (default: 20, max: 100)
Response:
{
"insights": [
{
"id": "exec-001",
"analysis": "DEGRADED: Payment service at 85% CPU. Recommend scaling workers.",
"metrics": {
"auth": { "code": 200 },
"payment": { "code": 200 },
"notification": { "code": 200 }
},
"summary": "System health at 98%. Minor CPU spike on payment service.",
"timestamp": "2026-02-01T10:30:00Z"
}
]
}
Fields:
id- Execution ID from Kestraanalysis- Raw AI analysis textmetrics- Service metrics snapshotsummary- Concise summarytimestamp- When analysis was generated
Webhooks
Kestra Webhook
POST /api/kestra-webhook
Content-Type: application/json
Description: Receive status updates from Kestra workflow
Request Body:
{
"aiReport": "HEALTHY: All services operating normally",
"metrics": {
"auth": { "code": 200 },
"payment": { "code": 200 },
"notification": { "code": 200 }
}
}
Response:
{
"success": true
}
Used By: Kestra workflow at kestra-flows/intelligent-monitor.yaml
π Data Models
Service Status
interface ServiceStatus {
status: "healthy" | "degraded" | "critical" | "unknown";
code: number; // HTTP status code
lastUpdated: Date;
}
Activity Event
interface ActivityEvent {
id: number;
message: string;
type: "alert" | "info" | "warning";
severity: "critical" | "warning" | "info";
timestamp: Date;
}
AI Insight
interface AIInsight {
id: string;
analysis: string; // Raw AI response
metrics: Record<string, { code: number }>;
summary: string;
timestamp: Date;
}
π Status Codes
| Code | Meaning | Example |
|---|---|---|
| 200 | Service healthy | API responds normally |
| 429 | Rate limited | Too many requests |
| 500 | Server error | Database connection failed |
| 503 | Service unavailable | Maintenance or crash |
π Response Examples
All Services Healthy
{
"services": {
"auth": { "status": "healthy", "code": 200 },
"payment": { "status": "healthy", "code": 200 },
"notification": { "status": "healthy", "code": 200 }
},
"aiAnalysis": "HEALTHY: All systems operational",
"lastUpdated": "2026-02-01T10:35:00Z"
}
Partial Outage
{
"services": {
"auth": { "status": "healthy", "code": 200 },
"payment": { "status": "critical", "code": 500 },
"notification": { "status": "healthy", "code": 200 }
},
"aiAnalysis": "DEGRADED: Payment service down. Initiating auto-healing...",
"lastUpdated": "2026-02-01T10:36:00Z"
}
π§ͺ Testing with curl
Check system status
curl http://localhost:4000/api/status
Get activity log
curl http://localhost:4000/api/activity
Get AI insights
curl http://localhost:4000/api/insights
Test webhook (simulate Kestra)
curl -X POST http://localhost:4000/api/kestra-webhook \
-H "Content-Type: application/json" \
-d '{
"aiReport": "TEST: Webhook integration working",
"metrics": {"auth": {"code": 200}}
}'
π Security Notes
Current Implementation:
- CORS enabled (all origins)
- No authentication required
- No rate limiting
Production Recommendations:
- Implement JWT authentication
- Add rate limiting (100 req/min per IP)
- Restrict CORS to known origins
- Use HTTPS only
- Add request signing
π Rate Limiting (Future)
Tier: Free
- 100 requests/minute
- 10,000 requests/day
- 30-day data retention
Tier: Pro
- 1,000 requests/minute
- 100,000 requests/day
- 1-year data retention
π Usage Examples
Get latest incident
const response = await fetch('http://localhost:4000/api/status');
const data = await response.json();
const worstService = Object.entries(data.services)
.sort((a, b) => b[1].code - a[1].code)[0];
console.log(`Worst service: ${worstService[0]}`);
Monitor for changes
let lastStatus = null;
setInterval(async () => {
const response = await fetch('http://localhost:4000/api/status');
const data = await response.json();
if (JSON.stringify(data) !== JSON.stringify(lastStatus)) {
console.log('Status changed:', data);
lastStatus = data;
}
}, 5000); // Poll every 5 seconds
Trigger alert on critical
const response = await fetch('http://localhost:4000/api/status');
const data = await response.json();
const critical = Object.values(data.services)
.some(s => s.status === 'critical');
if (critical) {
// Send alert
console.alert('CRITICAL: Service down!');
}
π Related Documentation
- DEVELOPMENT.md - Backend setup
- ARCHITECTURE.md - System design
- Backend Code
Last Updated: February 1, 2026 API Version: 1.0.0
What's inside
4 endpoint descriptions, 3 data model interfaces, 4 curl examples, 3 JavaScript usage snippets, status code table, security notes, rate limiting tiers
Change this for your project
- Replace
http://localhost:4000with your own base URL - Replace
kestra-flows/intelligent-monitor.yamlwith your actual Kestra workflow path - Replace
../backend/index.jswith the correct path to your backend entry point
Where it goes
Keep alongside your test suite. Used to define and score model evaluations.
Worth borrowing
- Status values (healthy, degraded, critical, unknown) mapped to HTTP status code ranges
- Webhook endpoint that accepts a JSON payload from an external workflow orchestrator
- Polling pattern with change detection using JSON.stringify comparison
Related Documents
IATA BCBP Standard Compliance
Documents which IATA BCBP fields and barcode formats a Swift library implements, including Version 8 gender code support.
Evaluating AI Agent Systems: Metrics, Benchmarks, and Quality Assurance (2024-2026)
Surveys 2024-2026 metrics, benchmarks, and monitoring tools for evaluating AI agent systems, with recommendations for a self-improving coding agent.
Voice AI Leaderboards, Benchmarks, and Evaluation Gaps (Jan 2025 -- Feb 2026)
Surveys 20+ voice AI benchmarks from Jan 2025, Feb 2026, identifies evaluation gaps, and provides leaderboard data for STT, TTS, and end-to-end voice agents.
LLM Evaluation β Deep Dive
Covers why LLM evaluation is hard, benchmark taxonomy, LLM-as-judge methodology, contamination, robustness, and designing an eval suite for a product.