DB Ip Format
DB Ip Format
DB Ip Format
In order to fetch information about an IP address, you need to build a request URL
of the following form :
http://api.db-ip.com/v2/<apiKey>/<ipAddress>
The two parameters are defined as follows :
apiKey
Your API key
ipAddress
IPv4 or IPv6 address
Here is a sample URL for fetching IP address information :
http://api.db-ip.com/v2/ec6220f579879ce10da9d26caec11dc707ac5d34/23.255.240.0
The server responds with a JSON encoded object with some or all of the following
properties :
ipAddress:
Requested IP address
continentCode:
2-letter continent code
continentName:
Continent name
countryCode:
ISO 3166-1 alpha-2 country code
countryName:
Country name
currencyCode:
ISO 4217 currency code
phonePrefix:
International phone prefix (note: in some rare cases, this is an array with two or
more prefixes)
languages:
List of ISO 639 language codes
stateProv:
State or province name
district:
District or county name
city:
City name
geonameId:
Unique identifier of the location in the GeoNames database
zipCode:
Zip (postal) code
latitude:
Decimal latitude
longitude:
Decimal longitude
gmtOffset:
Offset from UTC in hours
timeZone:
Name of timezone
asNumber:
Autonomous System number
asName:
Autonomous System name
isp:
Internet Service Provider name
linkType:
Connection type
organization:
Organization name
{
"ipAddress": "23.255.240.0",
"continentCode": "NA",
"continentName": "North America",
"countryCode": "US",
"countryName": "United States",
"currencyCode": "USD",
"phonePrefix": "1",
"languages": [
"en-US",
"es-US",
"haw",
"fr"
],
"stateProv": "California",
"district": "Santa Clara County",
"city": "Mountain View",
"geonameId": 5375480,
"zipCode": "94043",
"latitude": 37.3861,
"longitude": -122.084,
"gmtOffset": -7,
"timeZone": "America\/Los_Angeles",
}
{
"ipAddress": "23.255.240.0",
"continentCode": "NA",
"continentName": "North America",
"countryCode": "US",
"countryName": "United States",
"currencyCode": "USD",
"phonePrefix": "1",
"languages": [
"en-US",
"es-US",
"haw",
"fr"
],
"stateProv": "California",
"district": "Santa Clara County",
"city": "Mountain View",
"geonameId": 5375480,
"zipCode": "94043",
"latitude": 37.3861,
"longitude": -122.084,
"gmtOffset": -7,
"timeZone": "America\/Los_Angeles",
"asNumber": 16591,
"asName": "GOOGLE-FIBER - Google Fiber Inc.",
"isp": "Google Fiber Inc.",
"linkType": "fttx",
"organization": "Google Fiber Inc."
}
If an error occurs, the server responds with an object containing only an error
property with the actual error text :
Localization
------------
The place names are localized using the language information present in the
standard Accept-Language HTTP request header.
Localized names are available with Lite and Pro API keys only, and are provided for
most medium and big cities in the world, and several small ones.
We have plans to add more localization options in the future, at the moment this is
available for the following data fields :
stateProv
district
city
You will find below a few samples of localized responses for the above example
query, along with their respective Accept-Language request header :
Accept-Language: en-US
"stateProv": "California",
"district": "Santa Clara County",
"city": "Mountain View",
Accept-Language: fr-FR
"stateProv": "Californie",
"district": "Comt de Santa Clara",
"city": "Mountain View",
Accept-Language: ru-RU
"stateProv": "??????????",
"district": "?????-?????",
"city": "???????-???",
Accept-Language: ja-JP
"stateProv": "????????",
"district": "???????",
"city": "????????",
Batch queries
-------------
If this is compatible with your usage pattern, you may significantly improve query
performance by making multiple IP address lookups in a single API query.
Furthermore, batch queries are given a 10% bonus regarding daily quotas, it means
that your quota will only be decremented by 9 for a batch query of 10 addresses, by
45 for 50 addresses, etc ...
In order to fetch information about multiple IP addresses at once, you need to
build a request URL of the following form :
http://api.db-ip.com/v2/<apiKey>/<ipAddressList>
The two parameters are defined as follows :
apiKey
Your API key
ipAddressList
A comma separated list of IPv4 and/or IPv6 address
http://api.db-
ip.com/v2/ec6220f579879ce10da9d26caec11dc707ac5d34/111.111.111.111,222.222.222.222
The server responds with a set of JSON encoded key-value pairs where the key is an
IP address and the value an object of the format described above for single address
queries.
{
"111.111.111.111": {
"continentCode": "AS",
"continentName": "Asia",
"countryCode": "JP",
"countryName": "Japan",
"stateProv": "Tokyo",
"city": "Chiyoda"
},
"222.222.222.222": {
"continentCode": "AS",
"continentName": "Asia",
"countryCode": "CN",
"countryName": "China",
"stateProv": "Hebei",
"city": "Shijiazhuang"
}
}
http://api.db-ip.com/v2/<apiKey>
The parameter is defined as follows :
apiKey
Your API key
Here is a sample URL for fetching API key information :
http://api.db-ip.com/v2/ec6220f579879ce10da9d26caec11dc707ac5d34
The server responds with a JSON encoded object with some or all of the following
properties :
apiKey
Your API key
queriesPerDay
Quota of daily IP address queries
queriesLeft
Number of IP address queries left for the day
expires
You API key expiration date and time (format is YYYY-MM-DD HH:MM:SS and timezone is
UTC)
Sample response :
{
"apiKey": "ec6220f579879ce10da9d26caec11dc707ac5d34",
"queriesPerDay": 10000,
"queriesLeft": 2863,
"expires": "2018-07-01 12:51:07"
}