Obtaining object IDs
Depending on the task, some requests may require the ID of an object: a city, region, etc. Below are request examples for obtaining IDs of different objects.
Metro station ID
To send the request, the key needs access to the Places API.
To obtain the metro station ID, send a GET request to /3.0/items with the following parameters:
q- text query, for example "pushkinskaya".location- search point coordinates in thelongitude,latitudeformat, for examplelocation=37.630866,55.752256. You can specify georestriction in another way: for more information, see the Search georestriction instruction.type=station.metro- search for objects with "metro station" type.
Request example:
https://catalog.api.2gis.com/3.0/items?q=pushkinskaya&location=37.630866,55.752256&type=station.metro&key=API_KEY
Response example:
response.json
{
"meta": {
"api_version": "3.0.21070",
"code": 200,
"issue_date": "20260805"
},
"result": {
"items": [
{
"color": "#9B007F",
"full_name": "Москва, Пушкинская",
"id": "4504385606388578",
"name": "Пушкинская",
"route_type": "metro",
"subtype": "metro",
"type": "station"
}
],
"total": 1
}
}
Copy the metro station ID from the result.items.id field.
Place ID
Places are area objects: parks, beaches, recreational areas, lakes, and other locations.
To obtain the place ID, send a GET request to /3.0/items/geocode using one of the following methods:
-
specify the place name, for example
q=VDNH Moscow:https://catalog.api.2gis.com/3.0/items/geocode?q=VDNH Moscow&type=adm_div.place&key=API_KEY -
specify the longitude and latitude of a point, for example
lon=37.637635&lat=55.826241:https://catalog.api.2gis.com/3.0/items/geocode?lon=37.637635&lat=55.826241&type=adm_div.place&key=API_KEY
Specify type=adm_div.place in the request to search for objects with the "place" type.
Response example:
response.json
{
"meta": {
"api_version": "3.0.21070",
"code": 200,
"issue_date": "20260805"
},
"result": {
"items": [
{
"full_name": "Москва, Выставка достижений народного хозяйства",
"id": "4504286822138302",
"name": "Выставка достижений народного хозяйства",
"subtype": "place",
"type": "adm_div"
}
],
"total": 1
}
}
Copy the place ID from the result.items.id field.
City ID
To obtain the city ID, send a GET request to /3.0/items/geocode using one of the following methods:
-
specify the city name, for example
q=Moscow:https://catalog.api.2gis.com/3.0/items/geocode?q=Moscow&type=adm_div.city&key=API_KEY -
specify the longitude and latitude of a point, for example
lon=37.630866&lat=55.752256:https://catalog.api.2gis.com/3.0/items/geocode?lon=37.630866&lat=55.752256&type=adm_div.city&key=API_KEY
Specify type=adm_div.city in the request to search for objects with the "city" type.
Response example:
response.json
{
"meta": {
"api_version": "3.0.21070",
"code": 200,
"issue_date": "20260807"
},
"result": {
"items": [
{
"full_name": "Москва",
"id": "4504222397630173",
"name": "Москва",
"subtype": "city",
"type": "adm_div"
}
],
"total": 1
}
}
Copy the city ID from the result.items.id field.
Region ID
To send the request, the key needs access to the Regions API.
Region IDs are not linked to the codes of subjects of the Russian Federation.
To obtain the region ID, send a GET request to /2.0/region/search and specify the region name, for example q=Moscow.
Request example:
https://catalog.api.2gis.com/2.0/region/search?q=Moscow&key=API_KEY
Response example:
response.json
{
"meta": {
"api_version": "2.0.20926",
"code": 200,
"issue_date": "20260630"
},
"result": {
"items": [
{
"id": "32",
"name": "Москва",
"type": "region"
}
],
"total": 1
}
}
Copy the region ID from the result.items.id field.