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

# API Reference — Breach Data Analysis

## Have I Been Pwned (HIBP) API v3

### Breached Account
```bash
curl -s -H "hibp-api-key: $HIBP_KEY" \
  "https://haveibeenpwned.com/api/v3/breachedaccount/user@example.com?truncateResponse=false"
```

### All Breaches
```bash
curl -s -H "hibp-api-key: $HIBP_KEY" "https://haveibeenpwned.com/api/v3/breaches"
```

### Single Breach
```bash
curl -s "https://haveibeenpwned.com/api/v3/breach/Adobe"
```

### Pwned Passwords (k-anonymity)
```bash
# SHA-1 hash prefix lookup — no API key needed
curl -s "https://api.pwnedpasswords.com/range/5BAA6"
```

### Rate Limits
- 10 requests per minute per API key
- Pwned Passwords: 1,500 requests per minute (no key)

## DeHashed API

### Search by Domain
```bash
curl -s -u "$DH_EMAIL:$DH_KEY" \
  "https://api.dehashed.com/search?query=domain:example.com&size=100"
```

### Search by Email
```bash
curl -s -u "$DH_EMAIL:$DH_KEY" \
  "https://api.dehashed.com/search?query=email:user@example.com"
```

### Search by Username
```bash
curl -s -u "$DH_EMAIL:$DH_KEY" \
  "https://api.dehashed.com/search?query=username:johndoe"
```

## h8mail

### Single Target
```bash
h8mail -t user@example.com --config h8mail_config.ini -o result.json
```

### Bulk Check
```bash
h8mail -t emails.txt --config h8mail_config.ini -o bulk.json
```

### Config Template
```ini
[h8mail]
snusbase_url = https://api.snusbase.com/data/search
snusbase_token = TOKEN
leak-lookup_pub = API_KEY
```

## Snusbase API

### Search
```bash
curl -s -H "Auth: $SNUSBASE_TOKEN" -H "Content-Type: application/json" \
  "https://api.snusbase.com/data/search" \
  -d '{"terms":["user@example.com"],"types":["email"]}'
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `HIBP_API_KEY` | Have I Been Pwned API key |
| `DEHASHED_EMAIL` | DeHashed account email |
| `DEHASHED_KEY` | DeHashed API key |
| `SNUSBASE_TOKEN` | Snusbase API token |
