- Home
- Docs
- API reference
- Address and place name for a coordinate
API reference
Address and place name for a coordinate
Returns the address or place at (or nearest to) a `lat,lng` coordinate, closest first, from OpenStreetMap data, plus the administrative areas containing the point (`admin_areas`; in Bangladesh division, district, upazila and union). When `radius_meters` is not set and nothing is found within about 1 km (sparse rural areas), the search widens to 5 km once. Use it to show a human-readable location for a GPS fix or a pin dropped on a map. Billed as one `reverse_geocode` unit per successful request (an empty `results` list is a successful answer). `summary` flattens the closest match and the admin areas into the fields most apps display (`house_number`, `road`, `neighbourhood`, `suburb`, `city`, `upazila`, `district`, `division`, `postcode`), with `distance_meters` to the match and a `label` that is honest about distance: "Near House 11, Road No. 14, Sobhanbag, Dhaka" or "1.2 km from Sobhanbag, Dhaka".
Endpoint
https://api.wayline.cloud/v1/reverse-geocodeRequires an API key (authentication). Product overview: Reverse Geocoding API. Billing: see units & pricing.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
pointrequired | query | PointString | Coordinate, formatted as lat,lng. |
limit | query | integer | Number of results (1 to 5).Default: 1 |
radius_meters | query | integer | Only return places within this distance of the point (1 to 5000). |
near_meters | query | integer | summary.label says "Near …" only when the closest match is within this distance;
otherwise it reads "1.2 km from <area>". Default 150.
Default: 150 |
lang | query | string | Result language. en (default) or bn (Bengali, where OpenStreetMap has Bengali names).One of: en, bnDefault: en |
types | query | string | Comma-separated place types to return, e.g. street,locality,district,city to skip
shops and other points of interest. Allowed: house (buildings and points of
interest), street, locality, district, city, county, state, country, other.
|
Example
curl "https://api.wayline.cloud/v1/reverse-geocode?point=23.7465,90.376" \
-H "Authorization: Bearer $WAYLINE_API_KEY"const res = await fetch(
"https://api.wayline.cloud/v1/reverse-geocode?point=23.7465,90.376",
{ headers: { Authorization: `Bearer ${process.env.WAYLINE_API_KEY}` } },
);
if (!res.ok) throw new Error(`Wayline ${res.status}: ${await res.text()}`);
const data = await res.json();
console.log(data);import os, requests
res = requests.get(
"https://api.wayline.cloud/v1/reverse-geocode",
params={"point": "23.7465,90.376"},
headers={"Authorization": f"Bearer {os.environ['WAYLINE_API_KEY']}"},
timeout=10,
)
res.raise_for_status()
print(res.json())package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.wayline.cloud/v1/reverse-geocode?point=23.7465,90.376", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("WAYLINE_API_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res.Status, string(body))
}<?php
$ch = curl_init("https://api.wayline.cloud/v1/reverse-geocode?point=23.7465,90.376");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("WAYLINE_API_KEY")],
CURLOPT_TIMEOUT => 10,
]);
$data = json_decode(curl_exec($ch), true);
print_r($data);require "net/http"
require "json"
uri = URI("https://api.wayline.cloud/v1/reverse-geocode?point=23.7465,90.376")
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer #{ENV.fetch("WAYLINE_API_KEY")}"
res = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(req) }
puts JSON.parse(res.body)import java.net.URI;
import java.net.http.*;
public class Main {
public static void main(String[] args) throws Exception {
var req = HttpRequest.newBuilder(URI.create("https://api.wayline.cloud/v1/reverse-geocode?point=23.7465,90.376"))
.header("Authorization", "Bearer " + System.getenv("WAYLINE_API_KEY"))
.GET().build();
var res = HttpClient.newHttpClient().send(req, HttpResponse.BodyHandlers.ofString());
System.out.println(res.statusCode() + " " + res.body());
}
}import 'dart:convert';
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
final res = await http.get(
Uri.parse('https://api.wayline.cloud/v1/reverse-geocode?point=23.7465,90.376'),
headers: {'Authorization': 'Bearer ${Platform.environment['WAYLINE_API_KEY']}'},
);
print(jsonDecode(res.body));
}{
"results": [
{
"formatted_address": "Road 27, Dhanmondi, Dhaka 1209, Bangladesh",
"location": {
"lat": 23.7465,
"lng": 90.376
},
"type": "street",
"address": {
"street": "Road 27",
"district": "Dhanmondi",
"city": "Dhaka",
"county": "Dhaka",
"state": "Dhaka Division",
"postcode": "1209",
"country": "Bangladesh",
"country_code": "BD"
},
"distance_meters": 12,
"source": "osm"
}
],
"admin_areas": {
"division": {
"name": "Dhaka"
},
"district": {
"name": "Dhaka"
},
"upazila": {
"name": "Dhanmondi"
}
},
"summary": {
"label": "Near Road 27, Dhanmondi, Dhaka",
"near": true,
"distance_meters": 12,
"road": "Road 27",
"suburb": "Dhanmondi",
"city": "Dhaka",
"upazila": "Dhanmondi",
"district": "Dhaka",
"division": "Dhaka",
"postcode": "1209",
"country": "Bangladesh"
},
"units_charged": 1,
"region": "bd"
}Response
200 — Geocoding results.
| Field | Type | Description |
|---|---|---|
resultsrequired | Place[] | |
results[].name | string | |
results[].formatted_addressrequired | string | |
results[].locationrequired | Point | Flexible coordinate input accepted as string, object, or array. |
results[].typerequired | string | One of: house, street, locality, district, city, county, state, country, other |
results[].category | string | OpenStreetMap key:value, e.g. amenity:hospital. |
results[].addressrequired | PlaceAddress | Structured address. Components without data are omitted. |
results[].address.house_number | string | |
results[].address.street | string | |
results[].address.locality | string | Neighbourhood or mahalla. |
results[].address.district | string | City area, e.g. Dhanmondi. |
results[].address.city | string | |
results[].address.county | string | In Bangladesh: zila (district). |
results[].address.state | string | In Bangladesh: division. |
results[].address.postcode | string | |
results[].address.country | string | |
results[].address.country_code | string | ISO 3166-1 alpha-2, upper case. |
results[].distance_meters | integer | Straight-line distance from the query point (reverse geocoding only). |
results[].bounding_box | number[] | [min_lat, min_lng, max_lat, max_lng] for areas and long features. |
results[].admin_areas | AdminAreas | Administrative areas containing a point, keyed by level, largest first. In
Bangladesh: division, district, upazila, union. OpenStreetMap boundaries
are used first; gaps are filled from official BBS data (see source). A level is
null only when neither source covers the point.
|
results[].source | string | Dataset of the place: OpenStreetMap (ODbL), GeoNames (CC BY 4.0) or Overture Maps Places (CDLA Permissive 2.0). osm is set only for osm.One of: osm, geonames, overture |
results[].osm | object | Source OpenStreetMap object. Omitted for results without one (e.g. postcode areas). |
admin_areas | AdminAreas | Administrative areas containing a point, keyed by level, largest first. In
Bangladesh: division, district, upazila, union. OpenStreetMap boundaries
are used first; gaps are filled from official BBS data (see source). A level is
null only when neither source covers the point.
|
summary | ReverseSummary | Display-ready description of a reverse-geocoded point. Empty fields are omitted. |
summary.labelrequired | string | |
summary.nearrequired | boolean | The closest match is within near_meters (default 150) of the point. |
summary.distance_metersrequired | integer | null | Straight-line meters from the point to the matched place; null when nothing matched. |
summary.name | string | POI or building name of the match. |
summary.house_number | string | |
summary.road | string | |
summary.neighbourhood | string | |
summary.suburb | string | |
summary.city | string | |
summary.union | string | |
summary.upazila | string | Upazila or thana containing the point. |
summary.district | string | |
summary.division | string | |
summary.postcode | string | |
summary.country | string | |
units_chargedrequired | integer | |
regionrequired | string |
Response headers
X-Request-Id— Unique identifier for tracking and debugging this request.X-RateLimit-Limit— Maximum permitted requests in current window.X-RateLimit-Remaining— Remaining request quota in current window.X-RateLimit-Reset— Seconds until the rate limit window resets.X-Units-Charged— Billable request units consumed by this request.X-Cache— Cache lookup status (`HIT` or `MISS`).X-Region— Region code serving this routing request (e.g. `bd`).
Errors
| Status | When |
|---|---|
400 | Bad request (invalid coordinates, out of coverage, too many elements, etc.). |
401 | Missing or invalid API key, or expired key. |
402 | Free quota exhausted, no payment method, account suspended, or the monthly spend limit you set was reached. Never billed. Raise or remove the limit in the dashboard (Billing) and retry; nothing else changes. |
403 | Account disabled, key IP restriction failed, origin not allowed, or scope not permitted. |
429 | Rate limit exceeded or test key daily quota reached. |
500 | Internal server error. |
503 | Upstream routing service temporarily unavailable. |
Error bodies contain a code such as OUT_OF_COVERAGE — see the error reference.
Try it
Interactive API Console
Sends a real request from your browser using a test key (free, never billed). The key stays in this browser tab only.
No key yet? Create a free test key.