Find Place API — Геокодиране и търсене на места | YEB

Търсете градове, населени места и локации по име или координати с бързо префиксно съвпадение, географски филтри и богати OSM метаданни. Идеално за автодовършване, гео-ограждане и обогатяване на данни.

Какво можете да правите?
Мигновено автодовършване

Получавайте резултати бързо с търсене по префикс, толерантно към грешки.

Прецизно гео-ограждане

Търсете по град, ограничителна рамка или радиус.

Богати метаданни за мястото

OSM идентификатори, население, показвано име и още.

Изпробвай на живо
99.9 % Време на работа
93.7ms Отговор
20 req/s
0.009 Кредити / заявка

Find Place by Name


POST https://api.yeb.to/v1/place/find-by-name
Parameter Type Required Description
api_key string yes Your API key
q string yes Search text (city, village, etc)
country_code string opt 2-letter ISO country filter
limit int opt Max results (1-100, default 20)
offset int opt Pagination offset

Example

curl -X POST https://api.yeb.to/v1/place/find-by-name \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "YOUR_KEY",
    "q": "sofia",
    "country_code": "BG",
    "limit": 5
}'

Integrations

curl -X POST https://api.yeb.to/v1/place/find-by-name \
  -H "Content-Type: application/json" \
  -d '{"api_key":"YOUR_KEY","q":"sofia","country_code":"BG","limit":5}'
$r = Http::post('https://api.yeb.to/v1/place/find-by-name', [
    'api_key' => 'YOUR_KEY', 'q' => 'sofia', 'country_code' => 'BG', 'limit' => 5
]);
echo $r->json();
fetch('https://api.yeb.to/v1/place/find-by-name', {
  method:'POST',
  headers:{'Content-Type':'application/json'},
  body:JSON.stringify({api_key:'YOUR_KEY',q:'sofia',country_code:'BG',limit:5})
}).then(r=>r.json()).then(console.log);
import requests, json
payload = {"api_key":"YOUR_KEY","q":"sofia","country_code":"BG","limit":5}
r = requests.post('https://api.yeb.to/v1/place/find-by-name', headers={'Content-Type':'application/json'}, data=json.dumps(payload))
print(r.json())

Response Example

{
  "query": "sofia",
  "count": 1,
  "places": [
    {
      "id": 727011,
      "name": "Sofia",
      "country_code": "BG",
      "osm_id": 240109189,
      "osm_type": "relation",
      "type": "city",
      "population": 1286383,
      "lat": 42.6977,
      "lng": 23.3219,
      "bbox": {
        "min_lat": 42.582,
        "max_lat": 42.815,
        "min_lng": 23.042,
        "max_lng": 23.461
      },
      "address": {
        "city": "Sofia",
        "state": "Sofia City Province",
        "country": "Bulgaria"
      },
      "display_name": "Sofia, Bulgaria"
    }
  ]
}
{
  "error": "Missing place name (q)",
  "code": 400
}

Кодове на отговор

КодОписание
200 SuccessЗаявката е обработена успешно.
400 Bad RequestНеуспешна валидация на входните данни.
401 UnauthorizedЛипсващ / грешен API ключ.
403 ForbiddenКлючът е неактивен или без достъп.
429 Rate LimitТвърде много заявки.
500 Server ErrorНеочаквана грешка.

Find by Name

place/find-by-name 0.0090 credits

Parameters

API Key
query · string · required
Query
query · string · required
Country code
query · string
Limit
query · integer
Offset
query · integer

Code Samples


                
                
                
            

Response

Status:
Headers

                
Body

                

Find Place by Coordinates


POST https://api.yeb.to/v1/place/find-by-coord
Parameter Type Required Description
api_key string yes Your API key
lat float yes Latitude of centre point
lng float yes Longitude of centre point
radius float opt Radius in kilometers (default: 10)
limit int opt Max results (1-100, default 10)
offset int opt Pagination offset

Example

curl -X POST https://api.yeb.to/v1/place/find-by-coord \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "YOUR_KEY",
    "lat": 42.6977,
    "lng": 23.3219,
    "radius": 25,
    "limit": 3
}'

Integrations

curl -X POST https://api.yeb.to/v1/place/find-by-coord \
  -H "Content-Type: application/json" \
  -d '{"api_key":"YOUR_KEY","lat":42.6977,"lng":23.3219,"radius":25,"limit":3}'
$r = Http::post('https://api.yeb.to/v1/place/find-by-coord', [
    'api_key' => 'YOUR_KEY', 'lat' => 42.6977, 'lng' => 23.3219, 'radius' => 25, 'limit' => 3
]);
echo $r->json();
fetch('https://api.yeb.to/v1/place/find-by-coord', {
  method:'POST',
  headers:{'Content-Type':'application/json'},
  body:JSON.stringify({api_key:'YOUR_KEY',lat:42.6977,lng:23.3219,radius:25,limit:3})
}).then(r=>r.json()).then(console.log);
import requests, json
payload = {"api_key":"YOUR_KEY","lat":42.6977,"lng":23.3219,"radius":25,"limit":3}
r = requests.post('https://api.yeb.to/v1/place/find-by-coord', headers={'Content-Type':'application/json'}, data=json.dumps(payload))
print(r.json())

Response Example

{
  "lat": 42.6977,
  "lng": 23.3219,
  "radius_km": 25,
  "count": 3,
  "places": [
    {
      "id": 729530,
      "name": "Bankya",
      "country_code": "BG",
      "osm_id": 168422,
      "osm_type": "relation",
      "type": "town",
      "population": 10833,
      "lat": 42.706,
      "lng": 23.152,
      "dist_km": 12.3,
      "display_name": "Bankya, Sofia City Province, Bulgaria"
    }
  ]
}
{
  "error": "Missing lat/lng",
  "code": 400
}

Кодове на отговор

КодОписание
200 SuccessЗаявката е обработена успешно.
400 Bad RequestНеуспешна валидация на входните данни.
401 UnauthorizedЛипсващ / грешен API ключ.
403 ForbiddenКлючът е неактивен или без достъп.
429 Rate LimitТвърде много заявки.
500 Server ErrorНеочаквана грешка.

Find by Coordinates

place/find-by-coord 0.0090 credits

Parameters

API Key
query · string · required
Latitude
query · number · required
Longitude
query · number · required
Radius (km)
query · number
Limit
query · integer
Offset
query · integer

Code Samples


                
                
                
            

Response

Status:
Headers

                
Body

                

Find Place API — Геокодиране и търсене на места | YEB — Practical Guide

A hands-on guide to searching places by name or coordinates using Find Place API — Геокодиране и търсене на места | YEB: what each endpoint does, when to use it, which parameters actually matter, and how to interpret responses to power autosuggest, “near me”, and map fit features.

#What Place API solves

The Place API helps you turn free-form text or a map location into clean, structured place data: name, type (city/town/village), coordinates, optional population, and identifiers you can cache. It’s ideal for search boxes, checkouts, “near me” lists, and map zoom-to-fit.

#Endpoints & when to use them

#POST /v1/place/find-by-coord — Nearby places by point

  • Best for: “Near me” lists, centering a map, geo-fencing UIs.
  • How it works: You send lat/lng (and optionally radius); the API returns places within the radius sorted by distance, including dist_km.
  • Typical output: id, name, type, country_code, lat, lng, dist_km, and a human display_name.

#POST /v1/place/find-by-name — Text search

  • Best for: Search/autocomplete fields, onboarding flows.
  • How it works: You send q (and optionally country_code); the API returns matching places with optional bbox to instantly fit the map view.
  • Typical output: id, name, type, country_code, population, lat, lng, bbox, address.

#Quick start

# Nearby by point
curl -X POST "https://api.yeb.to/v1/place/find-by-coord" \
  -H "Content-Type: application/json" \
  -d '{ "api_key": "YOUR_KEY", "lat": 42.6977, "lng": 23.3219, "radius": 25, "limit": 3 }'
# Text search
curl -X POST "https://api.yeb.to/v1/place/find-by-name" \
  -H "Content-Type: application/json" \
  -d '{ "api_key": "YOUR_KEY", "q": "sofia", "country_code": "BG", "limit": 5 }'

#Parameters that actually matter

Common

ParamRequiredPractical guidance
api_key Yes Send from server/edge. Don’t embed a raw key in the browser.

/find-by-coord

ParamRequiredWhat to pass in practice
lat, lng Yes Make sure they’re WGS84 doubles (no strings). If taken from GPS, round to ~5 decimals for privacy.
radius No Kilometers. Start with 10; for rural searches 25–50; for dense cities 3–8.
limit, offset No Use for pagination/infinite scroll. Keep limit ≤ 50 for snappy UX.

/find-by-name

ParamRequiredWhat to pass in practice
q Yes Free-form user text. Send as-typed; we handle diacritics and casing.
country_code No ISO-3166-1 alpha-2 (e.g., US, BG). Great for disambiguating short names.
limit, offset No Autosuggest: limit=5..10. Backoffice search: limit=20..50.

#Reading & acting on responses

Nearby by coordinates — example

{
  "lat": 42.6977,
  "lng": 23.3219,
  "radius_km": 25,
  "count": 3,
  "places": [
    {
      "id": 729530,
      "name": "Bankya",
      "country_code": "BG",
      "osm_id": 168422,
      "osm_type": "relation",
      "type": "town",
      "population": 10833,
      "lat": 42.706,
      "lng": 23.152,
      "dist_km": 12.3,
      "display_name": "Bankya, Sofia City Province, Bulgaria"
    }
  ]
}
  • dist_km — great for sorting “nearest first” and drawing proximity badges.
  • type — city/town/village; helpful for UI microcopy (e.g., “Town of …”).
  • population — when present, use as a secondary sort for relevance.
  • id, osm_id, osm_type — stable identifiers you can cache/dedupe.

Search by name — example

{
  "query": "sofia",
  "count": 1,
  "places": [
    {
      "id": 727011,
      "name": "Sofia",
      "country_code": "BG",
      "osm_id": 240109189,
      "osm_type": "relation",
      "type": "city",
      "population": 1286383,
      "lat": 42.6977,
      "lng": 23.3219,
      "bbox": {
        "min_lat": 42.582, "max_lat": 42.815,
        "min_lng": 23.042, "max_lng": 23.461
      },
      "address": { "city": "Sofia", "state": "Sofia City Province", "country": "Bulgaria" },
      "display_name": "Sofia, Bulgaria"
    }
  ]
}
  • bbox — fit your map viewport instantly without guessing zoom levels.
  • address{...} — render breadcrumb/secondary text in lists.
  • Ambiguity: combine country_code filter + population to rank “the right Sofia”.

#Recommended actions

  • Autosuggest UX: call /find-by-name after 2–3 chars; limit to 5–10; display display_name.
  • “Near me” lists: call /find-by-coord with radius=10..25; show distance using dist_km.
  • Map integration: after selection, center on lat/lng; if bbox exists, do a fit-bounds.
  • Persistence: store id/osm_id to avoid duplicates and to refresh details later.

#Troubleshooting & field notes

  1. 400 “Missing lat/lng” or “Missing q”: send required params and ensure numeric types for coordinates.
  2. No results: increase radius (coords) or broaden q; remove country_code filter.
  3. Performance: keep limit tight (≤10 for typeahead) and paginate with offset for long lists.
  4. International names: the API handles diacritics; display display_name to avoid locale surprises.
  5. Rate limits: debounce input (≥250 ms); call on blur/enter for mobile to save requests.

#API Changelog

2025-10-20
Added dist_km to coordinate searches and bbox to name searches. Unified response fields (id, type, population, display_name) across endpoints.
2025-10-12
Introduced pagination with limit/offset. Improved ranking for ambiguous names using population signals.
2025-10-01
Public release of /find-by-coord and /find-by-name with country filter support.

Често задавани въпроси

Градове, малки градове и села от глобалните OSM данни.

Да, за заявки с 3+ символа се използва пълнотекстово търсене с толерантност към правописни грешки.

Да. Всяка заявка, дори тази с грешка, изразходва кредити. Това е така, защото кредитите ви са обвързани с броя заявки, независимо от успеха или неуспеха. Ако грешката е ясно по наша вина, ще възстановим засегнатите кредити (без парично възстановяване).

Свържете се с нас на [email protected]. Приемаме обратната връзка сериозно — ако докладът ви за бъг или заявката за функционалност е смислена, можем да поправим или подобрим API-то бързо и да ви предоставим 50 безплатни кредита като благодарност.

Зависи от API-то и понякога дори от конкретната крайна точка. Някои крайни точки използват данни от външни източници, които може да имат по-строги ограничения. Ние също налагаме лимити за предотвратяване на злоупотреби и поддържане стабилността на платформата. Проверете документацията за конкретния лимит на всяка крайна точка.

Работим на кредитна система. Кредитите са предплатени, невъзстановими единици, които изразходвате за API извиквания и инструменти. Кредитите се изразходват FIFO (първи закупен, първи използван) и са валидни 12 месеца от датата на покупка. Таблото показва датата на покупка и изтичането на всяка покупка.

Да. Всички закупени кредити (включително дробни баланси) са валидни 12 месеца от покупката. Неизползваните кредити автоматично изтичат и се изтриват окончателно в края на периода на валидност. Изтеклите кредити не могат да бъдат възстановени или конвертирани в пари или друга стойност. Преходно правило: кредити, закупени преди 22 септ. 2025 г., се третират като закупени на 22 септ. 2025 г. и изтичат на 22 септ. 2026 г. (освен ако не е посочено по-ранно изтичане при покупката).

Да — в рамките на периода им на валидност. Неизползваните кредити остават налични и се прехвърлят от месец на месец, докато не изтекат 12 месеца след покупката.

Кредитите са невъзстановими. Купувайте само каквото ви трябва — винаги можете да заредите по-късно. Ако грешка от наша страна причини неуспешно таксуване, може да възстановим засегнатите кредити след проверка. Без парично възстановяване.

Цените са определени в кредити, не в долари. Всяка крайна точка посочва собствената си цена — вижте бадж „Кредити / заявка" по-горе. Винаги ще знаете точно колко изразходвате.
← Обратно към API-тата