Reference · 1.0.0
API reference
The public /v1 API, generated from its OpenAPI schema. Every request needs an API key in the Authorization: Bearer header; every error uses the standard error envelope.
- Base URL
- https://developers.ubhub.mn
- OpenAPI
- /openapi.json/docs/redoc
Geocode a place, address or coordinate
/v1/geocodeOne geocoding endpoint in two directions:
- **Forward** — pass q (a place name or address). Results are ranked: exact name matches first, then names starting with the query, then names containing every word.
- **Reverse** — pass lat and lon. The single nearest meaningful location is returned, with type set to the match kind (address, place, street) and distance_meters set.
Both directions return the same shape: a results array (empty when nothing matched, which is not an error). Send either q or both lat and lon, not both and not neither.
Query parameters
| Name | Type | Constraints | Description |
|---|---|---|---|
qoptional | string | null | — | Forward geocoding: place name or address. Latin and Cyrillic are both supported. |
latoptional | number | null | — | Reverse geocoding: latitude (WGS84). |
lonoptional | number | null | — | Reverse geocoding: longitude (WGS84). |
limitoptional | integer | 1 to 20, default 5 | Forward geocoding: maximum number of results. |
Response 200 · GeocodeResponse
| Field | Type | Description |
|---|---|---|
query | string | The text searched, or lat,lon for a reverse lookup. |
results | GeocodeResult[] | |
results[].id | string | Opaque, stable identifier of the place. |
results[].name | string | |
results[].addressoptional | string | null | |
results[].latitude | number | |
results[].longitude | number | |
results[].type | string | Place category, or for reverse lookups the match kind (address, place, street). |
results[].distance_metersoptional | number | null | Only for reverse lookups: distance in metres from the requested point to this match. |
count | integer | Number of results returned. |
Errors
| Status | Code | Example message |
|---|---|---|
| 400 | INVALID_REQUEST | Invalid value for 'lat': must be between -90 and 90. |
| 401 | INVALID_API_KEY | The API key is missing or invalid. |
| 403 | API_KEY_REVOKED | This API key has been revoked. |
| 408 | REQUEST_TIMEOUT | The data service did not respond in time. |
| 429 | RATE_LIMIT_EXCEEDED | Too many requests. |
| 500 | INTERNAL_ERROR | Internal server error. |
| 502 | UPSTREAM_ERROR | The upstream data service returned an error. |
| 503 | SERVICE_UNAVAILABLE | The service is temporarily unavailable. |
Try it
/v1/geocodePlaygroundRequest
curl "https://developers.ubhub.mn/v1/geocode?q=Sukhbaatar%20Square&limit=5" \ -H "Authorization: Bearer YOUR_API_KEY"
Response
Send a request to see the response.
Calculate a route between two points
/v1/routeReturns the fastest route for the chosen travel mode, with its distance, estimated travel time and a GeoJSON LineString. Origin and destination are snapped to the nearest road the mode can use; the snapped points are returned in waypoints.
Query parameters
| Name | Type | Constraints | Description |
|---|---|---|---|
originrequired | string | 0–64 characters | Longitude and latitude separated by a comma, in that order (GeoJSON order). |
destinationrequired | string | 0–64 characters | Longitude and latitude separated by a comma, in that order (GeoJSON order). |
modeoptional | "driving" | "walking" | default "driving" | Travel mode. |
Response 200 · RouteResponse
| Field | Type | Description |
|---|---|---|
route | Route | |
route.distance_meters | number | |
route.duration_seconds | number | |
route.geometry | LineString | |
route.geometry.typeoptional | "LineString" | |
route.geometry.coordinates | [number, number][] | GeoJSON positions as [longitude, latitude] pairs. |
mode | "driving" | "walking" | |
waypoints | Waypoint[] | Snapped origin and destination, in that order. |
waypoints[].input | Location | The coordinate you sent. |
waypoints[].input.latitude | number | |
waypoints[].input.longitude | number | |
waypoints[].location | Location | The point on the road network the route starts or ends at. |
waypoints[].location.latitude | number | |
waypoints[].location.longitude | number | |
waypoints[].snap_distance_meters | number | Distance between input and location. |
waypoints[].nameoptional | string | null | Name of the road at the snapped location. |
Errors
| Status | Code | Example message |
|---|---|---|
| 400 | INVALID_REQUEST | Invalid value for 'lat': must be between -90 and 90. |
| 401 | INVALID_API_KEY | The API key is missing or invalid. |
| 403 | API_KEY_REVOKED | This API key has been revoked. |
| 404 | NOT_FOUND | No result was found for this request. |
| 408 | REQUEST_TIMEOUT | The data service did not respond in time. |
| 429 | RATE_LIMIT_EXCEEDED | Too many requests. |
| 500 | INTERNAL_ERROR | Internal server error. |
| 502 | UPSTREAM_ERROR | The upstream data service returned an error. |
| 503 | SERVICE_UNAVAILABLE | The service is temporarily unavailable. |
Try it
/v1/routePlaygroundRequest
curl "https://developers.ubhub.mn/v1/route?origin=106.9177%2C47.9184&destination=106.9057%2C47.9220&mode=driving" \ -H "Authorization: Bearer YOUR_API_KEY"
Response
Send a request to see the response.