Skip to main content
Baato’s endpoints are small and consistent, but a few conventions trip people up on the first integration. This page covers all of them.

The response envelope

Every endpoint except Map Styles returns the same wrapper. The payload you want is always under data.
string
Server time when the response was generated, in Nepal Time.
integer
The HTTP status, echoed into the body. It matches the real HTTP status code — check the transport-level status, not this field, when handling errors.
string
Success on a 2xx, or a human-readable explanation otherwise.
array
The results. Always an array, even for endpoints that return a single logical result — Places and Reverse Search both return a one-element array, so read data[0].
Map Styles is the exception: it returns a raw Mapbox Style Specification document with no envelope, because map renderers consume it directly.

Coordinate order

Baato takes latitude and longitude as separate lat and lon parameters, and Directions takes points as "lat,lon" strings. GeoJSON, MapLibre GL and Mapbox GL all take [lon, lat] arrays. Reversing them silently places your map in the wrong hemisphere rather than throwing an error.
Kathmandu is at latitude 27.7172, longitude 85.3240. The same point, three ways:
Baato responses use named fields (centroid.lat, centroid.lon), so the risk is in the handoff to your map library:
The one place Baato does emit renderer-order coordinates is the geometry field on a Place, which is GeoJSON and therefore already [lon, lat].

Identifying a place

The two-step search flow exists because search responses are optimised for autocomplete UIs — they omit geometry to stay small and fast:
1

Search returns lightweight suggestions

GET /search?q=patan → name, address, type, placeId. No coordinates.
2

Places resolves one suggestion in full

GET /places?placeId=344470 → centroid, geometry and OpenStreetMap tags.
Call step two only when the user picks a result, not for every keystroke.

Encoded polylines

Directions returns route geometry as encodedPolyline — a compact string in Google’s encoded polyline format, rather than a large GeoJSON LineString. Decode it before handing it to a renderer.
Alongside the geometry, every route carries distanceInMeters, timeInMs (milliseconds, not seconds) and — when you request instructions=true — an instructionList. Without that parameter, instructionList is null rather than an empty array.

Place types

The type field is drawn from OpenStreetMap map features. Baato also defines a few merged types that combine related features, so type=eat returns cafes, restaurants and bakeries together. The full list is on the Nearby Places page.

Relevance scores

Search and Places results carry a score. Higher is more relevant, but the scale is not normalised — compare scores within a single response, never across responses.
Endpoints that do not compute a score return the string "NaN" rather than a number or null. Guard against it before doing arithmetic:

Versioning

All endpoints live under https://api.baato.io/api/v1. See API versioning for how new versions are introduced.