Skip to content

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
GETGeocoding

Geocode a place, address or coordinate

GET/v1/geocode

One 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.

Read the guide

Query parameters

Geocode a place, address or coordinate parameters
NameTypeConstraintsDescription
qoptionalstring | null—Forward geocoding: place name or address. Latin and Cyrillic are both supported.
latoptionalnumber | null—Reverse geocoding: latitude (WGS84).
lonoptionalnumber | null—Reverse geocoding: longitude (WGS84).
limitoptionalinteger1 to 20, default 5Forward geocoding: maximum number of results.

Response 200 · GeocodeResponse

Geocode a place, address or coordinate response fields
FieldTypeDescription
querystringThe text searched, or lat,lon for a reverse lookup.
resultsGeocodeResult[]
results[].idstringOpaque, stable identifier of the place.
results[].namestring
results[].addressoptionalstring | null
results[].latitudenumber
results[].longitudenumber
results[].typestringPlace category, or for reverse lookups the match kind (address, place, street).
results[].distance_metersoptionalnumber | nullOnly for reverse lookups: distance in metres from the requested point to this match.
countintegerNumber of results returned.

Errors

Geocode a place, address or coordinate errors
StatusCodeExample message
400INVALID_REQUESTInvalid value for 'lat': must be between -90 and 90.
401INVALID_API_KEYThe API key is missing or invalid.
403API_KEY_REVOKEDThis API key has been revoked.
408REQUEST_TIMEOUTThe data service did not respond in time.
429RATE_LIMIT_EXCEEDEDToo many requests.
500INTERNAL_ERRORInternal server error.
502UPSTREAM_ERRORThe upstream data service returned an error.
503SERVICE_UNAVAILABLEThe service is temporarily unavailable.

Try it

GET/v1/geocodePlayground
Parameters

Place name or address, 2–200 characters. (Reverse geocoding uses lat & lon; see the docs.)

Maximum results, 1–20.

Authorization

Loading your keys…

Request

GET /v1/geocode?q=Sukhbaatar%20Square&limit=5
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.

GETRouting

Calculate a route between two points

GET/v1/route

Returns 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.

Read the guide

Query parameters

Calculate a route between two points parameters
NameTypeConstraintsDescription
originrequiredstring0–64 charactersLongitude and latitude separated by a comma, in that order (GeoJSON order).
destinationrequiredstring0–64 charactersLongitude and latitude separated by a comma, in that order (GeoJSON order).
modeoptional"driving" | "walking"default "driving"Travel mode.

Response 200 · RouteResponse

Calculate a route between two points response fields
FieldTypeDescription
routeRoute
route.distance_metersnumber
route.duration_secondsnumber
route.geometryLineString
route.geometry.typeoptional"LineString"
route.geometry.coordinates[number, number][]GeoJSON positions as [longitude, latitude] pairs.
mode"driving" | "walking"
waypointsWaypoint[]Snapped origin and destination, in that order.
waypoints[].inputLocationThe coordinate you sent.
waypoints[].input.latitudenumber
waypoints[].input.longitudenumber
waypoints[].locationLocationThe point on the road network the route starts or ends at.
waypoints[].location.latitudenumber
waypoints[].location.longitudenumber
waypoints[].snap_distance_metersnumberDistance between input and location.
waypoints[].nameoptionalstring | nullName of the road at the snapped location.

Errors

Calculate a route between two points errors
StatusCodeExample message
400INVALID_REQUESTInvalid value for 'lat': must be between -90 and 90.
401INVALID_API_KEYThe API key is missing or invalid.
403API_KEY_REVOKEDThis API key has been revoked.
404NOT_FOUNDNo result was found for this request.
408REQUEST_TIMEOUTThe data service did not respond in time.
429RATE_LIMIT_EXCEEDEDToo many requests.
500INTERNAL_ERRORInternal server error.
502UPSTREAM_ERRORThe upstream data service returned an error.
503SERVICE_UNAVAILABLEThe service is temporarily unavailable.

Try it

GET/v1/routePlayground
Parameters

longitude,latitude

longitude,latitude

Travel mode.

Authorization

Loading your keys…

Request

GET /v1/route?origin=106.9177%2C47.9184&destination=106.9057%2C47.9220&mode=driving
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.