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

# API Reference — Implementing Continuous Validation Platform

## Caldera REST API

| Endpoint | Method | Description |
|---|---|---|
| `/api/v2/operations` | POST | Start automated operation |
| `/api/v2/operations/{id}` | GET | Get operation status |
| `/api/v2/operations/{id}/report` | POST | Generate report |
| `/api/v2/agents` | GET | List connected agents |
| `/api/v2/schedules` | POST | Create recurring schedule |

### Start Operation Request

```json
{
  "name": "Weekly Validation",
  "adversary": {"adversary_id": "weekly-validation"},
  "planner": {"id": "atomic"},
  "auto_close": true
}
```

## Systemd Timer Configuration

```ini
# /etc/systemd/system/detection-validation.timer
[Unit]
Description=Detection Validation Timer
[Timer]
OnCalendar=Mon 02:00
Persistent=true
[Install]
WantedBy=timers.target
```

## Agent Script

```bash
# Create manifest
node agent.js create-manifest --name "Weekly" \
  --schedule "0 2 * * 1" --techniques T1003.001 T1059.001 \
  --output manifests/weekly.yaml

# Run validation
node agent.js run-manifest --manifest manifests/weekly.yaml \
  --siem-url https://splunk:8089 --output results/run.json

# Check regressions
node agent.js check-regression --current results/run.json \
  --baseline results/baseline.json

# Deploy as systemd timer
node agent.js deploy-runner --manifest manifests/weekly.yaml --method systemd
```
