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

# API Reference — Conducting Phishing Simulations

## Agent Script

### Commands

| Command | Description |
|---|---|
| `node agent.js plan --tier <1-4> --targets <n>` | Generate campaign plan |
| `node agent.js import-targets <csv>` | Import target list from CSV |
| `node agent.js report --campaign-id <id>` | Generate campaign report |
| `node agent.js monitor --campaign-id <id>` | Monitor active campaign |
| `node agent.js export --campaign-id <id> --format csv` | Export results |

### Examples

```bash
# Plan a tier-2 campaign for 500 users
node agent.js plan --tier 2 --targets 500 --duration 72h

# Import employee list
node agent.js import-targets /tmp/employees.csv

# Generate report after campaign completes
node agent.js report --campaign-id 1

# Real-time campaign monitoring
node agent.js monitor --campaign-id 1
```

## GoPhish API Endpoints

| Method | Endpoint | Description |
|---|---|---|
| `GET` | `/api/campaigns/` | List all campaigns |
| `POST` | `/api/campaigns/` | Create new campaign |
| `GET` | `/api/campaigns/{id}/results` | Get campaign results |
| `GET` | `/api/campaigns/{id}/summary` | Get campaign summary |
| `POST` | `/api/groups/` | Create target group |
| `POST` | `/api/smtp/` | Create sending profile |
| `POST` | `/api/templates/` | Create email template |
| `POST` | `/api/pages/` | Create landing page |

## Campaign Metrics Targets

| Metric | Target | Remediation Trigger |
|---|---|---|
| Click rate | < 5% | Department training if > 10% |
| Submission rate | < 2% | Individual training if submitted |
| Report rate | > 60% | Recognition program for reporters |
| Repeat clickers | 0 (3+ campaigns) | Mandatory 1:1 coaching |
