GraphHopper Directions API (1.0.0)
Integrate A-to-B route planning, turn-by-turn navigation, route optimization, isochrone calculations, location clustering and other tools into your application.
Authenticate to the API by passing your key as a query parameter in every request.
You can also try all API parts without registration in the API explorer.
Our pricing is credit based. Read more about it on our website and in our FAQ about how the credit cost is calculated.
To speed up development and make coding easier, we offer a JavaScript client and a Java client.
For turn-by-turn navigation in your iOS or Android app we recommend the Maplibre Navigation SDK (Kotlin Multiplatform version), which works well with GraphHopper.
Every response includes four X-RateLimit-* headers to track your credit consumption:
| Header | Description |
|---|---|
X-RateLimit-Limit | Your total daily credit limit |
X-RateLimit-Remaining | Credits left until reset — measured before the current request's cost is deducted |
X-RateLimit-Reset | Seconds until the daily credit counter resets |
X-RateLimit-Credits | Credits consumed by the current request |
To compute your actual remaining balance after a request, subtract: Remaining - Credits. A 429 response means the daily or per-minute limit is exhausted.
The APIs are designed to be combined. Here are the most common patterns:
Delivery / field service app — Geocoding → Route Optimization → Routing
- Geocoding: convert customer addresses to coordinates. Note: the Geocoding response uses
point.lngwhile the Optimization request useslon— map the field name accordingly. - Route Optimization (
POST /vrp): pass the coordinates as service addresses along with your vehicles. Setconfiguration.routing.calc_pointstotrueto get route geometries in the response. The solver assigns stops to vehicles, sequences them, and returns routes with arrival times. - Routing (
POST /route): optionally, call this per driver route to get turn-by-turn instructions. Pass the stop coordinates from the optimization solution aspoints, setinstructionstotrue.
If you only need geometries (no turn-by-turn instructions), step 3 is unnecessary — calc_points in step 2 already provides them.
ETA / distance matrix — Geocoding → Matrix
Simple A-to-B navigation — Routing only
Call Routing (POST /route) with two or more points. No optimization or geocoding needed if you already have coordinates.
To integrate turn-by-turn navigation for an app (iOS or Android) have a look into the Maplibre Navigation SDK (Kotlin Multiplatform). Contact us if you need more information.
- Reuse SSL/TLS sessions
You should utilize the SSL session to speed up responses after the initial response or use a library that does this. E.g. for Java the OkHttp library automatically reuses SSL/TLS sessions and also the browser takes care of this automatically. For python you can use the requests library: first you create a session (session = requests.Session()) and then do requests only with this session instead of directly using "requests".
- Bandwidth reduction
If you create your own client, make sure it supports http/2 and gzipped responses for best speed. If you use Route Optimization or Matrices and want to solve large problems, we recommend you to reduce bandwidth by compressing your POST request and specifying the header as follows: Content-Encoding: gzip. This will also avoid the HTTP 413 error "Request Entity Too Large".