Skip to main content

POST /v2/geolocation

OpenAPI Specification

2GIS geolocation API (2.0.0)

Radar team: radar@2gis.ru

API for getting device geolocation

geolocation

Get geolocation

Get estimated geolocation based on the information about surrounding Wi-Fi access points and/or cell towers

query Parameters
key
string

API key, see Overview to learn how to get it

Request Body schema: application/json
required
sessionUUID
required
string

Session UUID. Should remain unchanged during the session of a user working with the service.

captureTimestampUnix
required
number <int64> >= 0

Time (in seconds) of getting information about observed cell towers, Wi-Fi access points and geolocation from the system

Array of objects (wifiAccessPoint)

Currently observed Wi-Fi access points

object (mobileNetwork)
ip
string

External IP address of the device (should be passed if the request is sent not from the device directly but via an application backend)

object

Geolocation data obtained from a GNSS receiver. Used anonymously to improve service performance.

Responses

Response Schema: application/json
state
string
Value: "geoposition_located"
statusCode
number
Value: 200
object (predicted_location)

Request samples

Content type
application/json
{
  • "sessionUUID": "4dec3e75-8966-475a-9541-b4a8fbaaeda2",
  • "captureTimestampUnix": 1624539922,
  • "wifiAccessPoints": [
    • {
      }
    ],
  • "mobileNetwork": {
    • "homeMobileCountryCode": 505,
    • "homeMobileNetworkCode": 217,
    • "cellTowers": [
      ]
    },
  • "ip": "5.128.120.163",
  • "gnssLocation": {
    • "latitude": 52.953096,
    • "longitude": 87.935501,
    • "horizontalAccuracyM": 57,
    • "altitudeM": 1297,
    • "altitudeAccuracyM": 17,
    • "course": 299.6,
    • "courseAccuracy": 15.6,
    • "groundSpeedMS": 36,
    • "groundSpeedAccuracyMS": 11
    }
}

Response samples

Content type
application/json
{
  • "state": "geoposition_located",
  • "statusCode": 200,
  • "location": {
    • "latitude": 52.953096,
    • "longitude": 87.235007,
    • "accuracy": 19
    }
}