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

## Check k-Anonymity

```bash
node scripts/agent.js --action check-k-anonymity --input /tmp/dataset.json \
  --quasi-ids "age,zipcode,gender" --k 5
```

## Aggregate Data

```bash
node scripts/agent.js --action aggregate --input /tmp/events.json \
  --group-by "country,device_type" --metrics "count,avg_duration"
```

## Add Local Noise

```bash
node scripts/agent.js --action add-noise --input /tmp/dataset.json \
  --fields "age,income" --epsilon 1.0
```

## Suppress Small Groups

```bash
node scripts/agent.js --action suppress --input /tmp/dataset.json \
  --group-by "zipcode" --min-count 5
```

## Technique Comparison

| Technique | Privacy Level | Utility Impact | When to Use |
|-----------|-------------|---------------|-------------|
| k-Anonymity check | Assessment | None | Before release |
| Aggregation | High | Medium | Standard analytics |
| Laplace noise | Configurable | Proportional to epsilon | Per-record privacy |
| Suppression | High | Removes small groups | Before publishing |

## Output Format

```json
{
  "tool": "privacy-analytics",
  "action": "check-k-anonymity",
  "k_target": 5,
  "satisfies_k_anonymity": true,
  "violations": 0
}
```
