> For the complete documentation index, see [llms.txt](https://docs.stopbot.net/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stopbot.net/v2/api-v2-documentation/ip-lookup.md).

# IP Lookup

Use IP Lookup to retrieve geolocation, network, ASN, ISP, hostname, user type, and connection type information for an IPv4 or IPv6 address.

IP Lookup returns IP intelligence data only. It does not run the full Blocker or SmartURLs decision flow.

### Endpoint

```
GET https://api.stopbot.net/services/iplookup
```

### Parameters

| Parameter | Required | Description                     |
| --------- | -------- | ------------------------------- |
| `apikey`  | Yes      | Your STOPBOT API key            |
| `ip`      | Yes      | IPv4 or IPv6 address to inspect |

### Parameter Rules

| Parameter | Rule                                 |
| --------- | ------------------------------------ |
| `ip`      | Must be a valid IPv4 or IPv6 address |

### Example Request

```bash
curl "https://api.stopbot.net/services/iplookup?apikey={API_KEY}&ip=1.1.1.1"
```

### Example Response

```json
{
  "ip": "1.1.1.1",
  "hostname": "one.one.one.one",
  "asn": 13335,
  "userType": "hosting",
  "connectionType": "Corporate",
  "company": "Cloudflare, Inc.",
  "isp": "Cloudflare, Inc.",
  "city": "Sydney",
  "district": "",
  "region": "New South Wales",
  "postcode": "1001",
  "country": "Australia",
  "countryCode": "AU",
  "latitude": -33.8688,
  "longitude": 151.209,
  "timezone": "Australia/Sydney",
  "isAnycast": true,
  "status": "success",
  "executionTime": "3.55ms",
  "timeResponse": "2026-07-07 12:00:00"
}
```

### Invalid Input Example

If the `ip` parameter is missing or is not a valid IPv4/IPv6 address, IP Lookup returns `400 Bad Request`.

```bash
curl "https://api.stopbot.net/services/iplookup?apikey={API_KEY}&ip=not-an-ip"
```

Example response:

```json
{
  "errorMessage": "IP format is invalid.",
  "status": "failed",
  "executionTime": "25.07us",
  "timeResponse": "2026-07-07 12:00:00"
}
```

### Response Fields

| Field            | Description                                                                                                                                                        |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `ip`             | Queried IP address from the `ip` request parameter                                                                                                                 |
| `hostname`       | Hostname or PTR value resolved for the IP. If no hostname is available, the IP itself may be returned                                                              |
| `asn`            | Autonomous System Number from IP geolocation data                                                                                                                  |
| `userType`       | Network user type from IP geolocation data. Current values are `business`, `cellular`, `hosting`, and `residential`. If unavailable, STOPBOT returns `unknown`     |
| `connectionType` | Network connection type from IP geolocation data. Current values are `Cable/DSL`, `Cellular`, `Corporate`, and `Dialup`. If unavailable, STOPBOT returns `unknown` |
| `company`        | Autonomous system organization or company name from IP geolocation data. If unavailable, STOPBOT returns `unknown`                                                 |
| `isp`            | Internet service provider name from IP geolocation data. If unavailable, STOPBOT returns `unknown`                                                                 |
| `city`           | City name from IP geolocation data. If unavailable, STOPBOT may return `unknown`                                                                                   |
| `district`       | District or second subdivision from IP geolocation data when available                                                                                             |
| `region`         | Region or first subdivision from IP geolocation data. If unavailable, STOPBOT may return `unknown`                                                                 |
| `postcode`       | Postal code from IP geolocation data when available                                                                                                                |
| `country`        | Country name from IP geolocation data. If unavailable, STOPBOT returns `unknown`                                                                                   |
| `countryCode`    | Country ISO code from IP geolocation data. If unavailable, STOPBOT returns `NN`                                                                                    |
| `latitude`       | Latitude from IP geolocation data. If unavailable, the value may be `0`                                                                                            |
| `longitude`      | Longitude from IP geolocation data. If unavailable, the value may be `0`                                                                                           |
| `timezone`       | Timezone from IP geolocation data. If unavailable, STOPBOT returns `UTC`                                                                                           |
| `isAnycast`      | `true` when the IP geolocation data marks the IP as anycast; otherwise `false`                                                                                     |
| `status`         | API result status. Successful IP Lookup responses return `success`                                                                                                 |
| `executionTime`  | Server-side execution time for the request                                                                                                                         |
| `timeResponse`   | Response timestamp in `YYYY-MM-DD HH:mm:ss` format                                                                                                                 |

### User Type

The `userType` field is copied from the IP geolocation data field `traits.user_type`.

The current STOPBOT IP geolocation database contains these `userType` values:

| Value         | Meaning                                |
| ------------- | -------------------------------------- |
| `business`    | Business or organization network       |
| `cellular`    | Mobile carrier network                 |
| `hosting`     | Hosting, cloud, or data center network |
| `residential` | Residential ISP network                |

If the IP geolocation data does not provide a value, STOPBOT returns:

```
unknown
```

### Connection Type

The `connectionType` field is copied from the IP geolocation data field `traits.connection_type`.

The current STOPBOT IP geolocation database contains these `connectionType` values:

| Value       | Meaning                                               |
| ----------- | ----------------------------------------------------- |
| `Cable/DSL` | Fixed broadband connection                            |
| `Cellular`  | Mobile network connection                             |
| `Corporate` | Corporate or organization network connection category |
| `Dialup`    | Dial-up connection                                    |

If the IP geolocation data does not provide a value, STOPBOT returns:

```
unknown
```

### Error Response Fields

Failed IP Lookup responses may include:

| Field           | Description                                        |
| --------------- | -------------------------------------------------- |
| `errorMessage`  | Human-readable error message                       |
| `status`        | Failed requests return `failed`                    |
| `executionTime` | Server-side execution time for the request         |
| `timeResponse`  | Response timestamp in `YYYY-MM-DD HH:mm:ss` format |
