Geocoding API
Convert address to coordinates with Vietmap Geocode API
Geocode Results
Enter an address and click "Geocode Address" to see results
Code samples
curl 'https://maps.vietmap.vn/api/search/v4?apikey=YOUR_API_KEY&text=197+Tr%E1%BA%A7n+Ph%C3%BA&admin_new=true&display_type=6'Replace YOUR_API_KEY with your API key before running.
// In production, read the key from an environment variable instead.
const API_KEY = "YOUR_API_KEY";
const params = new URLSearchParams([
["apikey", API_KEY],
["text", "197 Trần Phú"],
["admin_new", "true"],
["display_type", "6"],
]);
const response = await fetch(`https://maps.vietmap.vn/api/search/v4?${params}`);
if (!response.ok) {
throw new Error(`Vietmap ${response.status}: ${await response.text()}`);
}
const data = await response.json();
console.log(data);Replace YOUR_API_KEY with your API key before running.
import requests
# In production, read the key from an environment variable instead.
API_KEY = "YOUR_API_KEY"
params = [
("apikey", API_KEY),
("text", "197 Trần Phú"),
("admin_new", "true"),
("display_type", "6"),
]
response = requests.get("https://maps.vietmap.vn/api/search/v4", params=params, timeout=30)
response.raise_for_status()
print(response.json())Replace YOUR_API_KEY with your API key before running.
https://maps.vietmap.vn/api/search/v4?apikey=YOUR_API_KEY&text=197+Tr%E1%BA%A7n+Ph%C3%BA&admin_new=true&display_type=6Replace YOUR_API_KEY with your API key before running.
I need to integrate Vietmap's Geocoding (Search) API v4 into my application.
Official documentation: https://maps.vietmap.vn/docs/map-api/geocode-version/geocode-v4/
Here is a sample request that works in the Vietmap API Playground:
GET https://maps.vietmap.vn/api/search/v4?apikey=YOUR_API_KEY&text=197+Tr%E1%BA%A7n+Ph%C3%BA&admin_new=true&display_type=6
Parameters in use:
- text = 197 Trần Phú
- admin_new = true
- display_type = 6
Write code in [my language / framework] that calls this API, with these requirements:
1. Read the API key from the VIETMAP_API_KEY environment variable; never hard-code it.
2. Send the parameters in the query string exactly as in the sample; repeated parameters (such as `point`) must keep their order.
3. Handle Vietmap's HTTP errors:
- 401: the API key is wrong or revoked.
- 403: the key is restricted to a domain / IP that does not match.
- 423: the API is not enabled for the key's consumer, OR the account is out of credit — tell them apart by the response body ("exceeded credit" means out of credit).
- 429: rate limit exceeded — retry with increasing backoff.
4. Set a request timeout, and define types (type / interface / dataclass) for the response.
If unsure about a field name, look it up in the documentation linked above instead of guessing.Paste into ChatGPT, Claude… to generate integration code. The prompt never contains your API key.
https://tools.vietmap.vn/playground/en/geocode?text=197+Tr%E1%BA%A7n+Ph%C3%BA&display_type=6Opens the playground with exactly these parameters — for the docs or a colleague. The link never contains an API key.
No API response yet
What is the Geocoding API?
What is the Geocoding API?
The Geocoding API turns a written address into coordinates. Version 4 understands both post-merger and former administrative addresses, takes province, district, ward, radius and category filters, and returns a normalised address with each result. It is the first step for putting a customer list on a map or feeding it to the routing and optimisation APIs.
What it is for
- Plotting orders or customers on a map.
- Getting coordinates for Route, Matrix, TSP and VRP.
- Validating an address before an order is created.
- Grouping customers by province or ward.
Sample request
GET https://maps.vietmap.vn/api/search/v4?apikey=YOUR_API_KEY&text=197%20Tr%E1%BA%A7n%20Ph%C3%BA&focus=10.7588,106.6755Add display_type to choose the new, old or both address formats.
Geocoding API FAQ
- What is geocoding?
- Geocoding turns a written address, such as “197 Tran Phu, Cho Quan Ward, Ho Chi Minh City”, into latitude and longitude, so it can be placed on a map or fed into routing. The opposite direction, from coordinates to an address, is reverse geocoding.
- Does the Geocoding API understand pre-merger addresses?
- Yes. Version 4 accepts addresses under both the new and the former administrative units, and display_type picks the format returned. To convert your data to the new addresses for good, use the Address Conversion API as well.
- How can I get more accurate geocoding results?
- Send the address as completely as possible (house number, street, ward, province), pass a focus near the area, or restrict results to a province or ward with the administrative filters.
- Does it cost anything to try the Geocoding API?
- The playground comes with a demo API key, so you can call the Geocoding API straight from the browser without signing up. To build it into a product, register a VIETMAP account for your own key. Usage is billed per transaction, each API converting requests to transactions at its own rate; the pricing page has the details and the free trial.