Get City Details

The Geobytes Get City Details API is the free version of our legacy IP Locator API. You can use it to to programmatically determine the service area of an IP Address.

In PHP, for example you might access this service like this:

Which produces an output of something like this:

More than just resolves the location of IP Addresses

In addition to resolving the location of IP Addresses, the Get City Details API can accept a Geobytes Location Code (which you can lookup here), – as in this example:

or a fully qualified city name – as in this example:

or a Latitude and Longitude – as in this example where we are using it to GeoCode to the nearest city:

BTW If you would like to see a live real life example, then there is not a lot of point viewing the source of this page, as although this page does use the above example to populate the city details above, this is a server side example so you can’t see it in this page’s source.

However, because the Get City Details API also supports returning the city’s details in JSON-P format, you can also use it client side by setting the “callback” parameter – and our Ajax Autocomplete Cities List page does just this – in that case you can view the source of the page to see how the two APIs are working together to provide the user with a facility to select a city from a list, and then to display that city’s details in a web form.

Optional Default Location Parameter

Finally, there is one optional parameter that you can use to set the default location that the API will return in the 1% or so of cases where our server is unable to determine location of the IP Address. The default location is set via the “defaultlocation” parameter as shown in this example:

Example using curl and grep


Reasonable Free Access Limits

If you expect to exceed the services “Reasonable Free Access Limit” of 16,384 accesses per hour, (about 4.5 look-ups per second), or wish to access the service via SSL, then you may wish to purchase some Mapbytes to pay for these additional look-ups, and thereby become a VIP.

VIP Access does have its advantages. In addition to being able to exceed the free quoter limits mentioned above, VIP clients also receive:

  • SSL Access to all of our API’s
  • Email Notification of Events that could impact their access
  • Email Support
  • VIP Priority handling of their API requests

You can become a VIP by purchasing as little as $9.99 worth of Mapbytes via the Buy Now Buttons in the right margin – that by the way works out at about 1/100th of a cent per request or 10,000 requests per dollar.

– because everybody's somewhere