https://cloud.51degrees.com/api/v4/YOUR_KEY.json?client-ip=138.37.228.45
Legacy
Psst. What do you do when the dude who maintains that data file you didn't realize was so critical is on holiday? 😫
In any case, IP only misses the whole picture.
51Degrees
37 million downloads, 1.6 million websites, and 262,000 downloads in the last week.
Plans and prices are on the pricing page, and every property is in the Property Dictionary.
What you need to know
Whether you want a cloud integration or an on-premise solution, we've got you covered.
We keep the database bang up to date, so you can enjoy all the benefits with none of the stress.
Our on-premise data is faster and slimmer than legacy solutions relying on MaxMind DB format and open source code. As such it integrates into everything from C-based edge compute to WordPress. Check it out.
var ipEngine = new IpiOnPremiseEngineBuilder(loggerFactory)
.SetPerformanceProfile(PerformanceProfiles.LowMemory)
.SetAutoUpdate(false)
.SetDataFileSystemWatcher(false)
.Build(dataFile, false);
var codeTranslationEngine =
new CountryCodeTranslationEngineBuilder(loggerFactory)
.Build();
var countriesTranslationEngine =
new CountriesTranslationEngineBuilder(loggerFactory)
.Build();
using (var pipeline = new PipelineBuilder(loggerFactory)
.AddFlowElement(ipEngine)
.AddFlowElement(codeTranslationEngine)
.AddFlowElement(countriesTranslationEngine)
.Build())
{
using (var data = pipeline.CreateFlowData())
{
data.AddEvidence(evidence);
data.Process();
var ipData = data.Get<IIpIntelligenceData>();
}
}
using (var pipeline = new FiftyOnePipelineBuilder(
loggerFactory, serviceProvider)
.BuildFromConfiguration(pipelineOptions))
{
using (var data = pipeline.CreateFlowData())
{
data.AddEvidence(evidence);
data.Process();
var ipData = data.Get<IIpIntelligenceData>();
}
}
System.setProperty("TestDataFile", dataFileLocation);
PipelineOptions pipelineOptions =
PipelineOptionsFactory.getOptionsFromFile(optionsFile);
try (Pipeline pipeline = new FiftyOnePipelineBuilder()
.buildFromConfiguration(pipelineOptions)) {
try (FlowData data = pipeline.createFlowData()) {
data.addEvidence(evidence);
data.process();
IPIntelligenceData ipData =
data.get(IPIntelligenceData.class);
}
}
IPIntelligenceCloudPipelineBuilder builder =
new IPIntelligencePipelineBuilder().useCloud(resourceKey);
if (endPoint != null && endPoint.isEmpty() == false) {
builder.setEndPoint(endPoint);
}
try (Pipeline pipeline = builder.build()) {
try (FlowData data = pipeline.createFlowData()) {
data.addEvidence(evidence);
data.process();
IPIntelligenceData ipData =
data.get(IPIntelligenceData.class);
}
}
const pipeline = new IpIntelligenceOnPremisePipelineBuilder({
dataFile, performanceProfile: 'Balanced',
shareUsage: false, autoUpdate: false,
updateOnStart: false, fileSystemWatcher: false
}).build();
const data = pipeline.createFlowData();
evidence.forEach((value, key, map) => {
data.evidence.add(key, value);
});
await data.process();
const ip = data.ip;
const pipeline = new PipelineBuilder()
.buildFromConfiguration(options);
const data = pipeline.createFlowData();
evidence.forEach((value, key, map) => {
data.evidence.add(key, value);
});
await data.process();
const ip = data.ip;
pipeline = IpIntelligencePipelineBuilder(
data_file_path = data_file,
performance_profile = "LowMemory",
usage_sharing = False,
auto_update = False,
licence_keys = "").add_logger(logger).build()
with pipeline.create_flowdata() as data:
data.evidence.add_from_dict(evidence)
data.process()
ip_data = data.ip
settings = {
"resource_key": resource_key
}
if cloud_endpoint:
settings["cloud_endpoint"] = cloud_endpoint
pipeline = IpIntelligencePipelineBuilder(**settings) \
.add_logger(logger) \
.build()
data = pipeline.create_flowdata()
data.evidence.add_from_dict(evidence)
data.process()
ip_data = data.ip
let pipeline: Arc<Pipeline> =
IpIntelligencePipelineBuilder::on_premise(&options.data_file)
.performance_profile(PerformanceProfile::LowMemory)
.properties(DISPLAYED_PROPERTIES.iter().copied())
.auto_update(false)
.file_system_watcher(false)
.build()
.context(
"failed to build the on-premise IP Intelligence pipeline"
)?;
let mut data = pipeline.create_flow_data_with(
Evidence::builder().add("query.client-ip", ip).build());
data.process()
.with_context(|| format!("processing IP {ip} failed"))?;
let ip_data = data.get(IP_DATA_KEY)
.context("the pipeline produced no IP Intelligence data")?;
let mut builder =
IpIntelligencePipelineBuilder::cloud(options.resource_key);
if let Some(endpoint) = options.endpoint {
builder = builder.endpoint(endpoint);
}
let pipeline = builder
.build()
.context(
"failed to build the cloud IP-intelligence pipeline")?;
let mut data = pipeline.create_flow_data_with(
Evidence::builder().add(CLIENT_IP_EVIDENCE_KEY, ip).build());
data.process()
.with_context(
|| format!("failed to process the IP address {ip}"))?;
let ip_data = data.get(IP_DATA_KEY).context(
"the pipeline did not populate any IP-intelligence data")?;
config := ipi_interop.NewConfigIpi(ipi_interop.InMemory)
engine, err := ipi_onpremise.New(
ipi_onpremise.WithConfigIpi(config),
ipi_onpremise.WithDataFile(params.DataFile),
ipi_onpremise.WithAutoUpdate(false),
ipi_onpremise.WithTempDataCopy(false),
ipi_onpremise.WithProperties(common.Properties),
)
result, err := engine.Process(ipiItem.IpAddress)
val, _ := result.GetValueByProperty(property)
StatusCode status = IpiInitManagerFromFile(
&manager, config, &properties, dataFilePath, exception);
ResultsIpi* results = ResultsIpiCreate(&manager);
ResultsIpiFromIpAddressString(
results, ipv4Address, strlen(ipv4Address), exception);
ResultsIpiGetValuesString(
results, propertyName, valueBuffer, sizeof(valueBuffer),
"|", exception);
ResultsIpiFree(results);
// The 51Degrees C library runs inside your own
// program, so there is no cloud version.
// Choose On-premise for its example.
load_module %%MODULE_PATH%%modules/ngx_http_51D_ipi_module.so;
http {
51D_file_path_ipi %%FILE_PATH_IPI%%;
server {
location /ipi {
51D_match_ipi x-asn AsnName;
51D_match_ipi x-asn-query AsnName $arg_client_ip;
add_header x-asn $http_x_asn;
add_header x-asn-query $http_x_asn_query;
}
}
}
# NGINX runs the 51Degrees C library inside the
# web server, so there is no cloud version.
# Choose On-premise for its example.
import fiftyonedegrees_ipi;
sub vcl_recv {
set req.http.x-asn = fiftyonedegrees_ipi.match("AsnName");
set req.http.x-asn-real = fiftyonedegrees_ipi.match(
"AsnName", req.http.X-Real-IP);
}
sub vcl_deliver {
set resp.http.x-asn = req.http.x-asn;
set resp.http.x-asn-real = req.http.x-asn-real;
}
sub vcl_init {
fiftyonedegrees_ipi.set_properties("AsnName,Asn");
fiftyonedegrees_ipi.start(
"/etc/varnish/51Degrees-IPIV4AsnIpiV41.ipi");
}
# Varnish runs the 51Degrees C library inside the
# cache, so there is no cloud version.
# Choose On-premise for its example.
Compare the ways to deploy on the deployment options page.
Rather than placing a country that the user is almost certainly not in at the top of the list, place the countries they're most likely to be in at the top.
Automatically translate the country names based on their target language and get back a standardized country code. Tailor time and currency to those that are most relevant.
A specific point will normally be delivered (either as a geographic place name or as a GeoNames reference) but, when the location of the IP address is ambiguous, 51Degrees uses an advanced algorithm to create a detailed shape showing the possible locations of that device. While a circle ignores boundaries such as geographic borders or oceans, 51Degrees’ algorithm identifies the reality of where a device may be and provides that insight to the user.
Every place in a result also comes with its GeoNames id, from the continent and the country down to the state, the county, and the town, and for the country the IP address range is registered in. A GeoNames id joins our results to the GeoNames gazetteer, and to any of your own data keyed on it, with no matching of names.
For example, the IP tester's answer for 138.37.228.45 includes these ids, each linked to its place on GeoNames.
| Place | Property | GeoNames id |
|---|---|---|
| Europe | ContinentGeoNameId | 6255148 |
| United Kingdom | CountryGeoNameId | 2635167 |
| England | StateGeoNameId | 6269131 |
| Greater London | CountyGeoNameId | 2648110 |
Where the area of an IP address covers more than one state, StateGeoNameIdsGeographical lists each one with its share of the area, so a rule by state never has to guess one.
GeoNames ids come with the Pro plan and above. Try them in the IP tester, which links each id to its place on GeoNames.
The LocationConfidence property should always be consulted before considering how to use results. It returns one of four values, High, Medium, Low, or Unknown.
- High confidence results can be relied upon and considered useful for all practical purposes.
- Medium confidence results might be useful where the use case can tolerate a degree of imprecision.
- Low or Unknown confidence results should be discarded when the results might be used to make consequential decisions. Instead, consider asking the user to share their location and then using reverse geocoding.
Diversity properties express how many different profiles are seen within an IP range, such as the hardware models, browsers, or operating systems. HardwareDiversity, BrowserDiversity, and PlatformDiversity each give a score.
The score runs from 0 to 10. 0 means there are no recent web events in the range to calculate a score, 1 to 9 is the average number of different profiles for each IP address, and 10 is ten or more.
Start with IP location, which you get without having to prompt the user, but which is not precise. Then move to the precise coordinates the operating system or the web browser provides, and reverse geocode them to an address.
A location from the GPS that falls within the service area of the IP address is an indication that the person is actually in the country and not using a VPN.
Get IP intelligence and device detection properties in the same call.
{
"device": {
"hardwarevendor": "Apple",
"platformname": "iOS"
},
"ip": {
"country": "United Kingdom",
"connectiontype": "Broadband"
}
}
Plans and prices are on the pricing page, and every property is in the Property Dictionary.
Follow the guide for MaxMind or IPinfo, and see how IP intelligence providers compare.
Pick one to find out more
Each heading opens a short answer, with code, a map, a diagram, or a video, and a link to the documentation for more.

What is IP intelligence from 51Degrees?
IP addresses
An IP address is essentially the digital address of a device on a network that tells other devices where to find it in digital space. On its own it doesn’t tell you much other than where to route data but, when associated with other information, it can be a powerful tool for enhancing digital services.
However, the nature of IP addresses means that this insight must come with a caveat. IP addresses can move between devices and one address could be used for a huge number of different devices at the same time.
Cellular is widely used, yet only 1.6% of addressable IPv4 addresses are cellular.
IP intelligence
IP intelligence from 51Degrees gives you more information about the devices using a digital service based on their IP address. From their geographic location to how many devices are using a single IP, the insight you gain from IP intelligence can be used for everything from personalization through to fraud protection.
Given the potential ambiguity inherent in IP addresses, 51Degrees’ IP intelligence does not always default to a binary answer, instead providing a range of data points based on the nature of the IP address involved.
Every place comes with its GeoNames id, so the results join to the GeoNames gazetteer and to your own data without matching names.
Data protection first
Our solution gives the area the device using the IP address is likely to be in, with the most likely point inside it. That point is moved at random by up to 1 km and changes once a day. This means you can tailor your services to its general area, without pinpointing its exact location. It’s the best of both worlds, precise enough for localization, yet broad enough to protect the device’s exact position.
5 ways to use IP intelligence
Suggest the visitor's country in the list
IP Intelligence returns a country for the IP address's location and a separate country for where the address range is registered. Use the location country to preselect the list, and keep every country available for the visitor to choose.
Who it serves. Anyone whose forms ask for a country.
Pairs well with Frictionless checkout, for suggesting country, state, and town at checkout.
Ingredients, 6
- CountryCode
- CountryCode3
- Country
- CountryGeoNameId
- RegisteredCountry
- LocationConfidence
Hero ingredient. CountryCode Use the ISO 3166-1 alpha-2 country code to select an entry in the list.
- Look up the visitor's IP address as the form opens
- Select the country whose code matches CountryCode, or whose GeoNames id matches CountryGeoNameId
- Check LocationConfidence before relying on it
- Keep every country in the list for the visitor to change
Chef's tip. LocationConfidence helps you decide whether to use the detected country as a default.
Follow the rules of the place the visitor is in
Licenses, taxes, and rules often stop at a border. IP intelligence places the visitor in a country, a region, and an area before the page loads, so the page can follow the rules for that place.
Who it serves. Services licensed, taxed, or regulated by country or region.
Pairs well with Location cross-check, to confirm a location the visitor shares.
Ingredients, 9
- Areas
- Country
- CountryCode
- CountryGeoNameId
- StateGeoNameIdsGeographical
- Region
- Town
- LocationConfidence
- IsVPN
Hero ingredient. Areas The area the IP address covers, to test against the fence.
- Draw the fence as the countries, regions, or area the rule covers
- Look up the visitor's IP address for its country, the states its area covers by GeoNames id, and its area
- Check LocationConfidence, and IsVPN for a visitor who may be elsewhere
- Apply the rule, or ask for a precise location when the answer is unclear
Chef's tip. When LocationConfidence is Low, ask for the visitor's location before you decide.
Reduce form filling at the checkout
An IP lookup gives you an approximate location, along with the local currency, language, and time zone. Use it to suggest address details and set defaults for the checkout. This can cover shipping and tax as well as the language of the page.
Who it serves. Retailers looking to reduce cart abandonment.
Pairs well with Know your shopper, for device data you can use to personalize the visit.
Integration time. One afternoon in your checkout flow.
Ingredients, 11
- Country
- CountryCode
- State
- Town
- Latitude
- Longitude
- AccuracyRadiusMin
- CurrencyCode
- LanguageCode
- TimeZoneIana
- ConnectionType
Hero ingredient. CurrencyCode Use the currency code to set a default for the checkout.
- Look up the visitor's approximate location from their IP address
- Suggest country, state, and town in the address form
- Default the currency, shipping options, and tax to match
- Show the checkout in the customer's language
Chef's tip. An IP location can be wrong. Let the customer change the country and other suggested details.
Check for bot traffic in your analytics and spending
Use the crawler properties to identify visitors that give their name and purpose, then handle them according to your robots.txt. For visits that aren't named crawlers, use Human Confidence to decide what they can see and how to count them in analytics. The network properties let you review traffic from a data center, VPN, or proxy.
Who it serves. Teams checking bot traffic in analytics and ad spending.
Pairs well with Spot the fake, for a closer look at the device in a suspicious request.
Integration time. 30 minutes in any Pipeline API integration.
Ingredients, 10
- IsCrawler
- CrawlerName
- CrawlerUsage
- CrawlerProductTokens
- IsArtificialIntelligence
- HumanConfidence
- IsVPN
- IsProxy
- IsHosted
- HumanProbability
Hero ingredient. HumanConfidence Use the rating to decide whether a visit should see your prices.
- Check IsCrawler on every request
- Filter named crawlers by name and usage
- Use IsArtificialIntelligence to identify AI traffic
- Use Human Confidence to review visits that aren't named crawlers
Chef's tip. Crawler detection is free on every plan. Use it to handle the visitors that identify themselves before reviewing the rest.
Check a shared location against the IP address
Someone who's prepared to share their location, and whose location matches the IP address, gives a signal of more certainty than if there were a big divergence.
A location from the GPS that falls within the service area of the IP address is an indication that the person is actually in the country and not using a VPN.
Who it serves. Anyone who needs more certainty that a visitor is where they appear to be.
Pairs well with Suspicious traffic management, to weigh the location with the other signals.
Ingredients, 10
- Areas
- Country
- LocationConfidence
- IsVPN
- IsProxy
- IsHosted
- JavaScript
- Country
- Region
- Town
Hero ingredient. Areas The service area of the IP address, to test the shared location against.
- Look up the IP address for its service area and VPN flags
- Ask the browser for its coordinates
- Check whether the coordinates fall within the service area
- Take a big divergence as a reason for a closer look
Chef's tip. A match is a signal, not proof. Weigh it with IsVPN and Human Confidence.
Pick the one closest to your business challenge
The story is for you and the recipe for your engineers, with the properties they need and a link to create their Resource Key.