Vietmap Route API Playground

    Route API

    Find routes between points with Vietmap Route API

    Waypoints
    Route

    Instructions

    Pick your waypoints, then click "Calculate route" to see results.

    Code samples

    Example with sample parameters — fill in the form to get code for your own request.

    curl 'https://maps.vietmap.vn/api/route/v4?apikey=YOUR_API_KEY&point=21.0285,105.8542&point=21.0368,105.8346&points_encoded=false&vehicle=car&alternative=false&annotations=toll,congestion,congestion_distance'

    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],
      ["point", "21.0285,105.8542"],
      ["point", "21.0368,105.8346"],
      ["points_encoded", "false"],
      ["vehicle", "car"],
      ["alternative", "false"],
      ["annotations", "toll,congestion,congestion_distance"],
    ]);
    
    const response = await fetch(`https://maps.vietmap.vn/api/route/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),
        ("point", "21.0285,105.8542"),
        ("point", "21.0368,105.8346"),
        ("points_encoded", "false"),
        ("vehicle", "car"),
        ("alternative", "false"),
        ("annotations", "toll,congestion,congestion_distance"),
    ]
    
    response = requests.get("https://maps.vietmap.vn/api/route/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/route/v4?apikey=YOUR_API_KEY&point=21.0285,105.8542&point=21.0368,105.8346&points_encoded=false&vehicle=car&alternative=false&annotations=toll,congestion,congestion_distance

    Replace YOUR_API_KEY with your API key before running.

    I need to integrate Vietmap's Route API v4 into my application.
    
    Official documentation: https://maps.vietmap.vn/docs/map-api/route-version/route-v4/
    
    Here is a sample request that works in the Vietmap API Playground:
    
    GET https://maps.vietmap.vn/api/route/v4?apikey=YOUR_API_KEY&point=21.0285,105.8542&point=21.0368,105.8346&points_encoded=false&vehicle=car&alternative=false&annotations=toll,congestion,congestion_distance
    
    Parameters in use:
    - point = 21.0285,105.8542
    - point = 21.0368,105.8346
    - points_encoded = false
    - vehicle = car
    - alternative = false
    - annotations = toll,congestion,congestion_distance
    
    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.

    What is the Route API?

    The Route API is Vietmap's directions API: it finds the way through two or more points in order, for car, motorcycle, truck, bike or foot. It returns distance, time, a path to draw and turn-by-turn instructions. Version 4 adds toll costs and congestion per segment, and can avoid tolls, take a departure time, a starting heading and a truck load, with alternative routes.

    What it is for

    • Delivery and arrival time estimates.
    • Directions in driver and travel apps.
    • Shipping fees from real distance and tolls.
    • Comparing routes for motorcycles, cars and trucks.

    Sample request

    GET https://maps.vietmap.vn/api/route/v4?apikey=YOUR_API_KEY&point=21.0285,105.8542&point=21.0368,105.8346&vehicle=motorcycle&points_encoded=false

    Repeat point for each stop in travel order; coordinates are latitude,longitude.

    Route API FAQ

    Which vehicles does the Route API support?
    Car, motorcycle, truck, bike and foot. For trucks, v4 also takes the load so the route suits the vehicle.
    Does the directions API include toll costs?
    Yes. Route API v4 returns the toll costs on the route and can avoid toll stations. To reconcile tolls for a journey already driven, use the Map Matching API.
    How is the Route API different from the TSP API?
    Route follows the points in the order you send them. TSP reorders them for the shortest distance. Use TSP when the best order is unknown, and VRP when there are several vehicles.
    Does it cost anything to try the Route API?
    The playground comes with a demo API key, so you can call the Route 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.