Skip to content
InternetData

Use the databases

Download an InternetData database with a free account's key, look addresses up on your own servers, and keep the file current every day.

A database answers on your own servers, with no request per lookup. This walks through IP Country, one of the Open databases every account may download for free.

1. Get a key that may download

Sign up; the key the console makes for you may look up and download. A key needs the db.download scope to download.

bash
export INTERNETDATA_API_KEY="YOUR_API_KEY"

2. Download the file

bash
curl -L -o ip_country_v1.mmdb \
  "https://internetdata.io/api/v2/database/download?id=ip_country_v1&format=mmdb&apikey=$INTERNETDATA_API_KEY"

-L follows the redirect to the file. Every database comes as CSV too (format=csvgz); Formats says how each is laid out.

3. Look an address up locally

An MMDB answers an address in microseconds with any MMDB reader:

Python
# pip install maxminddb
import maxminddb

with maxminddb.open_database("ip_country_v1.mmdb") as reader:
    record = reader.get("8.8.8.8")
    print(record["country"], record["currency_code"])  # US USD

4. Keep it current

IP Country is rebuilt every day, like most of the catalog. Fetch it on a schedule, or have each new build come to you:

  • Metadata says when the current build was made, so a daily job can skip a file that has not changed.
  • Checksums gives each file's SHA-256 to check once it lands.
  • Webhooks call your endpoint when a build is out, and S3, Google Cloud Storage, Azure and SFTP take each build into your own storage.

The rest of the catalog

The Open databases are free for every account: IP Country with its currency, flag and timezone files, IP ASN, ASN, Anycast IP, the bogon lists, Tor IP and Relay IP. The other databases are licensed: ask us which suit you, and the Database Reference has each one's columns and a sample.