Graphhopper

GraphHopper Directions API

With the [GraphHopper Directions API](https://www.graphhopper.com/products/) you can integrate A-to-B route planning, turn-by-turn navigation, route…

Maps & location#openapi#location

Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.

Overview

With the GraphHopper Directions API you can integrate A-to-B route planning, turn-by-turn navigation,
route optimization, isochrone calculations and other tools in your application.

The GraphHopper Directions API consists of the following RESTful web services:

  • Routing API,
  • Route Optimization API,
  • Isochrone API,
  • Map Matching API,
  • Matrix API,
  • Geocoding API and
  • Cluster API.

Explore our APIs

Get started

  1. Sign up for GraphHopper
  2. Create an API key

Each API part has its own documentation. Jump to the desired API part and learn about the API through the given examples and tutorials.

In addition, for each API there are specific sample requests that you can send via Insomnia or Postman to see what the requests and responses look like.

Insomnia

To explore our APIs with Insomnia, follow these steps:

  1. Open Insomnia and Import our workspace.
  2. Specify your API key in your workspace: Manage Environments -> Base Environment -> "api_key": your API key
  3. Start exploring

Postman

To explore our APIs with Postman, follow these steps:

  1. Import our request collections as well as our environment file.
  2. Specify your API key in your environment: "api_key": your API key
  3. Start exploring

API Client Libraries

To speed up development and make coding easier, we offer the following client libraries:

Bandwidth reduction

If you create your own client, make sure it supports http/2 and gzipped responses for best speed.

If you use the Matrix, the Route Optimization API or the Cluster API 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".

Contact Us

If you have problems or questions, please read the following information:

To stay informed about the latest developments, you can

Select the channel you like the most.

Map Data and Routing Profiles

Currently, our main data source is OpenStreetMap. We also integrated other network data providers.
This chapter gives an overview about the options you have.

OpenStreetMap

Geographical Coverage

OpenStreetMap covers the whole world. If you want to see for yourself if we can provide data suitable for your region,
please visit GraphHopper Maps.
You can edit and modify OpenStreetMap data if you find that important information is missing, e.g. a weight limit for a bridge.
Here is a beginner's guide that shows how to add data. If you have edited data, we usually consider your data after 1 week at the latest.

Supported Vehicle Profiles

The Routing, Matrix and Route Optimization APIs support the following vehicle profiles:

Name | Description | Restrictions | Icon
-----------|:----------------------|:--------------------------|:---------------------------------------------------------
car | Car mode | car access |
small_truck| Small…

Endpoints 16

Route Optimization API

  • POSTPOST route optimization problem/vrpTo get started with the Route Optimization API, please read the introduction. To solve a new vehicle routing problem, make a HTTP POST to this URL…
  • POSTPOST route optimization problem (batch mode)/vrp/optimizeTo solve a vehicle routing problem, perform the following steps: 1.) Make a HTTP POST to this URL https://graphhopper.com/api/1/vrp/optimize?key=<your_key> It…
  • GETGET the solution (batch mode)/vrp/solution/:jobIdTake the job id and fetch the solution for the vehicle routing problem from this URL: https://graphhopper.com/api/1/vrp/solution/<job_id>?key=<your_key> You…

Routing API

  • GETGET Route Endpoint/route?point=string&point_hint=string&snap_prevention=string&vehicle=car&curbside=any&turn_costs=false&locale=en&elevation=false&details=string&optimize=false&instructions=true&calc_points=true&debug=false&points_encoded=true&ch.disable=false&weighting=fastest&heading=0&heading_penalty=120&pass_through=false&block_area=string&avoid=string&algorithm=round_trip&round_trip.distance=10000&round_trip.seed=0&alternative_route.max_paths=2&alternative_route.max_weight_factor=1.4&alternative_route.max_share_factor=0.6The GET request is the most simple one: just specify the parameter in the URL and you are done. Can be tried directly in every browser.
  • POSTPOST Route Endpoint/routePlease see the GET endpoint for a simpler method on how to get started. If you are familiar with POST requests and JSON then do not hesitate to continue here.…
  • GETCoverage information/route/infoUse this to find out details about the supported vehicle profiles and features, or if you just need to ping the server.

Matrix API

  • GETGET Matrix Endpoint/matrix?point=string&from_point=string&to_point=string&point_hint=string&from_point_hint=string&to_point_hint=string&snap_prevention=string&curbside=any&from_curbside=any&to_curbside=any&out_array=string&vehicle=car&fail_fast=true&turn_costs=falseWith this Matrix Endpoint you submit the points and parameters via URL parameters and is the most convenient as it works out-of-the-box in the browser. If…
  • POSTPOST Matrix Endpoint/matrixThe GET endpoint has an URL length limitation, which hurts for many locations per request. In those cases use this POST endpoint with a JSON as input. The…
  • POSTBatch Matrix Endpoint/matrix/calculatePrefer the synchronous endpoint and use this Batch endpoint for long running problems only. The Batch Matrix endpoint allows using matrices with more…
  • GETGET Batch Matrix Endpoint/matrix/solution/:jobIdThis endpoint returns the solution of a JSON submitted to the Batch Matrix endpoint. You can fetch it with the job_id, you have been sent.

Geocoding API

  • GETGeocoding Endpoint/geocode?q=string&locale=en&limit=10&reverse=false&debug=false&point=string&provider=defaultIntroduction !Geocoding Example _Geocoding_ describes the process of transforming an textual address representation to a coordinate (latitude,longitude). For…

Isochrone API

  • GETIsochrone Endpoint/isochrone?point=string&time_limit=600&distance_limit=0&vehicle=car&buckets=1&reverse_flow=false&weighting=fastestExample You can get an example response via: curl "https://graphhopper.com/api/1/isochrone?point=51.131108,12.414551&key=[YOUR_KEY]" Don't forget to replace…

Map Matching API

  • POSTMap-match a GPX file/match?gps_accuracy=0&vehicle=stringExample You get an example response for a GPX via: curl -XPOST -H "Content-Type: application/gpx+xml"…

Cluster API

  • POSTPOST Cluster Endpoint/clusterThe Cluster endpoint is used with a POST request towards https://graphhopper.com/api/1/cluster?key=<your_key>. The solution will be provided in the JSON…
  • POSTBatch Cluster Endpoint/cluster/calculatePrefer the synchronous endpoint and use this Batch Cluster endpoint for long running problems only. The work flow is asynchronous: send a POST request towards…
  • GETGET Batch Solution Endpoint/cluster/solution/:jobIdThis endpoint returns the solution of the clustering problems submitted to the Batch Cluster endpoint. You can fetch it with the job_id, you have been sent.

API details

Base URL
https://graphhopper.com/api/1
Authentication
An API key in the key query parameter
Operations
16 operations on 14 pathsGET 8POST 8
Main resources
Matrix API 4Cluster API 3Route Optimization API 3Routing API 3Geocoding API 1Isochrone API 1Map Matching API 1
Response formats
application/json
Description format
OpenAPI 3.0.0, API version 1.0.0
Listed from
APIs.guru OpenAPI Directory (CC0-1.0)
Source updated

How to test the GraphHopper Directions API in Swastik Codes

  1. Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
  2. Fork it into your workspaceChoose a workspace. You get your own copy of the GraphHopper Directions API collection, without the publisher's secrets.
  3. Add your credentialsThis API uses an API key in the key query parameter. Add yours in the collection's variables or an environment; the requests already reference it.
  4. Send a requestPick an endpoint, for example “POST route optimization problem” (POST /vrp), and press Send. Check the response, add tests and run the whole collection with the runner.

Frequently asked questions

What is the GraphHopper Directions API?

With the [GraphHopper Directions API](https://www.graphhopper.com/products/) you can integrate A-to-B route planning, turn-by-turn navigation, route… It is listed under Maps & location and has 16 endpoints.

Who publishes the GraphHopper Directions API?

It is listed from Graphhopper's public API description (an OpenAPI document), not published by Graphhopper on Swastik Codes. Anyone who controls graphhopper.com can claim the profile by adding a DNS TXT record.

What is the base URL of the GraphHopper Directions API?

Requests go to https://graphhopper.com/api/1. Endpoint paths are added to this base URL.

How do I authenticate with the GraphHopper Directions API?

With an API key in the key query parameter.

How many endpoints does the GraphHopper Directions API have?

16 operations on 14 paths (8 GET, 8 POST). The largest groups are Matrix API, Cluster API, Route Optimization API, Routing API.

Is forking the GraphHopper Directions API free?

Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.

Suggest an API

Tell us which public API is missing. We check it, then add it here with its endpoints when it has an OpenAPI (Swagger) description.