<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->

# API Reference — Incident Trend Analysis

## Endpoints

| Endpoint | Method | Purpose |
|---|---|---|
| `GET /api/trends/volume` | GET | Monthly volume with trend |
| `GET /api/trends/categories` | GET | Category breakdown |
| `GET /api/trends/mttr` | GET | MTTR trend over time |
| `GET /api/trends/anomalies` | GET | Anomalous periods |
| `GET /api/trends/report` | GET | Monthly/quarterly report |

## Statistical Methods

| Method | Use Case |
|--------|---------|
| Linear regression | Volume trend direction |
| Z-score | Anomaly detection |
| Moving average | Smoothed trends |
| Chi-squared | Category distribution shift |

## Agent Script

```bash
node agent.js trend --counts 45 52 48 67 71 83 78 92
node agent.js categories --incidents-json '[{"category":"CAT-3","severity":"S1"},{"category":"CAT-1","severity":"S2"}]'
node agent.js anomalies --counts 45 52 48 120 51 47 53 --threshold 2.0
```
