# IP Geolocation Enrichment - Bulk IP to Location, ASN, ISP (`santamaria-automations/ip-geolocation`) Actor

Bulk enrich IP addresses with country, city, latitude/longitude, ASN, ISP, and network information. Powered by MaxMind GeoLite2. Perfect for log analysis, fraud detection, audience analytics, and security investigations. Supports IPv4 and IPv6.

- **URL**: https://apify.com/santamaria-automations/ip-geolocation.md
- **Developed by:** [Alessandro Santamaria](https://apify.com/santamaria-automations) (community)
- **Categories:** Developer tools, Lead generation, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.00 / 1,000 ip enricheds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## IP Geolocation Enrichment - Bulk IP to Location, ASN, ISP

**Know where any IP address is located.** Bulk enrich IP addresses with country, city, latitude/longitude, ASN, ISP, network, and timezone. Perfect for log analysis, fraud detection, audience analytics, and security investigations. Supports both IPv4 and IPv6.

### Features

- **Works out of the box** — no API keys or setup required
- **Bulk enrichment** — process thousands of IPs per run
- **IPv4 and IPv6** — full support for modern and legacy addressing
- **City-level geolocation** — country, region, city, postal code, latitude/longitude
- **Timezone** — IANA timezone name (e.g. `Europe/Berlin`)
- **ASN and ISP** — AS number, organization, network
- **EU flag** — `is_in_eu` boolean for GDPR workflows
- **Anonymizer detection** — flag anonymous proxies and satellite providers
- **Pay per result** — no monthly subscriptions, $1 per 1,000 IPs

### Input

| Field | Type | Required | Description |
|---|---|---|---|
| `ipAddresses` | string[] | yes | List of IP addresses (IPv4 or IPv6) to enrich |
| `includeCity` | boolean | no (default `true`) | Enrich with city, region, coordinates, timezone |
| `includeASN` | boolean | no (default `true`) | Enrich with ASN, ISP, network |

#### Example Input

```json
{
  "ipAddresses": [
    "8.8.8.8",
    "1.1.1.1",
    "213.133.98.98",
    "2001:4860:4860::8888"
  ],
  "includeCity": true,
  "includeASN": true
}
````

### Output Examples

#### Google DNS (8.8.8.8)

```json
{
  "ip": "8.8.8.8",
  "is_valid": true,
  "ip_version": 4,
  "country_iso": "US",
  "country_name": "United States",
  "continent": "North America",
  "region": null,
  "region_iso": null,
  "city": null,
  "postal_code": null,
  "latitude": 37.751,
  "longitude": -97.822,
  "accuracy_radius_km": 1000,
  "time_zone": "America/Chicago",
  "is_in_eu": false,
  "asn": 15169,
  "asn_organization": "GOOGLE",
  "isp": "GOOGLE",
  "network": "8.8.8.0/24",
  "is_anonymous_proxy": false,
  "is_satellite_provider": false,
  "error": null,
  "scraped_at": "2026-04-07T10:00:00Z"
}
```

#### Cloudflare DNS (1.1.1.1)

```json
{
  "ip": "1.1.1.1",
  "is_valid": true,
  "ip_version": 4,
  "country_iso": "US",
  "country_name": "United States",
  "continent": "North America",
  "latitude": 37.751,
  "longitude": -97.822,
  "accuracy_radius_km": 1000,
  "asn": 13335,
  "asn_organization": "CLOUDFLARENET",
  "isp": "CLOUDFLARENET",
  "network": "1.1.1.0/24",
  "is_in_eu": false,
  "scraped_at": "2026-04-07T10:00:00Z"
}
```

#### European IP - Hetzner (213.133.98.98)

```json
{
  "ip": "213.133.98.98",
  "is_valid": true,
  "ip_version": 4,
  "country_iso": "DE",
  "country_name": "Germany",
  "continent": "Europe",
  "region": "Bavaria",
  "region_iso": "BY",
  "city": "Nuremberg",
  "postal_code": "90475",
  "latitude": 49.4478,
  "longitude": 11.0683,
  "accuracy_radius_km": 20,
  "time_zone": "Europe/Berlin",
  "is_in_eu": true,
  "asn": 24940,
  "asn_organization": "HETZNER-AS",
  "isp": "HETZNER-AS",
  "network": "213.133.96.0/20",
  "scraped_at": "2026-04-07T10:00:00Z"
}
```

### Use Cases

- **Log analysis** — understand where your site visitors, API consumers, or attackers come from
- **Fraud detection** — flag logins from unexpected countries or anonymous proxies
- **Audience analytics** — enrich visitor demographics with country, region, city, timezone
- **Security investigations** — trace attack origins, identify hosting providers and ASNs
- **Ad targeting validation** — confirm geo-targeting accuracy across regions
- **GDPR compliance** — use the `is_in_eu` flag to route EU vs non-EU traffic correctly
- **Infrastructure mapping** — group traffic by ASN and CIDR network for cost attribution

### Pricing

Pay-per-event pricing keeps costs predictable:

| Event | Price |
|---|---|
| Run start | $0.001 |
| Per IP enriched | $0.001 |

**Example**: 1,000 IPs = **~$1**. Runs in seconds.

### Related Actors

- [Email Verifier](https://apify.com/santamaria-automations/email-verifier)
- [Phone Number Validator](https://apify.com/santamaria-automations/phone-validator)
- [Domain WHOIS & DNS Lookup](https://apify.com/santamaria-automations/domain-whois-dns)

### Issues & Feedback

Found a bug or have a feature request? [Open an issue on the Issues tab](https://console.apify.com/actors/stV5E3Bqrx6cnkQdt/issues) — we respond within 24 hours.

# Actor input Schema

## `ipAddresses` (type: `array`):

List of IP addresses to enrich. Supports both IPv4 (e.g. '8.8.8.8') and IPv6 (e.g. '2001:4860:4860::8888').

## `includeCity` (type: `boolean`):

Enrich with city, region, postal code, latitude/longitude, accuracy radius, and timezone.

## `includeASN` (type: `boolean`):

Enrich with AS number, AS organization, ISP, and containing CIDR network.

## `maxmindLicenseKey` (type: `string`):

Optional: Get a free key from https://www.maxmind.com/en/geolite2/signup for faster offline lookups on large batches (millions of IPs). If not provided, the actor uses a free public API (ip-api.com) — rate-limited to ~2700/hour, so best for smaller batches (<2000 IPs).

## Actor input object example

```json
{
  "ipAddresses": [
    "8.8.8.8",
    "1.1.1.1",
    "213.133.98.98",
    "2001:4860:4860::8888"
  ],
  "includeCity": true,
  "includeASN": true
}
```

# Actor output Schema

## `ipAddresses` (type: `string`):

Dataset of IP addresses enriched with full geolocation and network metadata

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "ipAddresses": [
        "8.8.8.8",
        "1.1.1.1",
        "213.133.98.98",
        "2001:4860:4860::8888"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("santamaria-automations/ip-geolocation").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "ipAddresses": [
        "8.8.8.8",
        "1.1.1.1",
        "213.133.98.98",
        "2001:4860:4860::8888",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("santamaria-automations/ip-geolocation").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "ipAddresses": [
    "8.8.8.8",
    "1.1.1.1",
    "213.133.98.98",
    "2001:4860:4860::8888"
  ]
}' |
apify call santamaria-automations/ip-geolocation --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=santamaria-automations/ip-geolocation",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "IP Geolocation Enrichment - Bulk IP to Location, ASN, ISP",
        "description": "Bulk enrich IP addresses with country, city, latitude/longitude, ASN, ISP, and network information. Powered by MaxMind GeoLite2. Perfect for log analysis, fraud detection, audience analytics, and security investigations. Supports IPv4 and IPv6.",
        "version": "1.0",
        "x-build-id": "AeBcDNP753gUX4EPl"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/santamaria-automations~ip-geolocation/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-santamaria-automations-ip-geolocation",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/santamaria-automations~ip-geolocation/runs": {
            "post": {
                "operationId": "runs-sync-santamaria-automations-ip-geolocation",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/santamaria-automations~ip-geolocation/run-sync": {
            "post": {
                "operationId": "run-sync-santamaria-automations-ip-geolocation",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "ipAddresses"
                ],
                "properties": {
                    "ipAddresses": {
                        "title": "IP Addresses",
                        "type": "array",
                        "description": "List of IP addresses to enrich. Supports both IPv4 (e.g. '8.8.8.8') and IPv6 (e.g. '2001:4860:4860::8888').",
                        "items": {
                            "type": "string"
                        }
                    },
                    "includeCity": {
                        "title": "Include City-level Data",
                        "type": "boolean",
                        "description": "Enrich with city, region, postal code, latitude/longitude, accuracy radius, and timezone.",
                        "default": true
                    },
                    "includeASN": {
                        "title": "Include ASN / ISP Data",
                        "type": "boolean",
                        "description": "Enrich with AS number, AS organization, ISP, and containing CIDR network.",
                        "default": true
                    },
                    "maxmindLicenseKey": {
                        "title": "MaxMind License Key (optional)",
                        "type": "string",
                        "description": "Optional: Get a free key from https://www.maxmind.com/en/geolite2/signup for faster offline lookups on large batches (millions of IPs). If not provided, the actor uses a free public API (ip-api.com) — rate-limited to ~2700/hour, so best for smaller batches (<2000 IPs)."
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
