This page outlines the usage for the APIs provided by Geolake. Currently code examples are only provided in the form of cURL commands, but these should be easily adapted to your application's environment.
The base URL for all API calls is: https://api.geolake.com/geocode?api_key=XYZ
# Test URL
https://api.geolake.com/geocode?api_key=XYZ&q=San+Francisco
Every API call needs to use an API key for authentication. You can generate one or more API keys on the My Account page. Add your key using the api_key querystring parameter.
If you have your address data broken down into address components, you can provide those separately.
You don't have to provide all components, but you are encouraged to provide as many components as you have.
If you have an 'address line 1' that is already split out into a street name, house number and sub number (e.g. suite),
you can pass in those components separately and leave the address parameter empty.
All fields in the response structure are optional as well, and their presence will vary between regions and addresses.
https://api.geolake.com/geocode?api_key=XYZ&country=US&state=CA&city=San+Francisco&address=123+Your+Street+Name+Here
# Object Response { "success": true, "latitude": 37.760676, "longitude": -122.436783, "accuracyType": "city", "typoCorrected": false, "place": { "countryCode": "US", "countryName": "United States", "currencyCode": "USD", "timezone": "America/Los_Angeles", "tld": ".us", "city": "San Francisco" }, "placeId": "YiiZekJ6Y3sCB5f6-yhApO" }
If your address data is not broken down into components, just send in the entire address in the q parameter.
https://api.geolake.com/geocode?api_key=XYZ&q=123+Your+Street+Name+Here,+San+Francisco+,+CA
To geocode an IP address, send in the ip querystring parameter, with the IP in IPv4 format.
https://api.geolake.com/geocode?api_key=XYZ&ip=127.0.0.1
# Object Response { "success": true, "latitude": 37.760676, "longitude": -122.436783, "accuracyType": "iprange", "typoCorrected": false, "place": { "countryCode": "US", "countryName": "United States", "currencyCode": "USD", "timezone": "America/Los_Angeles", "tld": ".us", "city": "San Francisco" } }
To geocode a phone number, send in the phone querystring parameter, preferably in E.164 format. You can also send in the associated country code (e.g. 'US') if this is known. If you send in a phone number in another format that doesn't include a country code, the number will be expected to be from the US unless another country is specified.
Phone number geocoding has a much more limited accuracy than address geocoding. Typically, phone numbers geolocations will only be precise down to a city or even a country.
https://api.geolake.com/geocode?api_key=XYZ&phone=415-701-0000&country=US
# Object Response { "success": true, "latitude": 37.760741, "longitude": -122.436785, "accuracyType": "city", "typoCorrected": false, "place": { "countryCode": "US", "countryName": "United States", "currencyCode": "USD", "timezone": "America/Los_Angeles", "tld": ".us", "city": "San Francisco" } }
If a geocoding request fails, the resulting body will be a JSON object where the key success is set to false.
HTTP Status codes:
200 OK - Everything worked
400 Bad Request - The request was badly built
401 Unauthorized - Invalid API key
402 Request Failed - The request failed, which can happen if the address can't be geocoded
404 Not Found - Requested API method doesn't exist
429 Rate limit has been exceeded
500, 502, 503, 504 Server errors