Skip to main content

Insights API

Statux Insights is an AI-powered analytics product that provides automated incident analysis, root cause analysis (RCA) document management, and cross-product incident correlation.

Overview

The Insights API (apps/insights/) runs on port 3003 and is available at insights-api.statux.io.

Core Concepts

Analyses

An Analysis is an AI-generated insight for an incident event:

  • Automatically triggered via webhook ingestion from Alerting and Synthetics
  • Can also be manually requested by users
  • Powered by AWS Bedrock for AI processing
  • Tracks analysis events for audit purposes

RCA Documents

A Root Cause Analysis (RCA) document is a structured post-mortem:

  • Links to incidents from Alerting and Statuspages products
  • Tracks action items with assignees and status
  • Supports AI-generated drafts via Bedrock
  • Includes statistics and reporting

Webhook Configs

Webhook Configurations control how events flow into Insights:

  • Each config generates a unique API key (ins_... prefix)
  • Supports optional HMAC-SHA256 signature verification
  • Receives events from Synthetics and Alerting products

Usage Budgets

Usage tracking monitors AI analysis consumption:

  • Per-organization usage limits
  • Configurable budget thresholds
  • Usage statistics per organization

Module Structure

apps/insights/src/
├── modules/
│ ├── analysis/ # Incident analysis CRUD and stats
│ ├── rca/ # RCA documents, incidents, action items
│ ├── webhooks/ # Webhook ingestion and config management
│ ├── budget/ # Usage tracking and limits
│ ├── bedrock/ # AWS Bedrock AI integration
│ ├── cache/ # Analysis caching
│ ├── context-builder/ # AI context preparation
│ ├── pre-analysis/ # Pre-processing pipeline
│ ├── validation/ # Input validation
│ ├── audit-logs/ # Activity audit logging
│ └── users/ # User profiles and subscriptions
├── health/ # Health check endpoint
├── entities/ # TypeORM entities
├── migrations/ # Database migrations
└── main.ts # Application bootstrap

Endpoints

Health

MethodEndpointAuthDescription
GET/api/v1/healthPublicHealth check for ALB

Analyses (Incident Insights)

MethodEndpointAuthDescription
GET/api/v1/organizations/:orgId/insightsJWTList incident insights (paginated)
POST/api/v1/organizations/:orgId/insightsJWTRequest manual analysis
GET/api/v1/organizations/:orgId/insights/statsJWTGet analysis statistics
GET/api/v1/organizations/:orgId/insights/:insightIdJWTGet insight by ID
GET/api/v1/organizations/:orgId/insights/:insightId/eventsJWTGet events for an insight

RCA Documents

MethodEndpointAuthDescription
GET/api/v1/organizations/:orgId/rcasJWTList RCA documents
POST/api/v1/organizations/:orgId/rcasJWTCreate RCA document
GET/api/v1/organizations/:orgId/rcas/statsJWTGet RCA statistics
GET/api/v1/organizations/:orgId/rcas/search-incidentsJWTSearch incidents across products
GET/api/v1/organizations/:orgId/rcas/:rcaIdJWTGet RCA by ID
PATCH/api/v1/organizations/:orgId/rcas/:rcaIdJWTUpdate RCA
DELETE/api/v1/organizations/:orgId/rcas/:rcaIdJWTDelete RCA
POST/api/v1/organizations/:orgId/rcas/:rcaId/generateJWTGenerate AI draft
MethodEndpointAuthDescription
GET/api/v1/organizations/:orgId/rcas/:rcaId/incidentsJWTList linked incidents
POST/api/v1/organizations/:orgId/rcas/:rcaId/incidentsJWTLink incident to RCA
DELETE/api/v1/organizations/:orgId/rcas/:rcaId/incidents/:linkIdJWTUnlink incident

Action Items

MethodEndpointAuthDescription
GET/api/v1/organizations/:orgId/rcas/:rcaId/action-itemsJWTList action items
POST/api/v1/organizations/:orgId/rcas/:rcaId/action-itemsJWTCreate action item
PATCH/api/v1/organizations/:orgId/rcas/:rcaId/action-items/:itemIdJWTUpdate action item
DELETE/api/v1/organizations/:orgId/rcas/:rcaId/action-items/:itemIdJWTDelete action item

Webhook Configuration

MethodEndpointAuthDescription
GET/api/v1/organizations/:orgId/webhook-configsJWTList webhook configs
POST/api/v1/organizations/:orgId/webhook-configsJWTCreate webhook config
GET/api/v1/organizations/:orgId/webhook-configs/:configIdJWTGet webhook config
PATCH/api/v1/organizations/:orgId/webhook-configs/:configIdJWTUpdate webhook config
DELETE/api/v1/organizations/:orgId/webhook-configs/:configIdJWTDelete webhook config
POST/api/v1/organizations/:orgId/webhook-configs/:configId/regenerate-keyJWTRegenerate API key

Webhook Ingestion

MethodEndpointAuthDescription
POST/api/v1/webhooks/ingest/:apiKeyPublic (API Key)Ingest webhook event

The ingestion endpoint accepts events from Synthetics and Alerting products. An optional x-webhook-signature header can be provided for HMAC-SHA256 payload verification.

Usage

MethodEndpointAuthDescription
GET/api/v1/organizations/:orgId/usageJWTGet usage statistics
PATCH/api/v1/organizations/:orgId/usageJWTUpdate usage limits

Users

MethodEndpointAuthDescription
GET/api/v1/users/meJWTGet current user profile
PATCH/api/v1/users/meJWTUpdate user profile
GET/api/v1/users/me/notificationsJWTGet notification preferences
PATCH/api/v1/users/me/notificationsJWTUpdate notification preferences
GET/api/v1/users/me/subscriptionJWTGet subscription status
POST/api/v1/users/me/subscription/checkoutJWTInitiate checkout
POST/api/v1/users/me/subscription/portalJWTGet billing portal link
GET/api/v1/organizations/:orgId/usersJWTList users in organization
POST/api/v1/organizations/:orgId/users/inviteJWTInvite user to organization

Key Entities

Analysis Entity

@Entity({ schema: 'insights', name: 'analyses' })
export class Analysis extends BaseEntity {
organizationId: string;
incidentId: string;
status: string; // pending, processing, completed, failed
summary: string;
rootCause: string;
recommendations: string;
severity: string;
sourceProduct: string; // alerting, synthetics
}

RCA Entity

@Entity({ schema: 'insights', name: 'rcas' })
export class Rca extends BaseEntity {
organizationId: string;
title: string;
status: string; // draft, in_review, published
summary: string;
rootCause: string;
impact: string;
timeline: string;
createdBy: string;
}

Database

Uses the insights schema in PostgreSQL. All entities follow the snake_case naming convention for database columns.

Key Tables

TablePurpose
analysesAI-generated incident insights
analysis_eventsAnalysis processing events
rcasRoot cause analysis documents
rca_incident_linksLinks between RCAs and incidents
rca_action_itemsAction items for RCAs
webhook_configsWebhook ingestion configurations
cache_entriesAnalysis result caching
tenant_budgetsPer-org usage budgets
usersOrganization user access
audit_logsActivity audit trail

Testing

Run tests with:

npm run test:insights