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

# API Reference — Autonomous System Mapping

## BGPView API

### ASN Details
```bash
curl -s "https://api.bgpview.io/asn/12345" | jq '.data'
```

### ASN Prefixes
```bash
curl -s "https://api.bgpview.io/asn/12345/prefixes" | jq '.data.ipv4_prefixes[].prefix'
```

### ASN Peers
```bash
curl -s "https://api.bgpview.io/asn/12345/peers" | jq '.data.ipv4_peers[]'
```

### IP Lookup
```bash
curl -s "https://api.bgpview.io/ip/1.2.3.4" | jq '.data'
```

### Search
```bash
curl -s "https://api.bgpview.io/search?query_term=example" | jq '.data'
```

### Rate Limits
- No authentication required
- Rate limited to ~30 requests/minute

## RIPE RIS / RIPEstat

### Announced Prefixes
```bash
curl -s "https://stat.ripe.net/data/announced-prefixes/data.json?resource=AS12345"
```

### ASN Neighbours
```bash
curl -s "https://stat.ripe.net/data/asn-neighbours/data.json?resource=AS12345"
```

### Routing History
```bash
curl -s "https://stat.ripe.net/data/routing-history/data.json?resource=AS12345&starttime=2024-01-01"
```

### RPKI Validation
```bash
curl -s "https://stat.ripe.net/data/rpki-validation/data.json?resource=AS12345&prefix=1.2.3.0/24"
```

## asnmap (ProjectDiscovery)

### Domain to ASN
```bash
asnmap -d example.com -silent -json
```

### ASN to CIDRs
```bash
asnmap -a AS12345 -silent
```

### IP to ASN
```bash
asnmap -ip 1.2.3.4 -silent -json
```

## Team Cymru

### Whois Lookup
```bash
echo "1.2.3.4" | nc whois.cymru.com 43
```

### Bulk Lookup
```bash
netcat whois.cymru.com 43 < ips.txt
```

## ipinfo.io

### ASN Info
```bash
curl -s "https://ipinfo.io/AS12345?token=$IPINFO_TOKEN" | jq '.prefixes'
```

## Hurricane Electric BGP Toolkit

### Web Interface
- `https://bgp.he.net/AS12345` — ASN overview
- `https://bgp.he.net/net/1.2.3.0/24` — Prefix details

## Environment Variables

| Variable | Description |
|----------|-------------|
| `IPINFO_TOKEN` | ipinfo.io API token |
