# Locate and risk-score an IP address

`POST /api/v1/ip`

- Authentication: Secret API key as a bearer token
- Billing: 1 credit for a fresh lookup that resolves at least one signal (a location, a network, or a positive threat flag); reserved ranges, unknown addresses and 7-day repeats are free.
- Group: IP

Locates an IPv4 or IPv6 address with the DB-IP Lite city and ASN databases and flags datacenter, Tor exit and VPN ranges from open threat lists. The flags are tri-state: `false` is a checked negative, `null` means the signal was not evaluated (list not installed, or IPv6 where a list is IPv4-only). `risk_score` sums only the signals that were checked — Tor 70, datacenter 40, VPN 30, capped at 100 — and `risk_level` buckets it with the same thresholds as email: 60 and above high, 30 and above medium. Reserved and private ranges answer `reason: "reserved_range"` with every field null.

The IP product page is marked "coming soon"; the endpoint itself works today.

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `ip` | string | yes | An IPv4 or IPv6 address. |

## Example request

```bash
curl -X POST https://spaw.co/api/v1/ip \
  -H "Authorization: Bearer sk_live_…" \
  -H "Content-Type: application/json" \
  -d '{
  "ip": "8.8.8.8"
}'
```

## Responses

### 200 — The location, network and threat flags.

```json
{
    "success": true,
    "data": {
        "ip": "8.8.8.8",
        "version": 4,
        "reason": null,
        "country": "US",
        "region": "California",
        "city": "Mountain View",
        "latitude": 37.4056,
        "longitude": -122.0775,
        "asn": 15169,
        "org": "Google LLC",
        "is_datacenter": true,
        "is_tor": false,
        "is_vpn": false,
        "risk_score": 40,
        "risk_level": "medium",
        "sources": [
            {
                "dataset": "dbip-city-lite",
                "version": "2026-09"
            },
            {
                "dataset": "dbip-asn-lite",
                "version": "2026-09"
            },
            {
                "dataset": "tor-exit-list",
                "version": "2026-09-03"
            },
            {
                "dataset": "datacenter-ranges",
                "version": "2026-09-03"
            },
            {
                "dataset": "vpn-ranges",
                "version": "2026-09-03"
            }
        ]
    },
    "meta": {
        "credits_used": 1,
        "credits_remaining": 8,
        "cache_hit": false,
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

### 401 — The key is missing, malformed, or revoked.

```json
{
    "success": false,
    "error": {
        "code": "UNAUTHENTICATED",
        "message": "Provide a valid API key as a bearer token.",
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

### 402 — The balance is empty. The lookup did not run.

```json
{
    "success": false,
    "error": {
        "code": "INSUFFICIENT_CREDITS",
        "message": "Your credit balance is empty.",
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

### 422 — The request body could not be validated; `error.errors` lists the fields.

```json
{
    "success": false,
    "error": {
        "code": "VALIDATION_FAILED",
        "message": "The email field is required.",
        "errors": {
            "email": [
                "The email field is required."
            ]
        },
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

### 429 — Over 5 requests per second for the key. Retry after the limit resets.

```json
{
    "success": false,
    "error": {
        "code": "RATE_LIMITED",
        "message": "Too many requests. Retry after the limit resets.",
        "request_id": "req_01m1kgdm4xngzmbmff68g94w0c"
    }
}
```

## Error codes

- `UNAUTHENTICATED` — https://spaw.co/docs/errors/UNAUTHENTICATED
- `VALIDATION_FAILED` — https://spaw.co/docs/errors/VALIDATION_FAILED
- `INSUFFICIENT_CREDITS` — https://spaw.co/docs/errors/INSUFFICIENT_CREDITS
- `RATE_LIMITED` — https://spaw.co/docs/errors/RATE_LIMITED

---

Canonical page: https://spaw.co/docs/api/lookup-ip · OpenAPI document: https://spaw.co/openapi.json · All endpoints: https://spaw.co/docs/api
