Api
Directions API
Request Valhalla-backed point-to-point routes with GET coordinates or POST JSON bodies.
Directions API
Directions proxy to Valhalla's route action.
Routes
| Method | Route | Description |
|---|---|---|
GET | /directions/v1/{profile}/{lon,lat;lon,lat} | Route from URL coordinates. |
POST | /directions/v1/{profile} | Route from a bounded Planisfy JSON body. |
GET supports 2 to 25 coordinates.
Profiles
Profiles map to Valhalla costing:
| Profiles | Valhalla costing |
|---|---|
driving, driving-traffic, car, auto | auto |
walking, pedestrian | pedestrian |
cycling, bicycle, bike | bicycle |
truck | truck |
bus | bus |
motor_scooter | motor_scooter |
motorcycle | motorcycle |
GET parameters
| Parameter | Notes |
|---|---|
alternatives | Number of alternate routes, clamped to 3. |
units | Defaults to kilometers; miles is also supported. |
language | Defaults to en. |
curl "https://api.example.com/directions/v1/driving/9.1829,48.7758;9.2000,48.7800?units=kilometers" \
-H "X-API-Key: pk_your_key_here"POST body
{
"locations": [
{ "lon": 9.1829, "lat": 48.7758 },
{ "lon": 9.2, "lat": 48.78 }
],
"units": "kilometers",
"language": "en",
"alternatives": 0
}The POST body accepts only locations, units, language, and alternatives.
The URL profile determines Valhalla costing; unknown fields are rejected.
Auth, caching, and errors
Requests require API key or session auth and a reachable Valhalla service with graph data for the requested region. Successful GET responses cache for five minutes. Unknown profiles and invalid coordinates return 400 BAD_REQUEST.