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

# API Reference — Implementing Vulnerability Metrics Reporting

## Core KPIs

| Metric | Formula | Target |
|---|---|---|
| MTTR | median(resolved_date - discovered_date) | Critical: <3d |
| SLA Adherence | within_sla / total_closed × 100 | >95% |
| Scan Coverage | scanned_assets / total_assets × 100 | >98% |
| Risk Density | open_crit_high / total_assets × 100 | <5 per 100 |
| Recurrence Rate | reappeared / total_closed × 100 | <3% |
| Exception Rate | exceptions / total_open × 100 | <5% |

## Nessus Export API

| Endpoint | Description |
|---|---|
| `GET /scans` | List all scans with history |
| `GET /scans/{id}/export` | Export scan in CSV/JSON |
| `GET /scans/{id}/hosts` | List hosts with severity counts |

## OpenVAS GVM CLI

| Command | Description |
|---|---|
| `gvm-cli socket --xml '<get_reports/>'` | List reports |
| `gvm-cli socket --xml '<get_results/>'` | List results |

## Agent Script

```bash
# Calculate MTTR
node agent.js mttr findings.json

# SLA adherence rate
node agent.js sla findings.json

# Risk density
node agent.js density findings.json --assets 500

# Monthly trends
node agent.js trends findings.json

# Executive summary
node agent.js summary findings.json --assets 500
```
