Coordinates to Ward (Vietnam) API

Turn latitude / longitude into the current (post-07/2025) province and phường / xã of Vietnam with their codes; batch up to 1000 points, ward boundaries.

GETPOSThttps://apibox.io.vn/v1/vn-geo

Send lat and lng (WGS 84, as given by phones and GPS) and get the province (34 units) and the phường / xã / đặc khu (3,321 units) that contain the point after the 1 July 2025 reorganisation, with the same GSO codes, names and postal codes as /v1/vn-provinces. distance=1 adds the distance to the ward boundary; ward=<code> with a point tells whether the point is inside that ward (geofencing, attendance check-in), and ward=<code> alone returns its bounding box, centroid, area and, with geometry=1, its simplified boundary as GeoJSON.

For batches, POST points as [[lat, lng], …] or [{"lat": …, "lng": …}] (up to 1000 points per request). A point just outside every ward (on a beach, a river bank, a few metres off a simplified edge) is matched to the nearest ward within max_distance metres (default 250) and flagged inside: false with its distance_m; farther away (open sea, neighbouring countries) the answer is found: false with the nearest ward for information.

Boundaries come from the GIS add-on of the open dataset ThangLeQuoc/vietnamese-provinces-database (MIT), derived from the official reference map sapnhap.bando.com.vn, simplified to about 30 m while keeping shared edges consistent (no gaps or overlaps between neighbours). Points within a few dozen metres of a boundary can therefore land in the neighbouring ward: the answer is marked approximate and is not a cadastral or legal determination. No house-number geocoding.

Parameters

NameInTypeRequiredDefault
latquery|bodynumbernoLatitude in decimal degrees (WGS 84). Or latlng=21.0288,105.8525, or the pair in the path /v1/vn-geo/21.0288,105.8525.
lngquery|bodynumbernoLongitude in decimal degrees (lon also accepted).
pointsbodyarraynoBatch: up to 1000 points as [[lat, lng], …], [{"lat","lng"}] or "lat,lng;lat,lng".
wardquery|bodystringnoWard code (5 digits). With a point: is the point inside this ward? Alone: bbox, centroid, area of the ward.
geometryquery|bodybooleannofalseWith ward alone: add the simplified boundary as a GeoJSON MultiPolygon.
distancequery|bodybooleannofalseAdd boundary_distance_m: distance from the point to the edge of its ward.
max_distancequery|bodynumberno250Snap points outside every ward to the nearest one within this many metres (0–50000).

Example

curl "https://apibox.io.vn/v1/vn-geo?lat=10.7725&lng=106.698" \
  -H "Authorization: Bearer YOUR_API_KEY"

Response

{
  "lat": 10.7725,
  "lng": 106.698,
  "found": true,
  "inside": true,
  "province": {
    "code": "79",
    "name": "Hồ Chí Minh",
    "full_name": "Thành phố Hồ Chí Minh"
  },
  "ward": {
    "code": "26743",
    "name": "Bến Thành",
    "full_name": "Phường Bến Thành",
    "type": "Phường",
    "type_en": "ward",
    "postal_code": "71009"
  },
  "approximate": true,
  "precision_m": 30,
  "data": {
    "admin_version": "v5.2.0",
    "built_at": "2026-11-11",
    "legal_basis": "Nghị quyết 202/2025/QH15 (34 provinces) and the UBTVQH resolutions on ward-level units, effective 1/7/2025; latest change in the dataset: 388/NQ-UBTVQH16",
    "source": "ThangLeQuoc/vietnamese-provinces-database GIS add-on (MIT), derived from sapnhap.bando.com.vn (NXB Tài nguyên Môi trường và Bản đồ Việt Nam)"
  }
}

Use cases

  • Fill the new ward and province from a phone GPS position in delivery or field apps
  • Check that an employee checks in inside the assigned ward (geofence)
  • Convert a table of shop or customer coordinates to the new administrative units
  • Draw a ward boundary on a map from its code

FAQ

Are these the new units after 1 July 2025?

Yes: 34 provinces and 3,321 phường / xã / đặc khu, with the codes of /v1/vn-provinces. The data is checked weekly against the latest dataset release.

How precise is it?

Boundaries are simplified to about 30 m; in tests 99.7% of random points match the full-resolution map, the rest are within a few dozen metres of a boundary.

What happens at sea or outside Vietnam?

Points within max_distance (250 m by default) of the coast snap to the nearest ward; farther away found is false and the nearest ward is given with its distance.

Related APIs

Start with 1,000 free requests every month. Get free API key →