Geolocation API

The MapTiler Geolocation API makes it possible to get approximate location of the incoming request, so you can localize your maps and applications. See the intro to IP geolocation to learn how geolocation works and what you can use it for.

How to use the API

  • Directly from your web or backend applications.
  • Via the Geolocation API client library, which wraps the API calls in ready-made functions for easier use in JavaScript. Recommended if you don’t need a map.
  • With our complete map SDK JS. This is the best choice if you want the geolocation service plus a map. See related code examples for inspiration.

Key

You need a MapTiler API key to use this service. Get it here and learn how to protect it.


Geolocation API reference

Scalar API Reference
v1.0
OpenAPI 3.1.0
Server:https://api.maptiler.com

MapTiler API

Client Libraries

Geolocation

Geolocation Operations

IP Geolocation

Obtain information about visitor's location based on IP address of the incoming request.

Query Parameters
  • elevation
    Type: boolean

    Include elevation (in meters) in the results.

Responses
  • application/json
  • 403

    Key is missing, invalid or restricted

Request Example for get/geolocation/ip.json
curl 'https://api.maptiler.com/geolocation/ip.json?key=YOUR_SECRET_TOKEN'
{
  "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",
  "elevation": 433
}
Using the OpenAPI Specification?
Get the openapi.yaml
Was this helpful?
MapTiler API
Geolocation API
Geolocation API