Geolocation API
Using the API from JavaScript?
IP Geolocation
GET https://api.maptiler.com/geolocation/ip.json
Obtain information about visitor's location based on IP address of the incoming request.
Request
You must include an API Key with every API request
Request example
https://api.maptiler.com/geolocation/ip.json?key=YOUR_MAPTILER_API_KEY
Get your FREE API key in the MapTiler Cloud.
Responses
Code | Content | Description |
---|---|---|
200 | application/json | GeolocationResult Object |
403 |
Key is missing, invalid or restricted |
GeolocationResult Object
Property | Type | Description |
---|---|---|
country | string | Name of the country
Example: Switzerland |
country_code | string |
Two-letter code of the country
ISO 3166-1 alpha-2 codes
Example: CH |
country_bounds |
array [= 4 number] |
Bounds of the country in WGS84 degrees [west, south, east, north] .
Example: [5.95538,45.818852,10.490936,47.809357] |
country_languages | array [string] |
Official country languages in ISO 639-1 format.
ISO 639-1 codes
Example: ["de","fr","it"] |
continent | string | Name of the continent
Example: Europe |
continent_code | string | Two-letter code of the continent
Example: EU |
eu | boolean | Indicated whether the country is part of the European Union.
|
city | string | Name of the city
Example: Zurich |
latitude | number | Latitude of the location
Example: 47.36667 |
longitude | number | Longitude of the location
Example: 8.55 |
postal | string | Postal code
Example: 8000 |
region | string |
If known, the ISO 3166-2 name for the first level region.
ISO 3166-2 codes
Example: Zurich |
region_code | string |
If known, the ISO 3166-2 code for the first level region.
ISO 3166-2 codes
Example: ZH |
timezone | string | Name of the timezone
Example: Europe/Zurich |
example
{
"country": "Switzerland",
"country_code": "CH",
"country_bounds": [5.95538, 45.818852, 10.490936, 47.809357],
"country_languages": ["de", "fr", "it"],
"continent": "Europe",
"continent_code": "EU",
"eu": false,
"city": "Zurich",
"latitude": 47.36667,
"longitude": 8.55,
"postal": "8000",
"region": "Zurich",
"region_code": "ZH",
"timezone": "Europe/Zurich"
}
Using the OpenAPI Specification?
Get the openapi.yaml
APIs
- Maps API
- Static Maps API
- Tiles API
- Data API
- Geocoding API
- Geolocation API
- Coordinates API
- Weather API
- Other
- Description
Authentication
Admin API
On this page