> This is a page from the Castle documentation. For an index of the documentation, fetch https://castle.io/llms.txt.

# IP Intelligence API

Reputation and infrastructure data for any IP address

Castle's IP intelligence provides reputation and infrastructure metadata for an IP address. For any given IP you get the autonomous system it belongs to, a coarse location, and any proxy or VPN tunnels Castle has recently observed on it.

This is the same intelligence that powers signals like `proxy_ip`, `vpn_access`, and `residential_proxy_access` in the risk API, exposed here as a standalone, queryable product. Instead of sending an event and reading the signals on the response, you query an entity directly and get back the raw data behind it. Use it to enrich your own systems, feed your own risk logic, or sync Castle's datasets into your infrastructure.

The API is exposed as a top-level resource under `/v1`, and offers three access patterns: a real-time lookup, a batch query, and downloadable datasets.

## Authentication

The IP Intelligence API uses the same authentication as the rest of the Castle API. Send your API Secret as a Bearer token in the `Authorization` header, as the examples on this page do. HTTP Basic also works, with your API Secret as the password and an empty username. You can find and manage your API Secret on the [API keys page](https://dashboard.castle.io/settings/environment/api-keys) in the Castle dashboard.

## Look up a single IP

Look up a single IP address and get its intelligence back immediately.

```
GET /v1/ips/{value}
```

### Example request

```bash
curl -sSf -H "Authorization: Bearer $CASTLE_API_SECRET" \
  https://api.castle.io/v1/ips/1.0.105.13
```

### Example response

```json
{
    "address": "1.0.105.13",
    "type": "ipv4",
    "asn": 18144,
    "location": {
        "continent_code": "AS",
        "country_code": "JP"
    },
    "tunnels": [
        {
            "type": "proxy",
            "operator": "FloppyData residential",
            "tier": null,
            "last_seen_at": "2026-06-25T21:38:40.000Z",
            "proxy_type": "residential"
        },
        {
            "type": "proxy",
            "operator": "AnyIP residential",
            "tier": null,
            "last_seen_at": "2026-06-21T22:55:42.000Z",
            "proxy_type": "residential"
        }
    ]
}
```

### Response fields

| Field                     | Type    | Description                                                                             |
| :------------------------ | :------ | :-------------------------------------------------------------------------------------- |
| `address`                 | string  | The IP address that was looked up.                                                      |
| `type`                    | string  | The IP version, either `ipv4` or `ipv6`.                                                |
| `asn`                     | integer | The number of the autonomous system the IP belongs to.                                  |
| `location.continent_code` | string  | The two-letter continent code, for example `EU`.                                        |
| `location.country_code`   | string  | The ISO 3166-1 alpha-2 country code, for example `SE`.                                  |
| `tunnels`                 | array   | The proxy and VPN tunnels recently observed on this IP. Empty when none have been seen. |

Each entry in `tunnels` describes one tunnel observation.

| Field          | Type           | Description                                                                                                            |
| :------------- | :------------- | :--------------------------------------------------------------------------------------------------------------------- |
| `type`         | string         | The tunnel category, for example `proxy` or `vpn`.                                                                     |
| `operator`     | string or null | The provider operating the tunnel, for example `ProtonVPN`. `null` when the tunnel cannot be attributed to a provider. |
| `tier`         | string or null | The provider tier for VPNs, for example `commercial` or `enterprise`. `null` for proxies and unclassified tunnels.     |
| `proxy_type`   | string or null | A finer classification of the proxy, when available.                                                                   |
| `last_seen_at` | string         | The ISO 8601 timestamp of when the IP was last observed on this tunnel's network.                                      |

## Batch query multiple IPs

Resolve many IP addresses in a single request. This is the most efficient way to enrich a set of IPs at once.

```
POST /v1/ips/query
```

The `ips` array accepts between 1 and 1,000 addresses per request. A request outside that range is rejected.

### Example request

```bash
curl -sSf -X POST -H "Authorization: Bearer $CASTLE_API_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "ips": ["159.26.108.3", "1.0.105.13"] }' \
  https://api.castle.io/v1/ips/query
```

### Example response

```json
{
    "results": [
        {
            "address": "159.26.108.3",
            "type": "ipv4",
            "asn": 208172,
            "location": {
                "continent_code": "EU",
                "country_code": "SE"
            },
            "tunnels": []
        },
        {
            "address": "1.0.105.13",
            "type": "ipv4",
            "asn": 18144,
            "location": {
                "continent_code": "AS",
                "country_code": "JP"
            },
            "tunnels": [
                {
                    "type": "proxy",
                    "operator": "FloppyData residential",
                    "tier": null,
                    "last_seen_at": "2026-06-25T21:38:40.000Z",
                    "proxy_type": "residential"
                },
                {
                    "type": "proxy",
                    "operator": "AnyIP residential",
                    "tier": null,
                    "last_seen_at": "2026-06-21T22:55:42.000Z",
                    "proxy_type": "residential"
                }
            ]
        }
    ],
    "meta": {
        "total": 2,
        "valid": 2
    }
}
```

Each object in `results` uses the same schema as the real-time lookup. `meta.total` is the number of addresses submitted, and `meta.valid` the number of unique, parseable addresses that were resolved.

## Download IP intelligence datasets

Datasets are precomputed snapshots of Castle's IP intelligence, delivered as gzipped files. They are a good fit for bulk enrichment, offline analysis, or syncing an allow or deny list into your own infrastructure.

```
GET /v1/ips/downloads/{dataset}/{window}.{format}.gz
```

- `dataset`. The dataset to download. `proxies` is currently the only available dataset.
- `window`. The lookback window for the snapshot, one of `1d`, `7d`, `30d`, or `60d`.
- `format`. The file format to download, either `csv` or `jsonl`.

### Dataset columns

The `proxies` dataset is a tunnel feed, so each row is one tunnel observation rather than one IP address. An IP seen on several tunnels appears on several rows.

| Column         | Description                                                                       |
| :------------- | :-------------------------------------------------------------------------------- |
| `ip`           | The IP address the tunnel was observed on. Use it as the join key for your rows.  |
| `tunnel_type`  | The tunnel category, for example `proxy` or `vpn`.                                |
| `proxy_type`   | A finer classification of the proxy, when available.                              |
| `tier`         | The provider tier for VPNs, for example `commercial` or `enterprise`.             |
| `operator`     | The provider operating the tunnel, for example `ProtonVPN`.                       |
| `last_seen_at` | The ISO 8601 timestamp of when the IP was last observed on this tunnel's network. |

### Example request

```bash
curl -LfOJ -H "Authorization: Bearer $CASTLE_API_SECRET" \
  "https://api.castle.io/v1/ips/downloads/proxies/1d.csv.gz"
```

The endpoint authenticates the request and then redirects to a time-limited download URL, so follow redirects with `curl -L`. Datasets are refreshed regularly. Each request returns the most recent snapshot.
