Database Download
Getting Started
You can download your subscribed IPinfo database in two different ways:
- Database download from your dashboard on the webpage
- Database download from using
cURL
on your terminal
Option 1: Database download from the account dashboard
You can visit the Data Downloads page to download your IPinfo database.
Or, you can go to:
- your account Dashboard
- select Data Downloads
- and from there if you scroll down you will find your database that you can have subscribed to.
Option 2: Database download using cURL
You can also download your IPinfo database using cURL
. Please make sure you add the -L
flag to your cURL
command, which enables cURL
to follow redirects.
curl -L https://ipinfo.io/data/location.csv.gz?token=$TOKEN -o location.csv.gz
We use gzip
to compress our database. After downloading the database, you can extract the content or decompress the database using gzip
, gunzip
, or any compression software of your choice.
Database Operations
Getting specific country location
You can filter out the IP addresses from any specific country by using the grep
command from your terminal. One thing to remember is that you must start and end the country code with commas, for example: ,US,
, ,IN,
, ,CA,
etc.
(head -1 location.csv;grep ",US," location.csv) > location_us.csv
If you use the solution above, your outputted CSV file will contain the header row as well.
Filtering the database with multiple countries/ASNs
Like filtering the database based on a single country or ASN, creating a sub-database containing multiple specific countries or ASNs is also possible. Let’s demonstrate that using multiple country filters. Get started by creating a text file(countries.txt
) that contains your target countries in the following fashion:
,CA,
,FR,
,US,
,DE,
,UK,
As we will be using grep, your country code information must include the starting and trailing commas. Then using the -f option (stands for fixed-strings) run the following command.
(head -1 location.csv;grep -f countries.txt location.csv) > filtered_location.csv
This will create a filtered_locations.csv contains IP information of only the countries included in the countries.txt filter list.
Convert IP addresses to IP ranges
If you want to convert the IP address range columns (start_ip
, end_ip
) to their CIDR equivalent, you can use our IPinfo CLI app. The range2cidr
command of the IPinfo CLI will convert the two columns to their individual CIDR equivalent. For example:
Input (Start IP - End IP) | Output (CIDR) |
---|---|
91.232.89.0 — 91.232.89.255 | 91.232.89.0/24 |
How to use the range2cidr command:
- Install the IPinfo CLI from GitHub
- Unzip the downloaded IPinfo CSV database
- Run then
range2cidr
command of the IPinfo CLI and save the output to a file - The outputted file would have the
start_ip
andend_ip
columns converted tocidr
column
ipinfo range2cidr location.csv > location_range.csv
Exploring MMDB
files using mmdbctl
Our open source mmdbtctl makes exploration and management of MMDB files exceptionally easy.
Feel free to explore the documentation here: https://github.com/ipinfo/mmdbctl
Code Snippet | Description |
---|---|
mmdbctl read -f json-pretty 8.8.8.8 location.mmdb | Lookup specific IP address (8.8.8.8) and output information as JSON from location.mmdb file |
mmdbctl read 8.8.8.0/31 location.mmdb | Checking CIDR (8.8.8.0/31) data |
mmdbctl read 8.8.8.0-8.8.8.1 location.mmdb | Getting IP range (8.8.8.0-8.8.8.1) data |
mmdbctl import --in data.csv --out data.mmdb | Converting a CSV file (data.csv) to an MMDB file (data.mmdb) |
mmdbctl export data.mmdb data.csv | Outputting CSV data (data.csv) from MMDB file (data.mmdb) |
Using MMDB reader libraries
If you want to read the MMDB database file using a programming language, you can use an MMDB reader library. The MMDB reader libraries supported by IPinfo are:
Using the MMDB reader library, you can open the database and lookup an IP address. Using the mmdbctl tool, you can create your own custom MMDB databases as well. If you need any assistance with using these libraries, feel free to reach out to us.
Rate limit for data downloads
We restrict the number of times a database can be downloaded to ten (10) times per day. This restriction applies to each unique IP address for an individual device. However, we are happy to accommodate requests to increase download limits. Learn more about rate limits on data downloads.
Checksums API endpoint
Checksums are essential for ensuring data integrity and security. By comparing the calculated hash values with the provided checksums, users can verify that their downloaded files haven't been tampered with or corrupted during transit.
We offer checksums API endpoints for every data download, supporting all the file formats. Checksums API response includes three hash values: md5, sha1, and sha256. Aside from the API endpoint, you can view checksums from your data downloads page on your account dashboard.
curl https://ipinfo.io/data/free/country.csv.gz/checksums?token=<YOUR_TOKEN>
{
"checksums": {
"md5": "75405cbe6ae89342dc4c58eede9f4bb2",
"sha1": "8713da968c5bc0d89eba45ea349f75ac5569e21a",
"sha256": "376f8148b250948bd236c00f4a00c95d2a22696ed3313141e9666af852f9bf1c"
}
}
Database Guides
You can read some of our blog articles that showcase how to use our database:
- Ingesting IPinfo geolocation data with PostgreSQL 13
- Introducing a Simpler Way to get IP Address Data in Snowflake
- Data downloads vs API, or both?
- Migrating from MaxMind to IPinfo
- Our downloadable IP WHOIS data sets are live!
- How to choose the best file format for your IPinfo database?
- IP data enrichment with IPinfo: 4 ways to add insights to your traffic/server logs
Want to share your experience as an IPinfo customer by writing an article? Email us at hello@ipinfo.io with an idea, we will get you set up.