# IP Geolocation Bulk — country, region & city for IP lists (`aimojo/ip-geolocation-bulk`) Actor

Look up country, region, city, latitude and longitude for lists of IPv4 and IPv6 addresses or a CSV file, using DB-IP Lite data. No API key and no per-IP requests.

- **URL**: https://apify.com/aimojo/ip-geolocation-bulk.md
- **Developed by:** [AI Mojo](https://apify.com/aimojo) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.21 / 1,000 ip lookups

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

### Bulk IP geolocation — IP to country, region, city and coordinates

IP Geolocation Bulk looks up the country, region, city, latitude and longitude for lists of IPv4 and IPv6 addresses or a CSV file, using DB-IP Lite data. You get one row per input entry, ready to download as JSON, CSV or Excel. It is built for marketing teams geo-targeting audiences, fraud and security analysts triaging suspicious logins and traffic, and analysts enriching log files and analytics data with locations. No API key or account with any geolocation service is needed, and no request is made per IP address: every lookup runs against a database downloaded once per run. To try it, press **Start**: the prefilled three addresses return in seconds.

### How to look up IP address locations in bulk

1. Paste your addresses into **IP addresses**, one per line. IPv4 and IPv6 addresses can be mixed.
2. Or, instead of (or as well as) the list, put a link to your file in **CSV file URL**. The file can be a CSV or plain-text file with one IP address per row.
3. If your CSV file has a header row, put the name of the column that holds the IP addresses in **CSV IP column**.
4. Press **Start** and wait for the run to finish.
5. Open the **Output** tab to view the rows, then download them as JSON, CSV, Excel, XML or HTML.
6. To automate it, call the actor through the Apify API, or connect it to Make, Zapier, Google Sheets or a webhook with Apify integrations.

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `ips` | array of strings | none | **IP addresses**: the IPv4 and IPv6 addresses to look up, one per line. Up to 100,000 entries. |
| `csvUrl` | string | none | **CSV file URL**: an http or https link to a CSV or plain-text file with one IP address per row. |
| `csvColumn` | string | none | **CSV IP column**: the header name of the column that holds the IP addresses. When set, the file's first row is read as a header. When empty, the first column of each row is used, and a first row whose first cell is not an IP address is skipped as a header. |

Give the IP address list, a CSV file URL, or both. Example input (the prefilled values):

```json
{
  "ips": ["8.8.8.8", "1.1.1.1", "2606:4700:4700::1111"]
}
```

Example input with a CSV file whose IP addresses are in a column named `client_ip`:

```json
{
  "csvUrl": "https://example.com/exports/logins.csv",
  "csvColumn": "client_ip"
}
```

### Output

Each dataset item is one input entry. An entry with no location still gets a row, with a `reason` that says why.

Example row (values come from the current month's DB-IP City Lite database and can change from month to month):

```json
{
  "id": "81.2.69.142",
  "ip": "81.2.69.142",
  "version": 4,
  "countryCode": "GB",
  "countryName": "United Kingdom",
  "region": "England",
  "city": "London",
  "latitude": 51.5143,
  "longitude": -0.0912,
  "attribution": "IP geolocation by DB-IP (https://db-ip.com), licensed under CC BY 4.0",
  "reason": null
}
```

| Field | Type | Description |
|---|---|---|
| `id` | string | **Input entry**: the input entry as given, with surrounding whitespace trimmed. Unique within a run. |
| `ip` | string or null | **IP address**: the IP address that was looked up. Null when the input entry is not an IP address. |
| `version` | integer or null | **IP version**: 4 for an IPv4 address, 6 for an IPv6 address. Null when the input entry is not an IP address. |
| `countryCode` | string or null | **Country code**: the country as an ISO 3166-1 alpha-2 code. Null when the address has no location. |
| `countryName` | string or null | **Country**: the country name in English. Null when the address has no location. |
| `region` | string or null | **Region**: the first-level subdivision (state, province or region) in English. Null when the database has no region for the address. |
| `city` | string or null | **City**: the city name in English. Null when the database has no city for the address. |
| `latitude` | number or null | **Latitude**: approximate latitude in decimal degrees (north positive). It marks the city or region, not a street address. Null when the database has no coordinates for the address. |
| `longitude` | number or null | **Longitude**: approximate longitude in decimal degrees (east positive). It marks the city or region, not a street address. Null when the database has no coordinates for the address. |
| `attribution` | string | **Attribution**: the data source credit required by the licence, the same on every row. |
| `reason` | string or null | **No-location reason**: `invalid_ip` (the entry is not an IP address), `reserved_ip` (a private, loopback or other reserved address, not looked up) or `not_found` (the database has no record). Null when the address was found. |

The run also saves a short summary, including which month's database was used, in the **Run summary** output.

### Pricing

This actor uses pay-per-event pricing: you pay for each IP lookup row delivered to your dataset, and nothing for the database download or the CSV file.

#### How much does it cost to look up 1,000 IP addresses?

$0.30 per 1,000 IP lookups ($0.0003 per lookup), lower on paid Apify plans.

- Every input entry is one result and one charge, including invalid, private or not-found entries. Each of those still gets a row, with a `reason` that says why it has no location.
- Duplicate entries are looked up and charged once.
- The run stops when it reaches your **maximum charge per run** setting, so you never pay more than you set.
- Apify adds a small fee for each run start.

For example, a list of 10,000 distinct IP addresses costs about $3.00, and the full 500,000-entry run limit costs about $150.

### Limits & accuracy

- Up to 100,000 entries in the IP address list and 500,000 distinct entries per run in total. A larger input is rejected before any row is written.
- CSV files can be up to 25 MB.
- Duplicate entries are removed; the first one is kept, in input order.
- Locations come from DB-IP IP to City Lite, which is updated monthly. Its city-level accuracy is lower than in paid databases, and coordinates mark a city or region, not a street address.
- DB-IP City Lite has no ISP, ASN or connection-type fields, so this actor does not return them.

### Compliance & licences

- The only outside requests are to DB-IP for the City Lite database and the download of your own CSV file URL. The database is downloaded at most once per run, and not at all when a copy cached earlier in the month is reused. The actor may first ask for the current month's file and use the previous month's when it is not published yet, and it retries once on a temporary error. Your IP addresses are never sent to any outside service.
- IP geolocation data by [DB-IP.com](https://db-ip.com), licensed under [Creative Commons Attribution 4.0 International (CC BY 4.0)](https://creativecommons.org/licenses/by/4.0/). The licence requires this attribution link to DB-IP.com, and every row also carries it in the `attribution` field. Keep that credit when you publish or share the data.
- Database lookups use the [maxmind](https://github.com/runk/node-maxmind) library, MIT licence, Copyright (c) 2026 Dmitry Shirokov.
- CSV files are read with the [csv-parse](https://csv.js.org/parse) library, MIT licence, Copyright (c) 2010 Adaltas.

### FAQ

#### Is it legal to use IP geolocation?

IP geolocation is widely used for fraud prevention, security, content localisation and analytics. The actor only looks up addresses you supply in a public, openly licensed database, and it returns an approximate city or region, never a person or street address. An IP address can still count as personal data under laws such as the GDPR, so make sure you have a lawful reason to process the addresses you upload. If you are unsure, ask a lawyer about your use case.

#### Why does a row have no location?

The `reason` field says why: `invalid_ip` when the entry is not an IP address, `reserved_ip` when it is a private, loopback or other reserved address, and `not_found` when the database has no record for it.

#### Can I get the ISP or ASN for an IP address?

No. The free DB-IP City Lite database has no ISP, ASN or connection-type data.

#### Where can I report an issue or request a feature?

Open the **Issues** tab on this actor's page and describe the input and what you expected.

# Changelog

This Actor's version history is a separate document: https://apify.com/aimojo/ip-geolocation-bulk/changelog.md

# Actor input Schema

## `ips` (type: `array`):

The IPv4 and IPv6 addresses to look up, one per line. Give this list, a CSV file URL, or both; duplicates are looked up once.

## `csvUrl` (type: `string`):

Link (http or https) to a CSV or plain-text file with one IP address per row. Use it instead of, or as well as, the IP address list.

## `csvColumn` (type: `string`):

The header name of the column that holds the IP addresses. When set, the file's first row is read as a header. When empty, the first column of each row is used, and a first row whose first cell is not an IP address is skipped as a header.

## Actor input object example

```json
{
  "ips": [
    "8.8.8.8",
    "1.1.1.1",
    "2606:4700:4700::1111"
  ]
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `summary` (type: `string`):

No description

# 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 = {
    "ips": [
        "8.8.8.8",
        "1.1.1.1",
        "2606:4700:4700::1111"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("aimojo/ip-geolocation-bulk").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 = { "ips": [
        "8.8.8.8",
        "1.1.1.1",
        "2606:4700:4700::1111",
    ] }

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

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

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

```

## CLI example

```bash
echo '{
  "ips": [
    "8.8.8.8",
    "1.1.1.1",
    "2606:4700:4700::1111"
  ]
}' |
apify call aimojo/ip-geolocation-bulk --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,aimojo/ip-geolocation-bulk"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/UkNf8Nbgt0VGAfdyg/builds/8VW96Hk7do5ijJuId/openapi.json
