
Show HN: A New, Clean Geolocation API - jonathan-kosgei
https://ipdata.co
======
qwerty456127
> Get the following datapoints from any IP address;

Again :-( I just wonder if people will ever stop making assumptions about
others given their IP address or hair colours and divide the Internet on these
slippery grounds. The only legitimate and valid way to determine the client's
location automatically is the browser or the OS geolocation API, and for the
language it is the HTTP_ACCEPT_LANGUAGE header. The fact I have contacted your
server from an IP address assigned to a Chinese ISP neither means I'm in China
nor that I speak Chinese.

~~~
duiker101
Believe it or not, you make up about 0.000001%[1] of the internet users. There
is no saying in what this can be applied, it doesn't have to be for language
or anything like that. It doesn't even have to be anything customer facing,
and if it's just some stats you will probably probably just be a bit of noise.

Don't get me wrong. I totally agree that this thing is definitely not
accurate(it thinks i'm 1300mi away) but it's good enough to get a general
idea.

[1] made up number to get my point across

~~~
kelnos
Yes, and you've made up a number that reinforces your point. A number that, if
wrong, could negate your point.

Many more people are using VPNs these days. It's still not a large percentage,
to be sure, but people are indeed doing it. Hell, I'm on my company VPN right
now, and this site mis-identified my location because our VPN is set up to
route most addresses in AWS's address space through the VPN (and ipdata.co
appears to be hosted on AWS).

Then you have stuff like people on planes (usually this is all routed through
a single PoP somewhere), people on mobile data who are roaming internationally
(often proxied through one of the home carrier's PoPs), etc.

I think using IP geolocation is a decent first-order approximation, and is
useful if there are no other ways to get that information, but it _must_
always be treated as unreliable.

~~~
alam2000
I agree that IP geolocation is a good approximation. It is never accurate up
to street level.

Meanwhile, there is API to detect VPN, so that we can aware that the
geolocation is good up to the server physical location.

[https://www.ip2location.com/ip2proxy-web-
service](https://www.ip2location.com/ip2proxy-web-service)

~~~
jonathan-kosgei
Our API now supports detecting Tor nodes
[https://api.ipdata.co/103.10.197.50](https://api.ipdata.co/103.10.197.50)

------
Shoothe
Tangential but I find it funny that such a simple service has libraries for so
many different languages. Is one simple HTTP call and JSON deserialization
that hard? Personally I'd be more concerned about bringing yet another 3rd
party module (leftpad, security, maintenance) than doing GET + JSON.parse but
maybe convenience is what's most important.

~~~
Kalium
One of the first things people tend to look at for an API is whether or not
there's a library that makes integration as easy as possible. One HTTP call
and JSON deserialization is often more thought and effort than people want to
put in.

~~~
jonathan-kosgei
Right, this is why we have multiple copy-pasteable examples in different
languages. To make it as straight forward and quick as possible to get
started.

------
harrisonhjones
It would be cool if your examples (or really your entire website) was a git
repo so people could easily report issues. Examples:

1\. Your GO examples don't quite follow Go standard style "resp_body" instead
of just "body", "resp", or "respBody"

2\. Instead of "Error Codes" it should probably be "Status Codes" since the
first "Error Code" is actually "200 OK"

~~~
jonathan-kosgei
On 2, thanks for catching that, changing that right now. On 1 atm we have a
Python repo
[https://github.com/ipdata/python](https://github.com/ipdata/python) which I
know isn't exactly what you're looking for. Thanks for reporting this. The
right avenue to handle something like this would be sending an email to
Support. Be assured we'll be quick to respond and work through whatever you
need.

Made the change.

------
orf
Great looking site, and good luck. My IP data was pretty much bang on,
something I haven't seen before.

However, I was just looking at your Python SDK:
[https://github.com/ipdata/python/blob/master/ipdata/ipdata.p...](https://github.com/ipdata/python/blob/master/ipdata/ipdata.py#L20)

What are you thinking. Never do this in a library. Also it looks a bit
amaterish, as it's your only currently supported library I'd fix it up a bit -
don't add .pyc/dist files to git, make it pep8, remove sys.exit() in a library
(!!!) etc.

~~~
jonathan-kosgei
You're absolutely right! Not sure how/why that got in there in the first
place. I'm fixing a new release right now. I'm also going to have the
repo/package cleaned up.

Pushed a new release:
[https://pypi.python.org/pypi/ipdata/2.6](https://pypi.python.org/pypi/ipdata/2.6)

~~~
kelnos
Calling 'print' from within a library is pretty bad form too... responses and
errors should always be returned as data that can be inspected
programmatically. In this case it's even worse, as the code will just return
None on error, and you don't know why.

~~~
orf
^ This. Never call print from a library, what if I'm using a script to pipe
stdout somewhere. Just throw a custom GeolocationException or something, with
some useful data about what went wrong. In this specific case though, just
don't bother catching the exception. It's not useful and it indicates
something is terribly wrong.

~~~
jonathan-kosgei
Fixed
[https://github.com/ipdata/python/blob/master/ipdata/ipdata.p...](https://github.com/ipdata/python/blob/master/ipdata/ipdata.py)
will add enhancements when I can.

------
kasbah
I host my own instance of [https://freegeoip.net](https://freegeoip.net). Any
advantages this would have over that?

~~~
jonathan-kosgei
Hi Kasbah, :) Several.

\- The Global infrastructure backing ipdata.co is pretty impressive, 4 data
centers in the US, 1 in Canada, 2 in Europe and 1 each in Mumbai, Sydney and
Seoul.

\- We offer more datapoints, I tried to build this around the most common use
cases for Geolocation, one of which is showing your users the right currency.
This is something we provide, that is, the currency ISO code and symbol.

\- I think our API is pretty darn fast :)

Your pros;

You offer more data formats, csv and xml whereas we only offer JSON.

You offer a pretty high free tier but I think there's definitely tonnes of
people who derive a lot of value from ipdata :)

~~~
dylz
1) freegeoip is locally hosted - unlimited queries

2) OK.

3) freegeoip is faster and locally hosted - no network latency

The entire thing runs as a one command docker instance - database updates are
automatically managed

~~~
jonathan-kosgei
I don't mean to take anything away from freegeoip, this is basically the self-
hosted vs external API debate that I've already responded to here. In short,
there're cases where each solution shines more than the other.

------
no_protocol
I wonder if you can change the pricing plans and language around them a
little. What happens if I'm going along happily on the 2500/day plan and
suddenly I get hit with a traffic spike and need 20,000/day for 3 days until
things calm down? If you're going to use pricing buckets like this it probably
needs to also come with an automated way to bump the plan if needed.

Someone else in the thread suggested Maxmind as an alternative. Their prices
seem to be several times higher than yours. Can you double your prices? It
seems really cheap. Too cheap?

Also, the location identified for me was off by 60 miles.

On your Documentation page you've used 8.8.8.8 as an example IP address. And
1.1.1.1, and 2.2.2.2... I'd rather see you use the IPv4 address blocks
reserved for documentation by RFC 5737 [0]. That's what they're for!
Unfortunately, they probably don't have any actual data associated with them
so the examples would need to be fabricated...hmm.

And it looks like actually using one of those results in some output that does
not conform to the format on your documentation page, so you'd best also add
documentation about error handling.

[0]:
[https://tools.ietf.org/html/rfc5737](https://tools.ietf.org/html/rfc5737)

~~~
mywittyname
You can download the Maxmind database locally. I don't see the option for that
from IpData. That's worth the price increase for me.

Having a web API is great for low- or mid-volume applications, but adding 10ms
per user for an HTTPS call would still be like 1000x slower than hitting a
local DB.

~~~
chatmasta
Just cache the responses so that only the first time a new IP connects it
needs to be looked up (until cache fills)

Integrating maxmind is a bit of a pain and it’s a massive database. Not well
suited to use cases like single purpose or ephemeral containers.

You’ll probably end up storing the maxmind db in a separate node on your local
network, anyway. So you still have a latency issue (although lower,
obviously). More importantly you now need to maintain an extra box per
replicated cluster. It could make sense to outsource that management if the
latency between your data center and ipdata is acceptable. Such low latency is
easily achievable if ipdata has BGP anycast on servers in the same cloud
region as your app.

~~~
ddorian43
It's a 100mb db. You load it in-memory (mmap) on every webserver.

~~~
chatmasta
I consider 100mb to be quite large. That could easily double memory
consumption of an application. Most http services are light but widely
replicated. Adding 100mb of memory usage to each replica is certainly a
tradeoff.

~~~
ddorian43
Assuming mmap 100mb will happen only once in each web-server.

~~~
chatmasta
What exactly do you mean by web server? Generally you will have at least one
server process wherever you do the maxmind lookup, which could be at the
LB/proxy (Nginx) or app server (node, python, go, etc).

Nowadays these services are often heavily decoupled and therefore built to be
as lightweight as possible. Think about small single purpose containers.
Adding 100mb of memory requirements per instance could be quite expensive,
depending which existing process is calling maxmind.

~~~
boundlessdreamz
are you passing the original ip addresses to all these containers? Why don't
you just decode the ip to location at the edge of your network (typically load
balancer) and add a header with location?

~~~
chatmasta
That’s the best way to do it of course. But then you’re adding 100mb to each
instance in your load balancing layer.

------
cmg
Looks very cool and I'm going to give the free tier a try on a project. But
this concerns me:

> Can I update my card details?

> Yes. Send an email to support@ipdata.co. Your request will be processed
> within 24hrs.

What is your process there? You're not asking people to send credit card
information via email, right?

~~~
jonathan-kosgei
Definitely not! :) We'd send you a unique link to a page where you can update
your details. We'd never expose your credit card information in that manner.

~~~
lucideer
Good to hear, but I'd still be a bit concerned that the wording above might
lead some inexperienced/not-security-conscious person to send you their
details via email outright.

~~~
jonathan-kosgei
Good point, I think there's another way we could do it. Let me fix that.

~~~
cmg
You actually have good language right on your /faq.html page that should
address this.

>Yes, send an email to support@ipdata.co requesting the change. You will
receive a link from where you'll be able to securely update your details.

~~~
jonathan-kosgei
Fixed the front page.

------
Drdrdrq
I wonder what the source of the data is? Also, local queries are a must for
most web apps... Otherwise latency is just too high.

~~~
jonathan-kosgei
Please see my reply to mywittyname, basically, there are certain situations
where being able to take advantage of our globally distributed infrastructure
is the best call and I 100% agree that there are situations where using a
local db is simply the best (only) call.

------
lluft
How do you compare to Maxmind in regards of data quality?

~~~
reaperducer
I can't speak for anyone else, but it's got me pegged 571 miles from my actual
location. Not even close enough for an ICBM.

~~~
jonathan-kosgei
I'm going to paste my reply to dewski above, Unfortunately, it's never going
to be a 100%. If it's not able to pin you exactly it'll place your location as
the center of the population. If you could send me your location and ip
address at jonathan at ipdata dot co. I can keep tabs on this and see if
accuracy improves.

------
coderholic
Congrats on the launch and the HN coverage @jonathan-kosgei! Looks very
similar to my service, [https://ipinfo.io](https://ipinfo.io):

    
    
        $ curl ipinfo.io/8.8.8.8
        {
          "ip": "8.8.8.8",
          "hostname": "google-public-dns-a.google.com",
          "city": "Mountain View",
          "region": "California",
          "country": "US",
          "loc": "37.3860,-122.0840",
          "org": "AS15169 Google LLC",
          "postal": "94035",
          "phone": "650"
        }
    

It also started as a simple geolocation API when I first launched it over 3
years ago. Since then we've built many custom data sets and expanded to more
products, including IP to company details, carrier detection, reverse IP
hosting data and more. See
[https://ipinfo.io/products](https://ipinfo.io/products). We've been lucky
enough to signup customers like Dell, Tesla, eBay, TripAdvisor, Plesk and
others. Happy to chat and share notes at some point!

~~~
hidiegomariani
where do you guys get all this ip-to-location data from?

~~~
alam2000
There are several providers in the market such as Maxmind GeoIP2 or
IP2Location LITE.

------
styfle
How accurate can you get with an IP address? I seems like it could act as a
fallback if the geolocation web api is blocked.

I have a side project[0] that uses the geolocation api to post to Slack and
seems to be pretty accurate, even on mobile. Maybe I'll try this as a
fallback.

[0]: [https://github.com/styfle/geoslack](https://github.com/styfle/geoslack)

~~~
coderholic
Here's a guide on doing exactly that - falling back to IP geolocation when
browser geolocation is blocked (or unavailable):
[https://ipinfo.io/developers/replacing-
getcurrentposition](https://ipinfo.io/developers/replacing-getcurrentposition)

------
jonathan-kosgei
Just a few reasons why to use Ipdata;

1\. Currency Data - The user's country's Currency ISO code and symbol are
returned in the API output.

2\. Phone Code Data - The user's country's Calling code is returned as well.

3\. Global Footprint - Endpoints in 10 locations globally. 4 on both US
coasts, 1 in Canada, 2 in Europe, 1 each in Mumbai, Seoul and Sydney. This
ensures you get pretty low latencies wherever your app is hosted and wherever
your end users are located.

4\. Solid Infrastructure - The infrastructure backing Ipdata is pretty
impressive, and built to scale to a substantial amount of traffic - in the
hundreds of millions.

5\. A free tier of 1500 requests daily (45 000/month) with no signup or credit
card needed.

6\. Examples in multiple languages on the Docs page at
[https://ipdata.co/docs.html](https://ipdata.co/docs.html), to make
integrating with your site absolutely painless.

7\. Regularly updated data - we check for changes daily and regularly update
our data.

Coming soon; VPN/Proxy and Tor exit node data.

------
nailer
> Up to 1500 free requests daily with no credit card or signup required

Neat. I'll make an updated express-geoip using this today or tomorrow.

~~~
jonathan-kosgei
Awesome! Ping me at jonathan at ipdata dot co if you'd like to discuss
anything!

------
thomasconner
I have added a JavaScript Library. [https://github.com/thomasconner/ipdata-js-
library](https://github.com/thomasconner/ipdata-js-library)

~~~
jonathan-kosgei
Too cool! Ping me at jonathan at ipdata dot co and I'll set you up with free
api keys for this! :) We can also talk about adding including some examples on
the docs page.

------
jscholes
> We regularly update our data, with checks for changes in IP address
> allocations made everyday.

`everyday` is an adjective, in this case you should use `every day` as two
separate words.

~~~
jonathan-kosgei
Fixed! Appreciate the feedback :)

------
jonathan-kosgei
Our API now supports Tor Exit Node detection:
[https://api.ipdata.co/103.10.197.50](https://api.ipdata.co/103.10.197.50),
you can also try it against a current list of Tor Nodes here
[https://check.torproject.org/cgi-
bin/TorBulkExitList.py?ip=1...](https://check.torproject.org/cgi-
bin/TorBulkExitList.py?ip=1.1.1.1)

------
kharms
You should include the free plan on the pricing page.

~~~
jonathan-kosgei
That's probably what's causing the confusion, thanks. Adding that right now..

------
larelli
I tried "curl ipdata.co" and got a 301 page. It'd be great to get the same
json back that's shown on the webpage.

~~~
jonathan-kosgei
The API endpoint is [https://api.ipdata.co](https://api.ipdata.co) try "curl
[https://api.ipdata.co"](https://api.ipdata.co")

------
ggm
please explain your data source model. How do you integrate the RIR data, the
NIR data, BGP and RTT location/estimation data to arrive at the geoid of where
any given IP is. How do you handle multi=national ASN or cellular ASN using
IPs across borders? (disclosure: I work in a regional internet registry)

~~~
jonathan-kosgei
We aggregate our data from multiple existing sources. I'm going to add a Data
section to our site explaining this in more detail.

------
agotterer
FYI, tried to contact you but the contact form is broken and is raising a 405
error.

~~~
jonathan-kosgei
Please send an email to jonathan at ipdata dot co or support at ipdata dot co

------
Shoothe
Very nice service. Using unicode emoji for flags would be better than pngs
IMO.

~~~
jonathan-kosgei
That's a very intriguing idea. I'm definitely going to look into the mechanics
of this. I don't know if it'd make it possible to have them in different
sizes, but thanks for this! I'm definitely going to look into adding a field
with this.

~~~
Shoothe
Well they are characters so they are in different sizes by design (like vector
graphics).

For the reference here you have one with description how they are generated:
[https://emojipedia.org/flag-for-united-states/](https://emojipedia.org/flag-
for-united-states/)

~~~
jonathan-kosgei
Thanks, will check it out.

------
gsaqui
Are you able to flag an IP address as an IP coming from a VPN?

~~~
preinheimer
The folks at [http://getipintel.net/](http://getipintel.net/) can give you
some decent information about wether an IP looks spammy or not.

> Given an IP address, the system will return a probabilistic value (between a
> value of 0 and 1) of how likely the IP is a VPN / proxy / hosting / bad IP.
> A value of 1 means that IP is explicitly banned (a web host, VPN, or TOR
> node) by our dynamic lists.

We've been using it for a while and are pretty happy.

~~~
gsaqui
Will check this out - thank you.

------
rhyst
"Lantency based routing" \- typo on landing page?

~~~
jonathan-kosgei
Thanks! Fixing that right now.

------
rmason
In my case it was off by 24 miles. That's the furthest off I've ever seen a
Geolocation API be. The best are within a couple of hundred feet.

------
qwerty456127
By the way, it would be nice to also include ISO 3166-2 state code (e.g. US-AL
for Alabama, AU-TAS for Tasmania, TZ-26 for Manyara etc).

~~~
jonathan-kosgei
That sounds like a great idea, I'll consider adding this, is there a specific
use case for this format?

------
_Codemonkeyism
"Free IP Geolocation API" vs. "Choose Your Pricing Plan"

What Geo IP service would people suggest instead?

~~~
jonathan-kosgei
I think the freemium model is pretty common in Saas. And I think a free tier
of 45 000 requests a month, 1500 per day is pretty generous. Anything running
as a hobby app/side project would run pretty well within that tier. Most users
making more than 1500 requests a day have no issue paying.

~~~
_Codemonkeyism
I think 1500 per day is practically useless unless for a very small side
project. My old blog got many more daily unique visitors, but YMMV.

[edit] Aside from that, I personally would not do business with someone
describing his own offer as "pretty generous", but that's just me.

------
boyd9461
Do you support GeoJSON formatted output?

~~~
jonathan-kosgei
Hi, I'm not sure our data would fit this format but at the moment it's not
supported.

------
jsteemann
Just to let you know: Google+ link on webpage is not doing anything, as it
simply links to "#".

~~~
jonathan-kosgei
We actually haven't setup our Google+ presence yet.

------
simonebrunozzi
Anybody has heard about FOAM? It seems a similar use case.

------
mycentstoo
Design looks great!

~~~
jonathan-kosgei
Thanks!

------
sbr464
Lantency spelling on link, just heads up

~~~
jonathan-kosgei
Thanks! Fixing that right now.

~~~
jonathan-kosgei
Fixed.

------
chrisseldo
What about adding zipcode?

~~~
jonathan-kosgei
There's a "postal" field in the API output containing the postal code.

