Skip to content
Getting started

Overview

Getting started

From zero to your first geocoding result in five steps.

1. Create an account

Create a developer account with your name, email and a password of at least 10 characters. Enter the code sent to your email to verify the address and open the developer dashboard.

2. Create an API key

  1. Open API keys in the dashboard.
  2. Choose Create API key, give it a name that says where it is used (for example "Production backend"), choose the endpoints it may call and when it expires, and confirm.
  3. Copy the key or download it. It looks like geo_ followed by 32 letters and digits.

The key is shown only once

Only a hash of the key is stored, so it cannot be displayed again. If you lose it, regenerate the key or create a new one.

3. Make your first request

Search for a place with the geocoding endpoint. Replace YOUR_API_KEY with your key:

Terminal
curl "https://developers.ubhub.mn/v1/geocode?q=Ulaanbaatar" \
  -H "Authorization: Bearer YOUR_API_KEY"

The same request in other languages:

curl -G "https://developers.ubhub.mn/v1/geocode" \
  -d q=Ulaanbaatar \
  -d limit=5 \
  -H "Authorization: Bearer YOUR_API_KEY"

4. Read the response

A successful request returns 200 OK with a JSON body like this:

200 OK
{
  "query": "Ulaanbaatar",
  "results": [
    {
      "id": "loc_ff6ee5b78230a6a5",
      "name": "Ulaanbaatar OU School",
      "address": "18-р хороо, Хан-Уул, Mongolia",
      "latitude": 47.89872,
      "longitude": 106.92998,
      "type": "poi"
    },
    {
      "id": "loc_868bb41091d20580",
      "name": "Ulaanbaatar 2 Station",
      "address": "29-р хороо, Баянгол, Mongolia",
      "latitude": 47.908137,
      "longitude": 106.844495,
      "type": "poi"
    }
  ],
  "count": 2
}

Response fields

query
string
The search text, with whitespace normalized.
results
array
Matches, best first. Empty when nothing matched (still 200).
results[].latitude / longitude
number
Where the place is (WGS84).
count
integer
Number of results returned.

Also look at the response headers: X-RateLimit-Remaining tells you how many requests you have left in the current minute, and X-Request-ID identifies the request if you need support.

5. Integrate into your application

  • Building with React or Next.js? Install @ubhub/maps and follow the React & Next.js SDK guide for maps, search, and a server route that keeps your key secret.
  • Building with Flutter? Install ubhub_maps and follow the Flutter SDK guide for native maps, search, and API calls.
  • Keep privileged keys on your server. Direct mobile access requires a restricted key and controlled quotas; embedded keys are extractable. See Keeping keys safe.
  • Set a timeout on every request and cancel stale ones (for example with an AbortController in JavaScript). See Code examples for each language.
  • Handle errors by their code, and back off when you get 429. See Errors and Rate limits.
  • For search-as-you-type, wait about 300 ms after the last keystroke before calling /v1/geocode, and cancel the previous request when a new one starts.
  • Watch your traffic on the Usage page of the dashboard.