Skip to content

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.

Authentication

Authenticate to the API by passing your key as a query parameter in every request.

API Explorer

You can also try all API parts without registration in the API explorer.

Costs

Our pricing is credit based. Read more about it on our website and in our FAQ about how the credit cost is calculated.

Client Libraries

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.

Monitoring Usage

Every response includes four X-RateLimit-* headers to track your credit consumption:

HeaderDescription
X-RateLimit-LimitYour total daily credit limit
X-RateLimit-RemainingCredits left until reset — measured before the current request's cost is deducted
X-RateLimit-ResetSeconds until the daily credit counter resets
X-RateLimit-CreditsCredits 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.

Common Workflows

The APIs are designed to be combined. Here are the most common patterns:

Delivery / field service app — Geocoding → Route Optimization → Routing

  1. Geocoding: convert customer addresses to coordinates. Note: the Geocoding response uses point.lng while the Optimization request uses lon — map the field name accordingly.
  2. Route Optimization (POST /vrp): pass the coordinates as service addresses along with your vehicles. Set configuration.routing.calc_points to true to get route geometries in the response. The solver assigns stops to vehicles, sequences them, and returns routes with arrival times.
  3. Routing (POST /route): optionally, call this per driver route to get turn-by-turn instructions. Pass the stop coordinates from the optimization solution as points, set instructions to true.

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

  1. Geocoding: convert addresses to coordinates.
  2. Matrix (POST /matrix): compute travel times and distances between all pairs (or specific origin/destination sets). Useful for displaying ETAs to customers or pre-filtering stops before optimization.

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.

Optimize Response Speed

  1. 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".

  1. 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".

Download OpenAPI description
Languages
Servers
https://graphhopper.com/api/1