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

## Scan Retention Policy

```bash
node scripts/agent.js --action scan --policy /tmp/retention_policy.json
```

## Find Expired Data

```bash
node scripts/agent.js --action find-expired --policy /tmp/retention_policy.json
```

## Execute Purge (Dry Run)

```bash
node scripts/agent.js --action purge --dry-run --expired /tmp/expired_data.json
```

## Check Legal Holds

```bash
node scripts/agent.js --action check-holds --data-categories "customer_contact,transaction"
```

## Default Retention Periods

| Category | Days | Method | Legal Basis |
|----------|------|--------|-------------|
| Transaction records | 2555 (7y) | Anonymize | Tax regulation |
| Customer contact | 730 (2y) | Hard delete | Art. 6(1)(b) |
| Server logs | 90 | Hard delete | Legitimate interest |
| Security logs | 365 | Anonymize | Art. 6(1)(f) |
| Analytics data | 790 (26m) | Anonymize | Art. 5(1)(e) |

## Output Format

```json
{
  "tool": "retention-manager",
  "action": "find-expired",
  "categories_checked": 5,
  "expired_categories": [...]
}
```
