To run a bulk IP lookup on a CSV without losing rows, set aside the cells that aren't IP addresses, send the rest to a bulk endpoint in requests of up to 50,000 addresses with a 60-second timeout, and match each result to its row by position. Then write every row back with a status and check that the counts add up.
IPGeolocation.io's bulk endpoint, POST /v3/ipgeo-bulk, takes IPv4 and IPv6 addresses and returns one result per address, in the order you sent them; a 10,000-row file fits in a single request. An address it can't look up, such as a private one, comes back as a short message in its place and costs no credits. The Python script below uses the IPGeolocation.io IP Geolocation API to enrich a CSV of any shape, keeps every original column, writes the rows that need another try to their own file, and picks up where it stopped when you run it again.
TL;DR
A bulk IP lookup on a CSV keeps every row when each row leaves with one of four statuses (enriched, skipped, no data, or retry) and a checkpoint records every answer, so running the same command again retries only the rows still waiting.
- A 10,000-row file is one request. In our test, 8,912 unique addresses made a request body of about 160 KB, and the answer arrived in 2.2 seconds.
- A request your client gives up on is still charged if our server finished it, and a retry is charged again, so set the timeout before you send anything.
- A 429 from IPGeolocation.io means a usage limit on your account, such as credits used up, not that you sent too fast. Stop, fix the account, and rerun.
- Rows in must equal enriched + skipped + no data + retry. The script refuses to finish quietly if they don't.
Four places a row can end up
In this script, every row ends up in one of four places: enriched, skipped, no data, or retry. Those statuses are the fix, because rows go missing in the code around a bulk lookup, not in the lookup itself. A blank cell stops the whole request before it leaves your machine, results get joined back to rows by comparing IP text that no longer matches, a request that timed out gets skipped, or the script crashes after the lookups but before the file is written. Each of those turns into rows that silently aren't there.
With a status on every row, a row is never missing, only in a known place:
- enriched: the lookup returned data.
- skipped: the cell isn't an IP address (blank, "null", a repeated header row, a typo), so it was never sent.
- no data: the API answered with a message for a private, reserved, or bogon address, which has no public data. This is final, and it costs nothing.
- retry: the row has no answer yet. Its request got no usable response, the run stopped on a 429 or another account or request error, or the address isn't in our database yet and may be after a later data update.
The four statuses are our own bookkeeping, not an industry standard, and what matters is that they add up: rows in = enriched + skipped + no data + retry. The script checks that sum before it reports success, writes every row to enriched.csv, and copies the retry rows to failed.csv so you can see what's left.

Before you start
Check these before writing any code:
- Python 3.10 or later. Run
python3 --version. The official SDK needs 3.10, and we tested this tutorial on Python 3.10 and 3.14. - The SDK is installed. Run
pip install "ipgeolocationio>=3,<4", thenpython3 -c "import ipgeolocation", which should print nothing. The package installs asipgeolocationioand imports asipgeolocation; the official IPGeolocation.io Python SDK documents every class used below. We used version 3.0.1. - An API key on a paid plan, or on a trial of one, in an environment variable:
export IPGEOLOCATION_API_KEY="your_key". Bulk lookups are part of paid plans, and a free key gets a 401 from the bulk endpoint. - A UTF-8 CSV with a header row and a column of IP addresses. To follow along, save these 12 lines as
sample.csv:
order_id,ip,plan
1001,185.220.101.44,starter
1002,165.227.0.0,plus
1003,2001:4860:4860::8888,starter
1004,,starter
1005,10.0.0.1,pro
1006,8.8.8.8,plus
1007,null,starter
1008, 107.161.145.198 ,pro
1009,ip,plus
1010,8.8.8.8,starter
1011,203.0.113.7,plus
1012,2.56.188.34,pro
The sample has the problems real exports have: a blank cell, the word "null", a stray copy of the header, an address padded with spaces, a repeat, an IPv6 address, a private address, and one from a range reserved for documentation.
If you'd rather stay in a spreadsheet than write code, the IPGEO_BULK formula in our Google Sheets integration sends a range to the same endpoint and keeps blank cells in line with their rows.
Step 1: Read every row and clean the IP column
Each step adds to one file, enrich_csv.py, in order. Start it with the imports and the settings:
"""Enrich every row of a CSV with IP data from the IPGeolocation.io bulk API.
Usage: python3 enrich_csv.py signups.csv ip
Writes enriched.csv (every input row, with a lookup_status) and failed.csv
(the rows to run again). Run the same command again to retry only those rows.
"""
import csv
import ipaddress
import json
import os
import sys
import time
from collections import Counter
from pathlib import Path
from ipgeolocation import (
ApiException,
BulkLookupIpGeolocationRequest,
BulkLookupSuccess,
ClientClosedRequestException,
IpGeolocationClient,
IpGeolocationClientConfig,
RateLimitException,
SerializationException,
ServerErrorException,
TransportException,
)
MAX_PER_REQUEST = 50_000 # the most one /v3/ipgeo-bulk request accepts
FIELDS = [
"location.country_code2", "location.city",
"asn.as_number", "asn.organization", "company.name",
]
NEW_COLUMNS = ["country", "city", "asn", "asn_org", "company", "lookup_status", "lookup_error"]
CHECKPOINT = Path("lookups.jsonl")
STATUSES = ("enriched", "skipped", "no data", "retry") # every row ends with exactly one
FINAL = {"enriched", "no data"} # answers a rerun doesn't need to ask for again
FIELDS asks the API for only the five values the script writes, and NEW_COLUMNS names the columns they land in, plus the status and the reason. To add a column later, add its field path here and its value in to_columns() in Step 2, then run the job in a fresh folder: the checkpoint from Step 4 would otherwise reuse answers that don't have the new field.
Now the two functions that read the file and decide whether a cell holds an IP address:
# Step 1: read every row and clean the IP column
def read_rows(path, ip_column):
# utf-8-sig removes the byte-order mark some spreadsheet exports put before the first header
with open(path, newline="", encoding="utf-8-sig") as f:
reader = csv.DictReader(f)
fieldnames = reader.fieldnames or []
if ip_column not in fieldnames:
raise SystemExit(f"No column named {ip_column!r}. The file has: {fieldnames}")
# Stop before any lookup if writing the output would overwrite or drop a cell
repeated = sorted({name for name in fieldnames if fieldnames.count(name) > 1})
clashing = sorted(set(fieldnames) & set(NEW_COLUMNS))
if repeated or clashing:
raise SystemExit(f"Rename these columns first. Repeated: {repeated}. Added by this script: {clashing}")
rows = []
for row in reader:
if None in row: # DictReader files any cells beyond the header under None
raise SystemExit(f"Line {reader.line_num} has more cells than the header; fix it first.")
rows.append(row)
return fieldnames, rows
def clean_ip(value):
"""Return the address in standard form, or None if the cell isn't an IP address."""
try:
return str(ipaddress.ip_address((value or "").strip()))
except ValueError:
return None # blank, "null", a repeated header, a hostname, a typo
read_rows() keeps every column of every row as text, so order IDs, ZIP codes, and dates come back exactly as they went in. To keep that promise, it stops before any lookup if the file repeats a column name, already has a column the script adds (such as city), or has a row with more cells than the header, because writing the output would overwrite or drop those cells; the message names the columns or the line to fix. The file is opened with newline="" because Python's csv documentation warns that without it, line breaks inside quoted fields aren't read correctly. clean_ip() lets Python's ipaddress module decide what counts as an address and writes each one in a single standard form, so " 107.161.145.198 " and 107.161.145.198 become the same address.
Why clean the column at all, if the API answers bad entries with a message? Our support team sees this more than any other bulk mistake: customers send blank cells, "null" strings, and header rows straight into the request. Those entries cost nothing, but they bloat the request and fill the response with error objects. With the Python SDK it's worse: one blank entry makes the SDK refuse the whole request with a ValidationException before anything is sent. Private and reserved addresses are different. The API answers them for free, so you don't need to strip them.
Check the two functions on the sample:
python3 -c "from enrich_csv import read_rows, clean_ip; names, rows = read_rows('sample.csv', 'ip'); print(names); print([clean_ip(r['ip']) for r in rows])"
You should see:
['order_id', 'ip', 'plan']
['185.220.101.44', '165.227.0.0', '2001:4860:4860::8888', None, '10.0.0.1', '8.8.8.8', None, '107.161.145.198', None, '8.8.8.8', '203.0.113.7', '2.56.188.34']
Three rows come back as None: the blank cell, "null", and the stray header. They'll be marked skipped. So will cells that aren't a single plain address, such as 203.0.113.5:443 with a port, the range 203.0.113.0/24, or 010.1.2.3 with a leading zero, which ipaddress rejects; fix those in the source file if you want them looked up. If you see No column named 'ip', the message lists the columns the file does have; pass the right name as the second argument.
Step 2: Send the IPs in one bulk request
A 10,000-row file goes to the bulk endpoint as a single request. It fits well under the 50,000-entry limit, and we recommend one request for a job this size: 10,000 addresses make a body of roughly 150 to 200 KB, well below the size limits proxies and servers usually set, and the lookup itself typically takes 1 to 3 seconds on our servers. You only need smaller requests if your own network or proxy cuts connections off early.
Add the function that turns one result into columns first:
# Step 2: send the IPs in one bulk request (or one per 50,000)
def to_columns(ip, item):
if isinstance(item, BulkLookupSuccess):
data = item.data
loc, asn, company = data.location, data.asn, data.company
return {
"country": (loc.country_code2 if loc else None) or "",
"city": (loc.city if loc else None) or "",
"asn": (asn.as_number if asn else None) or "",
"asn_org": (asn.organization if asn else None) or "",
"company": (company.name if company else None) or "",
"lookup_status": "enriched",
"lookup_error": "",
}
# A message object has no "ip", so the address comes from its position in the request.
# Private, reserved, and multicast addresses never have data; a public one may be added later.
address = ipaddress.ip_address(ip)
status = "retry" if address.is_global and not address.is_multicast else "no data"
return {**dict.fromkeys(NEW_COLUMNS, ""), "lookup_status": status,
"lookup_error": item.error.message or "no data returned"}
A result is either data or a message. For a message, to_columns() tells the two kinds apart by the address, not the message text, because the API documentation says message wording isn't a stable code. Python's ipaddress module reports whether an address is globally reachable under the IANA special-purpose registries. A message for an address that isn't (private, reserved, documentation ranges), or for a multicast address, which that check lets through, means no data, final. A message for a public address means it isn't in our database yet, so the row goes to retry: we rebuild our data once a day, and a run after the next build may find it. Retrying costs nothing until the address returns data.
Then the function that sends a request:
def lookup(client, ips):
response = client.bulk_lookup_ip_geolocation(
BulkLookupIpGeolocationRequest(ips=ips, fields=FIELDS)
)
meta = response.metadata
with_data = sum(isinstance(item, BulkLookupSuccess) for item in response.data)
print(f"sent {len(ips)} IPs in {meta.duration_ms / 1000:.1f} s, {with_data} returned data, "
f"credits charged: {meta.credits_charged}")
# The SDK has already checked there is one result per address sent; zip pairs them by position.
return {ip: to_columns(ip, item) for ip, item in zip(ips, response.data)}, meta.credits_charged or 0
The pairing in the last line is the part that keeps rows from going missing. The API returns its results in exactly the order of the request, which we guarantee, and the SDK raises a SerializationException if the number of results ever differs from the number of addresses sent. Position is the only safe key. An entry the API couldn't look up comes back as {"message": "..."} with no IP in it, and an IPv6 address can come back written differently from how you sent it: 2001:4860:4860::8888 returns as 2001:4860:4860:0:0:0:0:8888. RFC 5952 lists the many ways one IPv6 address can be written and the text searches that fail because of it.

FIELDS keeps the response small. We recommend fields on the bulk endpoint even for one or two columns: the server takes about as long either way, but a 10,000-row response trimmed from several megabytes to a few hundred kilobytes downloads and parses noticeably faster. All five fields here come with the base lookup at 1 credit per address, as the test run in Step 6 shows. The full parameter list is in the bulk endpoint reference.
Try one request with three addresses:
python3 - <<'EOF'
import os
from ipgeolocation import ApiException, IpGeolocationClient, IpGeolocationClientConfig
from enrich_csv import lookup
config = IpGeolocationClientConfig(api_key=os.environ["IPGEOLOCATION_API_KEY"], read_timeout=60)
try:
with IpGeolocationClient(config) as client:
results, credits = lookup(client, ["2001:4860:4860::8888", "10.0.0.1", "165.227.0.0"])
except ApiException as exc:
raise SystemExit(f"HTTP {exc.status_code}: {exc.api_message}")
for ip, columns in results.items():
print(ip, columns["lookup_status"], columns["country"], columns["lookup_error"])
EOF
You should see two addresses with data, one bogon, and 2 credits charged:
sent 3 IPs in 0.6 s, 2 returned data, credits charged: 2
2001:4860:4860::8888 enriched US
10.0.0.1 no data '10.0.0.1' is a bogon IP address.
165.227.0.0 enriched US
The credits figure is the X-Credits-Charged header the API sends with every successful response, which the SDK exposes as metadata. The time depends on where you run it. If you get HTTP 401, the key is wrong or belongs to the free plan.
Step 3: Retry a request that failed, or stop the run
Two different things can go wrong. An entry can come back as a message, which Step 2 already handles, while the rest of the request succeeds. Or the whole request can fail, and then what you do depends on why:
| What Came Back | What the Script Does | Charged? |
|---|---|---|
| A message for a private or reserved address | Marks the row no data; final | No |
| A message for a public address not in our database yet | Marks the row retry for a later run | No |
| No response: a timeout, a dropped connection, or a 499 | Tries once more after 5 seconds, then marks the rows retry | Yes, if our server finished the request, and the retry again |
| A 5xx server error | Tries once more after 5 seconds, then marks the rows retry | No |
| 429 | Stops, saves what it has, and tells you to fix the account | No |
| 400, 401, 402, 403, 413, or 415 | Stops: the request, the key, or the account needs a change | No |

Two rows of that table differ from generic retry advice. A request with no response isn't free to repeat: when a client gives up before the response arrives, our server still finishes the lookup and charges for every valid address, and a retry is a new lookup charged again. That's why the script sets a 60-second read timeout, twice the SDK's default of 30. It still tries once more, because rerunning those rows later would send the same addresses at the same cost, and a dropped connection is often brief. It stops after one retry so a longer outage doesn't turn into repeated charges. And a 429 isn't a speed limit. IPGeolocation.io has no per-second or per-minute limits; a 429 means a usage limit on the account: credits used up with overage turned off, the overage limit reached, or a subscription that has been deleted. A retry a few seconds later gets the same 429.
Add the retry logic:
# Step 3: retry a request that got no answer once, stop on a 429
class StopRun(Exception):
pass
def lookup_with_retry(client, ips):
for attempt in (1, 2):
try:
return lookup(client, ips)
except RateLimitException as exc:
# A 429 from IPGeolocation.io is a usage limit on the account, not speed: waiting won't help
raise StopRun(f"429, stopping: {exc.api_message}") from exc
except (TransportException, ClientClosedRequestException, ServerErrorException) as exc:
# RequestTimeoutException is a TransportException. A timed-out request the server
# finished is charged anyway, and a retry is charged again; a 5xx isn't charged.
if attempt == 2:
print(f"no answer after 2 tries ({type(exc).__name__}); these rows go to failed.csv")
return {}, 0
print(f"no answer ({type(exc).__name__}); trying once more in 5 seconds")
time.sleep(5)
When both tries fail, the function returns no results for that request, and Step 5 marks its rows retry. To see it happen, we ran the sample in a fresh folder with the client settings in main() (Step 6) changed to read_timeout=0, since the SDK won't accept a connect timeout longer than the read timeout:
12 rows, 8 unique IPs, 8 to look up
no answer (RequestTimeoutException); trying once more in 5 seconds
no answer after 2 tries (RequestTimeoutException); these rows go to failed.csv
rows in: 12, rows out: 12, enriched: 0, skipped: 3, no data: 0, retry: 9
credits reported in responses received: 0
9 rows are in failed.csv: run the same command later to try them again.
No row disappeared: all 12 are in enriched.csv, and the 9 with an address are in failed.csv. The 0 is what the responses reported, and none arrived. If our servers finished either request, it was charged anyway; the script never saw the bill.
Step 4: Save progress before the next request
Every answer goes into a checkpoint file before the script sends anything else. A run that crashes, stops on a 429, or works through a file longer than 50,000 unique addresses keeps every answer it has already saved, and the next run skips them instead of paying for them again.
# Step 4: save progress before the next request
def load_checkpoint():
done = {}
if CHECKPOINT.exists():
with CHECKPOINT.open(encoding="utf-8") as f:
for line in f:
try:
entry = json.loads(line)
except ValueError:
continue # a half-written last line from a run that was killed
done[entry["ip"]] = entry["columns"]
return done
def save_checkpoint(results):
with CHECKPOINT.open("a", encoding="utf-8") as f:
f.write("\n") # start on a fresh line, even after a half-written line from a killed run
for ip, columns in results.items():
f.write(json.dumps({"ip": ip, "columns": columns}) + "\n")
f.flush()
os.fsync(f.fileno())
lookups.jsonl holds one line per address with the columns it got. os.fsync() makes sure the lines are on disk, not just in a buffer, before the next request goes out. A half-written line from a killed run is skipped on the next read, and each save starts on a fresh line so that half line can't swallow the next answer. On a rerun, addresses whose status is enriched or no data are final and aren't sent again; addresses marked retry are. The file sits in the folder you run the script from, so run each job in its own folder.
Step 5: Write enriched.csv and failed.csv
The output has every input row, in input order, with its original cells untouched and the new columns added at the end:
# Step 5: write enriched.csv and failed.csv
def write_outputs(fieldnames, rows, ip_column, done):
with open("enriched.csv", "w", newline="", encoding="utf-8") as e, \
open("failed.csv", "w", newline="", encoding="utf-8") as f:
enriched = csv.DictWriter(e, fieldnames + NEW_COLUMNS, extrasaction="ignore")
failed = csv.DictWriter(f, fieldnames, extrasaction="ignore")
enriched.writeheader()
failed.writeheader()
for row in rows:
ip = clean_ip(row[ip_column])
if ip is None:
columns = {**dict.fromkeys(NEW_COLUMNS, ""), "lookup_status": "skipped",
"lookup_error": f"not an IP address: {row[ip_column]!r}"}
else:
columns = done.get(ip) or {**dict.fromkeys(NEW_COLUMNS, ""), "lookup_status": "retry",
"lookup_error": "no answer yet"}
enriched.writerow({**row, **columns})
if columns["lookup_status"] == "retry":
failed.writerow(row)
Rows are written from the original file, not from the results, so a repeated address fills every row it appears on, and a row whose address never got an answer still appears, marked retry with the reason. Both files go into the folder you run the script from and are rewritten in full on every run, so after a rerun enriched.csv holds each row's latest status. failed.csv holds the retry rows with only their original columns, so you can see what's left. You don't feed it back in: running the same command on the original file retries exactly those rows, thanks to the checkpoint. Skipped rows stay in enriched.csv with the cell that failed in lookup_error; filter on lookup_status to send them to whoever owns the data.
Step 6: Check that no row went missing
The last piece reads enriched.csv back from disk, counts its rows and their statuses, and refuses to call the run a success if they don't match the input. Add it with main():
# Step 6: check that no row went missing
def check_counts(rows):
# Count from the file on disk, the way the next person to open it will
with open("enriched.csv", newline="", encoding="utf-8") as f:
statuses = Counter(row["lookup_status"] for row in csv.DictReader(f))
written = sum(statuses.values())
print(f"rows in: {len(rows)}, rows out: {written}, "
+ ", ".join(f"{s}: {statuses[s]}" for s in STATUSES))
if written != len(rows) or sum(statuses[s] for s in STATUSES) != written:
raise SystemExit("Row counts don't match: check enriched.csv before using it.")
return statuses
def main(path, ip_column):
api_key = os.environ.get("IPGEOLOCATION_API_KEY")
if not api_key:
raise SystemExit("Set IPGEOLOCATION_API_KEY to your API key first.")
# Every run rewrites these files, so the input can't be one of them
outputs = {Path(name).resolve() for name in ("enriched.csv", "failed.csv", CHECKPOINT)}
if Path(path).resolve() in outputs:
raise SystemExit(f"{path} is a file this script writes; rename it or run from another folder.")
fieldnames, rows = read_rows(path, ip_column)
done = load_checkpoint()
# Each address once, in first-seen order: a repeated address is charged every time it's sent
unique = dict.fromkeys(ip for ip in (clean_ip(r[ip_column]) for r in rows) if ip)
todo = [ip for ip in unique if done.get(ip, {}).get("lookup_status") not in FINAL]
print(f"{len(rows)} rows, {len(unique)} unique IPs, {len(todo)} to look up")
stopped = None
credits = 0
# A 60-second read timeout: the SDK's default is 30, and a request the client gives up on is still charged
config = IpGeolocationClientConfig(api_key=api_key, read_timeout=60)
try:
with IpGeolocationClient(config) as client:
for start in range(0, len(todo), MAX_PER_REQUEST):
results, charged = lookup_with_retry(client, todo[start:start + MAX_PER_REQUEST])
credits += charged
save_checkpoint(results)
done.update(results)
except StopRun as exc:
stopped = str(exc)
except ApiException as exc:
# 400, 401, 402, 403, 413, 415: the request or the account needs a fix, so don't retry
stopped = f"HTTP {exc.status_code}, stopping: {exc.api_message}"
except SerializationException as exc:
# A response that can't be read or paired by position: none of it is used
stopped = f"unreadable response, stopping: {exc}"
write_outputs(fieldnames, rows, ip_column, done)
statuses = check_counts(rows)
print(f"credits reported in responses received: {credits}")
if stopped:
raise SystemExit(f"{stopped}\nFix it, then run the same command: rows already answered are skipped.")
if statuses["retry"]:
print(f"{statuses['retry']} rows are in failed.csv: run the same command later to try them again.")
if __name__ == "__main__":
if len(sys.argv) != 3:
raise SystemExit("Usage: python3 enrich_csv.py signups.csv ip")
main(sys.argv[1], sys.argv[2])
main() sends each unique address once, because a repeated address is charged every time it's sent, and the results fill every row that shares it. Even when the run stops on a 429, an account error, or a response it can't read, it still writes both files and checks the counts first, so a stopped run leaves every row in a known state. It refuses to start if the input is one of the files it writes (enriched.csv, failed.csv, or lookups.jsonl), since the run would overwrite it. The last line totals the credits the responses reported; a request that timed out reported nothing, even if it was charged.
Run it on the sample:
python3 enrich_csv.py sample.csv ip
12 rows, 8 unique IPs, 8 to look up
sent 8 IPs in 0.6 s, 6 returned data, credits charged: 6
rows in: 12, rows out: 12, enriched: 7, skipped: 3, no data: 2, retry: 0
credits reported in responses received: 6
enriched.csv starts like this:
order_id,ip,plan,country,city,asn,asn_org,company,lookup_status,lookup_error
1001,185.220.101.44,starter,DE,Berlin,AS60729,Stiftung Erneuerbare Freiheit,ForPrivacyNET,enriched,
1002,165.227.0.0,plus,US,Fremont,AS14061,"DigitalOcean, LLC","DigitalOcean, LLC",enriched,
1003,2001:4860:4860::8888,starter,US,Mountain View,AS15169,Google LLC,Google LLC,enriched,
1004,,starter,,,,,,skipped,not an IP address: ''
1005,10.0.0.1,pro,,,,,,no data,'10.0.0.1' is a bogon IP address.
Twelve rows in, twelve out. Eight unique addresses went out and six returned data, so the run cost 6 credits: the two bogons were free, and the repeated 8.8.8.8 was sent once. The Berlin row shows why the ASN organization and the company are separate columns: the first is the network that announces the address, the second is the organization registered for it, and they can differ when a block holder assigns space to someone else.
Then we ran it on a 10,000-row test file built from public cloud and DNS addresses, with repeats, blank cells, "null" and "N/A" strings, stray headers, and private and documentation addresses mixed in, on November 25, 2026, on Python 3.14:
10000 rows, 8912 unique IPs, 8912 to look up
sent 8912 IPs in 2.2 s, 8813 returned data, credits charged: 8813
rows in: 10000, rows out: 10000, enriched: 9805, skipped: 95, no data: 100, retry: 0
One request carried all 8,912 unique addresses, a body of about 160 KB, and the answer came back in 2.2 seconds as timed by the SDK from our test machine. The 8,813 credits match the 8,813 addresses that returned data, at 1 credit each, which is the check our credits help article describes for bulk requests. A second run on Python 3.10 printed 0 to look up and charged nothing. To keep a running record of what each job costs, log the credits each request uses.
Before you run it on your own data
- Keep the key out of the code. Read it from the environment, as the script does, and keep it out of logs and commits. The SDK hides the key in its error messages.
- One job per folder.
lookups.jsonlkeeps answers without a date, so a new job in the same folder would reuse old answers. Start each job in a fresh folder, or delete the checkpoint when the answers are older than you want. - Add security data if you need it. Add
include=["security"]to the request and fields such assecurity.is_vpnandsecurityto.threat_score FIELDS, with matching columns, and run in a fresh folder. Each address that returns data then costs 3 credits instead of 1. - Larger files can run in parallel. For files far over 50,000 unique addresses, split the file and run one copy of the script per part at the same time, each in its own folder with its own checkpoint; we set no cap on concurrent bulk requests.
- Today's data describes the address today. Enriching last year's signups tells you who holds each address now, which may not be who held it then.
- For millions of rows on a schedule, compare a database. When a database fits better than the API walks through the trade-offs.
Bulk IP data from IPGeolocation.io
IPGeolocation.io's bulk endpoint returns the same data as a single lookup, for up to 50,000 addresses at a time. One request can cover geolocation, security data (VPN, proxy, and Tor detection with a threat score), ASN, company, abuse contact, and time zone data, and the same API key parses user agents. It's a remarkably complete record for one call: the tutorial above used five fields, optional modules such as security and abuse contact are turned on with include, and fields picks the values you want back.
Only entries that return data are charged, every response states its cost in X-Credits-Charged, and there's no per-second limit to pace a batch job around. Bulk lookups are part of every paid plan; compare them on the pricing page, or ask our team for a trial of a paid plan to test the script on your own file.
Frequently asked questions
Not in a bulk request on the free plan. Bulk lookups need a paid IPGeolocation.io plan, starting at $19 a month for 150,000 credits, though our team can set up a free trial of a paid plan so you can test bulk on your own file. The free Developer plan's 1,000 credits a day cover single lookups only, so 10,000 addresses would take ten days.
No. In an IPGeolocation.io bulk request, entries that come back as a message (such as private, bogon, or invalid addresses, and addresses not in our database) cost nothing. Each entry that returns data costs the same as a single lookup, and a repeated address is charged every time it's sent.
Yes. IPGeolocation.io's bulk endpoint accepts up to 50,000 addresses per request, and we recommend one request for a 10,000-row job. In our test, 8,912 addresses made a body of about 160 KB and came back in 2.2 seconds. Split only above 50,000, or if your network cuts requests off early.
It can be. If your client gives up but IPGeolocation.io's server finishes the lookup, every valid address in it is charged, and a retry is a new request that's charged again. Set your HTTP client's read timeout to at least 60 seconds before sending a large request.
No. A 429 from IPGeolocation.io means a usage limit on the account (credits used up with overage turned off, the overage limit reached, or a deleted subscription), not a speed limit. Retrying gets the same 429. Save your progress, fix the account, and run the job again.
No. IPGeolocation.io doesn't write the addresses in a bulk request body to its access logs. The log keeps the request line and standard details such as the caller's address, time, and status, and access logs are deleted after 14 days. The full record is in what we keep from API lookups.







