Сервис возвращает справочник типов и категорий геообъектов — POI, зданий, транспортных объектов и т.д. Используется для получения актуального списка значений параметра types в /api/search, /api/places и других ручках.
Типы организованы иерархически: категория/подкатегория/тип. Например: shop/food/bakery.
| Параметр | Тип | По умолчанию | Описание | Пример |
|---|---|---|---|---|
q |
string | — | Префикс категории или типа. Если не указан — возвращаются все доступные типы. Можно передать несколько через запятую. | q=shop/food/b / q=public_transport |
| Поле | Тип | Описание |
|---|---|---|
request |
string | Строка исходного запроса |
results |
array | Список найденных типов |
Каждый элемент results:
| Поле | Тип | Описание |
|---|---|---|
key |
string | Уникальный ключ типа (используется в параметре types других запросов) |
classification_type |
string | Классификация: kind (вид), category (категория) |
attributes |
object | Метаданные типа |
attributes.name |
string | Название типа на английском |
attributes.name:ru |
string | Название на русском |
attributes.icon |
string | Иконка |
attributes.clr_l |
string | Цвет для светлой темы (HEX) |
attributes.clr_d |
string | Цвет для тёмной темы (HEX) |
attributes.features_count |
integer | Количество объектов данного типа в базе |
attributes.categories |
array | Категории, к которым относится тип |
Запрос:
/api/types?q=shop/food/b
Ответ:
{
"request": "/api/types?q=shop/food/b",
"results": [
{
"attributes": {
"categories": ["c/shop_food"],
"clr_d": "#EDB25E",
"clr_l": "#FF990A",
"features_count": 204356,
"icon": "bakery",
"name": "Bakery",
"name:de": "Bäckerei",
"name:en": "Bakery",
"name:ru": "Булочная",
"tag": 1060102
},
"classification_type": "kind",
"key": "shop/food/bakery"
},
{
"attributes": {
"features_count": 26644,
"icon": "beverages",
"name": "Beverage Store",
"name:ru": "Напитки"
},
"classification_type": "kind",
"key": "shop/food/beverages"
}
]
}
Запрос:
/api/types?q=public_transport
{
"openapi": "3.0.0",
"info": {
"title": "Геокодер — Types API",
"version": "5.0.0"
},
"paths": {
"/api/types": {
"get": {
"summary": "Типы объектов (v3)",
"description": "Возвращает справочник типов и категорий геообъектов.",
"tags": ["Types"],
"parameters": [
{
"name": "q",
"in": "query",
"description": "Префикс типа или категории. Несколько значений через запятую. Без параметра — возвращает все типы.",
"schema": {
"type": "string",
"example": "shop/food/b"
}
}
],
"responses": {
"200": {
"description": "Список типов объектов",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"request": { "type": "string" },
"results": {
"type": "array",
"items": {
"type": "object",
"required": ["key", "classification_type", "attributes"],
"properties": {
"key": {
"type": "string",
"description": "Ключ типа для использования в параметре types",
"example": "shop/food/bakery"
},
"classification_type": {
"type": "string",
"enum": ["kind", "category"]
},
"attributes": {
"type": "object",
"properties": {
"name": { "type": "string" },
"name:ru": { "type": "string" },
"icon": { "type": "string" },
"clr_l": { "type": "string" },
"clr_d": { "type": "string" },
"features_count": { "type": "integer" },
"categories": {
"type": "array",
"items": { "type": "string" }
}
}
}
}
}
}
}
}
}
}
},
"400": { "description": "Некорректный запрос" }
}
}
},
"/api/types": {
"get": {
"summary": "Типы объектов (v5)",
"description": "Актуальная версия справочника типов.",
"tags": ["Types"],
"parameters": [
{
"name": "q",
"in": "query",
"schema": { "type": "string", "example": "public_transport/station_subway" }
}
],
"responses": {
"200": { "description": "Список типов объектов" },
"400": { "description": "Некорректный запрос" }
}
}
}
}
}