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

# API Reference — Geolocation Intelligence

## ipinfo.io

### Single IP
```bash
curl -s "https://ipinfo.io/1.2.3.4?token=$IPINFO_TOKEN"
```

### Batch Lookup
```bash
curl -s -X POST "https://ipinfo.io/batch?token=$IPINFO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '["1.2.3.4","5.6.7.8"]'
```

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

### Rate Limits
- Free: 50,000 requests/month
- Basic: 150,000 requests/month

## MaxMind GeoLite2

### Python Usage
```python
import geoip2.database
reader = geoip2.database.Reader('GeoLite2-City.mmdb')
response = reader.city('1.2.3.4')
print(response.city.name, response.location.latitude, response.location.longitude)
```

### mmdbinspect
```bash
mmdbinspect -db GeoLite2-City.mmdb 1.2.3.4
```

## WiGLE API

### BSSID Search
```bash
curl -s -u "$WIGLE_USER:$WIGLE_KEY" \
  "https://api.wigle.net/api/v2/network/search?netid=AA:BB:CC:DD:EE:FF"
```

### Region Search
```bash
curl -s -u "$WIGLE_USER:$WIGLE_KEY" \
  "https://api.wigle.net/api/v2/network/search?latrange1=40.7&latrange2=40.8&longrange1=-74.0&longrange2=-73.9"
```

## ExifTool

### GPS Extraction
```bash
exiftool -c "%.6f" -GPSLatitude -GPSLongitude -GPSAltitude image.jpg
```

### Batch Extraction
```bash
exiftool -r -c "%.6f" -GPSPosition -FileName -json ./images/
```

### Strip GPS Data
```bash
exiftool -gps:all= image.jpg
```

## Shodan

### Host Geolocation
```bash
shodan host 1.2.3.4 --fields location.city,location.country_name,location.latitude,location.longitude
```

## Environment Variables

| Variable | Description |
|----------|-------------|
| `IPINFO_TOKEN` | ipinfo.io API token |
| `WIGLE_USER` | WiGLE API username |
| `WIGLE_KEY` | WiGLE API key |
| `MAXMIND_KEY` | MaxMind license key |
