IP Geolocation: API vs Database Guide

Abdullah Afzal
By Abdullah Afzal Database Engineer
Posted on April 6, 2026 | 17 min read
IP Geolocation: API vs Database Guide
Back to All Guides

IP geolocation API vs database is a choice about where each lookup runs: an API answers it over HTTPS from the provider's servers, and a database is a file you query on your own servers. Pick the API for real-time lookups with no files to maintain. Pick a database when lookups must run offline, at very high volume, or without IP addresses leaving your network. Many teams run both.

There's a third place a lookup can run. If your data already lives in Snowflake, IPGeolocation.io shares the same databases into your account, where you query them with SQL and download nothing.


TL;DR

Use the IPGeolocation.io API when you want answers without running files: it serves our latest daily build as soon as it's ready, takes up to 50,000 addresses in one bulk request, and runs live session checks that no file can. Use a database when volume, privacy rules, or an offline network make outbound calls the problem.

  • Database releases arrive daily or weekly, depending on your plan, each with a checksum and a signature to verify before it replaces production.
  • An API lookup sends the address to us, and our access logs keep it for 14 days; a database lookup never leaves your servers.
  • An API bill grows with every lookup, while a database license costs the same for any number of lookups but counts the servers it runs on.
  • For files, MMDB suits lookups inside software and CSV suits joins in a database or warehouse.

IP Geolocation API vs Database at a Glance

Here's how the two compare on what usually comes up in a design review.

IP Geolocation APIDownloadable Database
Where the lookup runsOur servers, over HTTPSYour servers, from a local file
SetupAn API key and an HTTP callA license, a download, a reader, and an update job
What you runNothing beyond your own codeStorage, updates, and reloads
Cost grows withLookups, and the data added to eachDatabases, servers, and update cadence
SpeedNetwork round trip plus our server timeA local read, no network call
FreshnessOur latest daily buildDaily or weekly releases, by plan
Where IP addresses goTo us; logs keep them 14 daysNowhere; lookups stay local
Live session testYesNo
FormatsJSON or XMLCSV and MMDB; JSON, Parquet, or custom on request
IPv4 and IPv6BothBoth

Underneath both is the same kind of record: IP ranges, not single addresses, mapped to their data, so a lookup finds the range an address falls in. If none of the cases in "When a Database Is the Right Choice" applies to you yet, we'd start with the API, because moving to files later is a contained job, as "What Changes When You Switch From the API to a Database" shows.


How Each Option Answers a Lookup

An API and a database return the same kinds of data by different routes, and the database route adds a second loop that runs on a schedule.


1. Through the API

Your code sends an HTTPS request to the IPGeolocation.io IP Geolocation API with the address and, if you like, the fields it wants back. Our servers look the address up in the latest daily build and return JSON or XML. Nothing sits on your side: when a new build is ready, the next request gets it. For batches, the bulk endpoint takes up to 50,000 IPv4 or IPv6 addresses in one request.


2. Through a Downloadable Database

With a database, the lookup happens inside your own process. You download the files, a reader opens them, and each lookup finds the range that holds the address and returns its record without touching the network.

What an API hides is the second loop. A new release arrives daily or weekly, depending on your plan, and something on your side has to fetch it, check it, and swap it in. Every IPGeolocation.io release ships with a SHA-256 checksum and a signature, and our database team wants customers to verify both before a new file replaces the production one: the checksum shows the download is complete and intact, and the signature shows the file came from us. A status endpoint shows when each database has a new release, so an update job downloads only when something changed. The guide to how often IPGeolocation.io data is updated gives the endpoint and the verification command, and the files inside each database archive are listed by format.


3. Inside Your Warehouse

Snowflake users have a third route. Six IPGeolocation.io databases are listed on Snowflake Marketplace: installing one shares the data into your Snowflake account, updates arrive through the share, and a built-in lookup function returns the record for any IPv4 or IPv6 address in SQL. Nothing is downloaded and no API is called. It fits enrichment jobs that already run in Snowflake, not lookups in an application's request path.


Five Questions That Decide It

Five questions settle most cases. The first two can rule an option out on their own, so ask them first; the other three weigh cost, speed, and freshness.


1. Where Are IP Addresses Allowed to Go?

An API lookup sends the address to the provider. IPGeolocation.io's API access logs keep the IP address you look up for 14 days, while a downloadable database keeps every lookup on your own servers. Addresses sent in the body of a bulk request aren't logged at all, and we don't use your lookups to build our data; what we keep from your API lookups has the full record.

For many teams that's acceptable; for others it's a hard stop. If a contract, a regulator, or your own security policy says user IP addresses don't leave your systems, the question is settled: a database runs the same lookups on your servers, and nothing about a lookup goes anywhere. The live session test runs in the visitor's browser and reports to our servers, so it's off the table in that setup as well.


2. Which Data Does the Job Need?

Most data comes both ways. Our databases carry the same data the API returns: geolocation; security risk signals, meaning VPN, proxy, Tor, bot, and attacker detection with a threat score; ASN; company; and abuse contact data. The difference is packaging. One API call can return several of these together, while the files split them into separate databases or bundles, so a database setup means licensing the ones that hold the data your code reads. Which IPGeolocation.io product fits your job maps each job to its API and its database.

A few jobs exist only as APIs. Real-Time Proxy & VPN Detection tests whether the visitor's current session is anonymized, from a script in the browser, so there's nothing a file could hold. The test takes seconds, not milliseconds: our live-test logs for October 2026 put the median finished check at 3.6 seconds, with 72% finished within five (checks that never finish aren't logged), so it runs alongside the page while the visitor reads it. User-agent parsing reads the request's own header, which no IP range describes.


3. How Many Lookups, and What Do They Cost?

Cost is where the two drift apart as traffic grows. An API is billed per lookup, and adding data to a lookup, such as security risk signals, raises what that lookup costs, so the bill tracks your traffic month by month.

A database license works the other way round. It's priced by the databases you take, the update cadence, and the term, and it costs the same whether you run a thousand lookups a day or a billion. What it counts instead is servers: the default End-User License covers internal use on one production server, and a Site License covers unlimited servers, so fifty application servers can move a quote more than any lookup count does. The help article on how database licenses count servers lists every license type.

Batches change the picture, too. A nightly job that enriches yesterday's logs can send 50,000 addresses per bulk request, so it can stay on the API until volume or policy says otherwise. To compare the two for your own traffic, count your lookups per month and the data each one needs, then price them on the API pricing page against a database quote; how API calls are billed has the per-call detail.


4. How Fast Does the Answer Need to Be?

An API lookup includes a network round trip from your server to ours and back, plus our server time. A database lookup is a read from a file on the same machine. On November 16 and 17, 2026, the median request to our API servers in four of our five regions took about 2 milliseconds or less on the server, and 95% finished within about 5 milliseconds, counting every request they received, rejected ones included; your own network time comes on top. On a laptop, our Python reader, ipgeolocation-mmdb-reader, looked up 50,000 random public IPv4 addresses with a record in the sample edition of the IP to Location MMDB built on October 22, 2026: with the file in memory and each record already decoded once, the median lookup took 58 microseconds.

Speed rarely forces the choice on its own: a page that sets a currency or a language can cache each answer per IP for up to 24 hours, and a cached answer is then at most one build behind. Speed decides it in hot paths that can't wait on a network, such as a gateway that checks every request. That's the job our Nginx module and Kong plugin do: both read IPGeolocation.io MMDB files from disk and make no API calls.


5. How Fresh Does the Data Need to Be?

IP data goes stale because addresses keep moving. Some ISPs reassign their customers' addresses on a fixed cycle, typically a multiple of 24 hours, according to a 2016 study of RIPE Atlas probes, and in 2025, 5,619 IPv4 transfers moved 33.4 million addresses between holders, about 640,000 a week on average, per the APNIC Blog.

IPGeolocation.io rebuilds its IP data once a day; the API serves each build as soon as it's ready, and database subscribers receive it daily or weekly, depending on their plan. Between our releases of November 10 and November 17, 2026, 0.15% of IPv4 addresses in the IP to Location database changed country and 5.4% changed city, measured as a diff of the two production releases with addresses, not ranges, as the unit.

Our database team wouldn't accept a weekly copy for six kinds of work: payment and checkout fraud, credential stuffing and account takeover, bot mitigation and scraping, ad fraud and click verification, strict geofencing for regulated services such as streaming and fintech, and Zero Trust access control. As the team explains it, the reasons repeat across all six: fraud rings and bot operators move to fresh proxy pools and newly provisioned cloud hosting ranges, and ISPs reassign blocks between regions mid-week, so a seven-day-old copy can let new infrastructure through and can keep treating a reassigned, legitimate address as risky. For geofencing, a block that moved into a restricted jurisdiction becomes a compliance gap the day it moves.

Daily data is the minimum for that work. As our team puts it, the residential proxies and VPN nodes behind fraud can cycle multiple times an hour, which no daily build can follow. For those sessions, Real-Time Proxy & VPN Detection tests the visitor's live connection instead of looking the address up. Uses with lower stakes, such as country defaults or monthly reports, get by on less; how often IPGeolocation.io data is updated covers the cadence we'd pick for each.


When the API Is the Right Choice

The API is the right default when none of the database cases applies, because it hands the whole job of keeping data current to us. It fits when:

  • you're building a product or a prototype and want lookups working today, with no files to store or update;
  • your traffic varies, and you'd rather pay for the lookups you run than size a license up front;
  • you need live session tests or user-agent parsing alongside IP data;
  • several services need lookups, and you don't want each one carrying a copy of the file.

Take a SaaS dashboard that shows each signed-in user's country next to their session. The backend calls the API when a session starts, caches the answer for that session, and the team never thinks about files. Calling from the backend also keeps the API key out of the browser.


When a Database Is the Right Choice

In our database team's experience, customers move from the API to a database for one of three reasons: volume, privacy rules, or offline lookups. Volume means lookups in the billions, or a pipeline that enriches every row of a large table. Privacy rules mean IP addresses may not leave your network. Offline means air-gapped networks, appliances, and edge locations without reliable outbound access, where a self-hosted IP geolocation database keeps answering when the internet doesn't.

A payments platform that checks 200 million transactions a month (example figures) shows the trade. On the API, every transaction waits on a call to a third party, and the bill grows with each one. A local IP geolocation database answers each check on the same machine, and the license cost doesn't move when the transaction count does. The platform still needs daily releases, for the fraud reasons in "How Fresh Does the Data Need to Be?", and it still sends its live session tests to the API.

A database removes the per-lookup meter, but other limits remain: the license covers a set number of servers, and someone on your team owns the update job. If your team runs pipelines, the guide to enriching logs with IP data shows where the files fit.


How to Run Both

Many setups use both, each for what it does best. A local-first setup reads the database file on every request. Only three kinds of lookup go out to the API: an address your copy has no record for (a range allocated since your last release, for example), a job that needs data your licensed files don't carry (security risk signals when you license only location, say), and the live session test, which runs in the visitor's browser and reports back to your server. Keep each API answer in a cache for up to 24 hours, shared across servers if you run several, so the same address goes out once a day at most.

The reverse split works as well: keep the API in production and license a database for batch backfills, analytics, or an isolated network.

We'd shape the split around the reason you took a database in the first place. If it's privacy rules, nothing goes out to the API, misses included; run the live test only if your policy allows the visitor's browser to contact us. If it's volume or a hot path, sending misses and live tests to the API costs little and keeps the edge cases answered.


What Changes When You Switch From the API to a Database

The data stays the same; where your code finds it changes. Here's one live lookup of Google's public DNS address, 8.8.8.8, through the API on November 13, 2026, trimmed to the fields a typical localization feature reads:

{
  "ip": "8.8.8.8",
  "location": {
    "country_code2": "US",
    "state_prov": "California",
    "city": "Mountain View",
    "latitude": "37.42240",
    "longitude": "-122.08421"
  },
  "currency": { "code": "USD" },
  "time_zone": { "name": "America/Los_Angeles" },
  "asn": { "as_number": "AS15169", "organization": "Google LLC" }
}

The same data sits under different paths in the IP to Location database, according to its documentation:

What Your Code ReadsAPI (/v3/ipgeo)MMDB FileCSV Edition
Country codelocation.country_code2location.country.code2country_id, joined to db-country
Regionlocation.state_provlocation.state.name.enstate_place_id, joined to db-place
Citylocation.citylocation.city.name.encity_place_id, joined to db-place
Coordinateslocation.latitude, location.longitudelocation.coordinates.latitude, .longitudelatitude, longitude
Currencycurrency.codelocation.country.currency.codein db-country
Time zonetime_zone.nametime_zonetime_zone_name
ASNasn.as_numberNot in this fileNot in this file

Three things change. In the MMDB file, names are objects keyed by language, en for English plus eleven more. In the CSV edition, places are IDs you join to the db-place reference file. And data one API call returns together can live in another database: the ASN comes from the IP to ASN database. The API's time_zone object also carries the current local time, which a file can't; your code computes it from the zone name.

So a switch is four jobs:

  1. Put your lookups behind one function, if they aren't already, and map the field paths there.
  2. Pick a reader: we publish ipgeolocation-mmdb-reader for Python, and compatible MMDB readers in other languages open our files too.
  3. Set up the update job: verify each release's checksum and signature, swap the new file in with an atomic rename, reopen the reader, and alert when your installed release falls behind the status endpoint.
  4. License the databases, and the number of servers, the job needs.

Database samples are for checking the columns against your code before you license anything.


MMDB vs CSV: Choosing the Right Database Format

MMDB is for looking up one address at a time inside software; CSV is for loading the ranges into a database or warehouse and joining them with your own tables.

An MMDB file is a binary file built for IP lookups. It stores IP ranges in a search tree, and a reader finds the record for an address by walking the bits of that address down the tree, so it never scans the file. Most readers memory-map the file instead of loading it into RAM, which lets the operating system keep the parts in use in memory. Our location CSV edition is relational: the main file maps each range to its values and to IDs, and the reference files db-place (place names in 12 languages) and db-country hold the names and country details you join on. The help article on database formats lists the files inside every other database archive. We wrote up how we build our MMDB files for readers who want the internals.


1. When to Use MMDB

Choose MMDB when software looks up addresses as part of its normal work:

  • In an application's request path: a web app picks a currency and a language on the first page view from the visitor's country, with the lookup answered in-process.
  • At the edge and in gateways: the Nginx module exposes the data as variables, and the Kong plugin answers lookups inside Kong's worker processes, both from MMDB files on disk.
  • On firewalls, appliances, and air-gapped servers, where a local file is the only option.
  • In log pipelines and SIEMs that enrich events as they arrive.
  • For ad hoc checks: mmdbio looks addresses up from the command line, compares two files, and checks a file, with no code. And DuckDB reads MMDB files from SQL, for teams that want lookups and joins in one place.

2. When to Use CSV

Choose CSV when the IP data has to live next to your other data:

  • Joins with your own tables: an e-commerce team loads the CSV into BigQuery or PostgreSQL and joins it with order logs to report sales by region.
  • Batch ETL and analytics that run on a schedule.
  • Inspecting the ranges before anything reaches production.

If that data already lives in Snowflake, the Marketplace share gives you the same tables with no loading at all.

MMDBCSV
What it isA binary file built for IP lookupsRelational text files for import
Best forLookups inside softwareSQL joins, analytics, batch jobs
How you query itA reader library or mmdbioSQL, pandas, ETL tools
How a lookup worksWalks a search tree; no scanA range query in your database engine
Place namesInside each record, in 12 languagesThe db-place file, in 12 languages
Typical userBackend, platform, and security engineersData engineers and analysts

What to Look for in an IP Geolocation Provider

Choosing an API or a database settles how you get the data; the provider decides what's in it. These are the checks we'd run on any provider:

  • The same data both ways. If you might move between an API and a database, check that both carry the same data types, so a switch changes field paths, not what you can know about an address.
  • An update cadence you can see. Ask how often the provider rebuilds its data, how often you receive it, and how you'll know a release is ready.
  • Releases you can verify. A checksum and a signature on every release protect you from a broken download and from a file that didn't come from the provider.
  • Data beyond location. ASN, company, security, and abuse contact data matter for fraud, B2B analytics, and abuse desks; check whether they come as separate databases you can buy one at a time or bundle.
  • IPv6 in both deliveries. Check that the API and the files both cover IPv6 ranges, not IPv4 alone.
  • What the license counts. Servers, internal or customer-facing use, the term, and whether you can start with one database and add more later.
  • A real test before you commit. Run your own traffic on a free plan or trial, and check a database sample's columns against your code before you license it.

IP Geolocation API and Databases From IPGeolocation.io

IPGeolocation.io gives you the same IP data three ways: the IP Geolocation API, downloadable databases, and Snowflake Marketplace shares. One API call can return geolocation, security risk signals, ASN, company, abuse contact, and time zone data, with user-agent parsing on request. Our databases carry the same data as files in three tiers, Geo Standard, Geo Advanced, and Security Pro, sold one database at a time or as bundles, from the IP to Location database to the IP Security Database.

The API is served from global edge servers with a 99.99% uptime SLA, and it and the database files come from the same daily build. That's the setup we think works best for a growing product: start on the API, add files when volume or policy calls for them, and keep one provider and one data model throughout. Releases ship as CSV and MMDB, with JSON, Parquet, or a custom format on request at no extra cost, each signed and checksummed. Plans and prices are on the API pricing and database pricing pages.

Frequently Asked Questions

An IP geolocation API answers each lookup over HTTPS from the provider's servers, while a database is a file you download and query on your own servers. The API needs no files or updates; the database needs no network call per lookup and keeps IP addresses inside your network. IPGeolocation.io rebuilds its data once a day, and the API serves each build as soon as it's ready.

For the lookup itself, yes: a local database answers from a file on the same machine, while an API call adds a network round trip. With IPGeolocation.io API answers cached per IP for up to 24 hours, repeat visitors don't wait on the network at all; a database earns its place in hot paths such as gateways that check every request.

It depends on your volume and your servers. An API bill grows with the lookups you run and the data you add to each, while an IPGeolocation.io database license costs the same for any number of lookups and is priced by the databases, the update cadence, the term, and the servers it covers.

No. An API needs a network connection for every lookup. For offline or air-gapped networks, use a downloadable database: IPGeolocation.io ships CSV and MMDB files that answer lookups on your own servers with no outbound call, with new releases daily or weekly.

Daily for fraud prevention, bot mitigation, ad fraud detection, regulated geofencing, and Zero Trust access; weekly can be enough for country defaults and monthly reports. IPGeolocation.io rebuilds its data every day, and a status endpoint shows when your database has a new release.

An MMDB file is a binary file built for IP lookups: it stores IP ranges in a search tree, so a reader finds an address's record by walking the bits of the address instead of scanning the file. You query it through a reader library or IPGeolocation.io's mmdbio command-line tool, not SQL.

MMDB is for lookups inside software: binary, queried through a reader, and fast to search. CSV is for importing into databases, warehouses, and analytics tools, where you join the ranges with your own data. IPGeolocation.io's location CSV edition is relational, with place names in 12 languages in a separate db-place file.

Request a quote for the databases you need (one database, a bundle, or a custom build) with daily or weekly delivery. Once you have a license, you download releases from static links, get an email when each one is ready, and verify its checksum and signature. Free samples in CSV and MMDB are for checking the columns before you buy.

Yes. The data is the same, but field paths change: IPGeolocation.io's location MMDB stores names as objects keyed by language, the location CSV edition uses place IDs you join to reference files, and some data the API returns in one call lives in a separate database. Map the paths behind one lookup function, then add the update job.

For most startups, the API: it needs no files or update jobs and works the day you sign up. IPGeolocation.io's free Developer plan gives you 1,000 credits a day, reset at 00:00 UTC, with production and commercial use allowed; call it from your server, because calling the API straight from a browser (Request Origins) needs a paid plan.

Yes. Both the IPGeolocation.io API and all downloadable databases cover IPv4 and IPv6 addresses on every plan and tier.


Next Steps

To try the API, the free Developer plan gives you 1,000 credits a day with no credit card, and paid plans start at $19 a month for 150,000 credits; compare API plans. If you already know you need files, download a database sample to check the columns against your code, then request a database quote for daily or weekly delivery.

Not sure which setup fits? Talk to our team about what you're building.

Related Guides

Residential Proxy Networks: How Real Devices Get Hijacked
Residential Proxy Networks: How Real Devices Get Hijacked

Residential proxy networks get their IP addresses from real phones, computers, and TV boxes. Here are the five ways devices are recruited, what the owner risks, and how to check your own.

Posted on November 23, 2026
Read More: Residential Proxy Networks: How Real Devices Get Hijacked
What Is a /24 Subnet Mask? 255.255.255.0 Explained
What Is a /24 Subnet Mask? 255.255.255.0 Explained

A /24 subnet mask is 255.255.255.0: 24 network bits, 256 addresses, and 254 usable on a typical LAN. See what the mask tells your device, how to find yours, and why the /24 matters on the internet too.

Posted on November 22, 2026
Read More: What Is a /24 Subnet Mask? 255.255.255.0 Explained
IP Intelligence for Payment Fraud Prevention
IP Intelligence for Payment Fraud Prevention

What an IP address can and can't tell you at checkout, during a card-testing attack, in a Visa or Mastercard dispute, and at a promo redemption, with four illustrative IPGeolocation.io lookups and the card-network rules that name the IP address.

Posted on November 21, 2026
Read More: IP Intelligence for Payment Fraud Prevention
CIDR Notation Explained: Ranges, Blocks, and Prefixes
CIDR Notation Explained: Ranges, Blocks, and Prefixes

Read any CIDR block's size and range, check whether an IP falls inside it, and see why one address belongs to several blocks at once, with worked IPv4 and IPv6 examples.

Posted on November 20, 2026
Read More: CIDR Notation Explained: Ranges, Blocks, and Prefixes
How Website Visitor Identification Works With IP-to-Company Data
How Website Visitor Identification Works With IP-to-Company Data

Website visitor identification can name a visitor's company only when the visit comes from that company's own network. Here's how one IP lookup tells those visits apart from ISP, cloud, VPN, and gateway traffic, and how to build it on your server.

Posted on November 19, 2026
Read More: How Website Visitor Identification Works With IP-to-Company Data
IP Geolocation vs GPS and Browser Location: Which to Use?
IP Geolocation vs GPS and Browser Location: Which to Use?

IP geolocation tells you where a visitor's network connects from, on every request and without asking. GPS and the browser's Geolocation API tell you where the device is, after the person agrees; here is when to use each and how to combine them.

Posted on November 11, 2026
Read More: IP Geolocation vs GPS and Browser Location: Which to Use?

Subscribe to Our Newsletter

Get the latest in geolocation tech, straight to your inbox.