### GET /profiles/solution/{jobId} Source: https://docs.graphhopper.com/_bundle/openapi.json API endpoint for GET /profiles/solution/{jobId} ```markdown ### Parameters - **jobId** (string, path, required): The jobId you received when you submitted the job. ### Responses #### 200 - A response containing the custom profile ### Example Usage ```bash curl -X GET "https://graphhopper.com/api/1/profiles/solution/{jobId}" ``` ``` -------------------------------- ### GET /profiles Source: https://docs.graphhopper.com/_bundle/openapi.json API endpoint for GET /profiles ```markdown ### Responses #### 200 - Your profiles **ProfileGetResponse** - Array of ProfileResponse ### Example Usage ```bash curl -X GET "https://graphhopper.com/api/1/profiles" ``` ``` -------------------------------- ### POST /match Source: https://docs.graphhopper.com/_bundle/openapi.json To get a match response you send a GPX file in the body of an HTTP POST request and specify request parameters like the `key` and `profile` in the URL. See below for more supported parameters. ```markdown ### Parameters - **gps_accuracy** (integer, query, optional): Specify the precision of a point, in meter - **profile** (VehicleProfileId, query, optional) - **locale** (string, query, optional): The locale of the resulting turn instructions. E.g. `pt_PT` for Portuguese or `de` for German. - **elevation** (boolean, query, optional): If `true`, a third coordinate, the altitude, is included with all positions in the response. This changes the format of the `points` and `snapped_waypoints` fields of the response, in both their encodings. Unless you switch off the `points_encoded` parameter, you need special code on the client side that can handle three-dimensional coordinates. - **details** (array (string), query, optional): Optional parameter. The following path details are available: `street_name`, `street_ref`, `street_destination`, `leg_time`, `leg_distance`, `roundabout`, `country`, `time`, `distance`, `max_speed`, `max_weight`, `max_width`, `toll`, `road_class`, `road_class_link`, `road_access`, `road_environment`, `hazmat`, `hazmat_tunnel`, `hazmat_water`, `lanes`, `surface`, `smoothness`, `hike_rating`, `mtb_rating`, `foot_network`, `bike_network`. Read more about the usage of path details [here](https://discuss.graphhopper.com/t/2539). - **instructions** (boolean, query, optional): If instructions should be calculated and returned - **calc_points** (boolean, query, optional): If the points for the route should be calculated at all. - **points_encoded** (boolean, query, optional): Allows changing the encoding of location data in the response. The default is polyline encoding, which is compact but requires special client code to unpack. (We provide it in our JavaScript client library!) Set this parameter to `false` to switch the encoding to simple coordinate pairs like `[lon,lat]`, or `[lon,lat,elevation]`. See the description of the response format for more information. ### Request Body **Content-Type:** application/gpx+xml ### Responses #### 200 - Map matching result **RouteResponse** - **paths** (array (RouteResponsePath)) Array items: - **distance** (number (double)): The total distance, in meters. To get this information for one 'leg' please read [this blog post](https://www.graphhopper.com/blog/2019/11/28/routing-api-using-path-details/). - **time** (integer (int64)): The total travel time, in milliseconds. To get this information for one 'leg' please read [this blog post](https://www.graphhopper.com/blog/2019/11/28/routing-api-using-path-details/). - **ascend** (number (double)): The total ascent, in meters. - **descend** (number (double)): The total descent, in meters. - **points** (string): A polyline-encoded list of positions. You'll need to decode this string in client code. We provide open source code in [Java](https://github.com/graphhopper/graphhopper/blob/e649aaed8d3f4378bf2d8889bbbc2318261eabb2/web-api/src/main/java/com/graphhopper/http/WebHelper.java#L54) and [JavaScript](https://github.com/graphhopper/directions-api-js-client/blob/cf43d1a5bc93a3e8007a44fcfc551117e4fa49bc/src/GHUtil.js#L27). - **snapped_waypoints** (string): A polyline-encoded list of positions. You'll need to decode this string in client code. We provide open source code in [Java](https://github.com/graphhopper/graphhopper/blob/e649aaed8d3f4378bf2d8889bbbc2318261eabb2/web-api/src/main/java/com/graphhopper/http/WebHelper.java#L54) and [JavaScript](https://github.com/graphhopper/directions-api-js-client/blob/cf43d1a5bc93a3e8007a44fcfc551117e4fa49bc/src/GHUtil.js#L27). - **points_encoded** (boolean): Whether the `points` and `snapped_waypoints` fields are polyline-encoded strings rather than JSON arrays of coordinates. See the field description for more information on the two formats. - **bbox** (array (number (double))): The bounding box of the route geometry. Format: `[minLon, minLat, maxLon, maxLat]`. - **instructions** (array (object)): The instructions for this route. This feature is under active development, and our instructions can sometimes be misleading, so be mindful when using them for navigation. Array items: - **text** (string): A description what the user has to do in order to follow the route. The language depends on the locale parameter. - **street_name** (string): The name of the street to turn onto in order to follow the route. - **heading** (number (double)): The optional heading for this roundabout instruction. - **last_heading** (number (double)): The optional last heading for this roundabout instruction. - **distance** (number (double)): The distance for this instruction, in meters. - **time** (integer (int32)): The duration for this instruction, in milliseconds. - **interval** (array (integer (int32))): Two indices into `points`, referring to the beginning and the end of the segment of the route this instruction refers to. - **sign** (integer (int32)): A number which specifies the sign to show: | sign | description | |---|---| |-98| an U-turn without the knowledge if it is a right or left U-turn | | -8| a left U-turn | | -7| keep left | | -6| **not yet used**: leave roundabout | | -3| turn sharp left | | -2| turn left | | -1| turn slight left | | 0| continue on street | | 1| turn slight right | | 2| turn right | | 3| turn sharp right | | 4| the finish instruction before the last point | | 5| the instruction before a via point | | 6| the instruction before entering a roundabout | | 7| keep right | | 8| a right U-turn | | *| **For future compatibility** it is important that all clients are able to handle also unknown instruction sign numbers - **exit_number** (integer (int32)): Only available for roundabout instructions (sign is 6). The count of exits at which the route leaves the roundabout. - **turn_angle** (number (double)): Only available for roundabout instructions (sign is 6). The radian of the route within the roundabout `0 < r < 2*PI` for clockwise and `-2*PI < r < 0` for counterclockwise turns. - **details** (object): Details, as requested with the `details` parameter. Consider the value `{"street_name": [[0,2,"Frankfurter Straße"],[2,6,"Zollweg"]]}`. In this example, the route uses two streets: The first, Frankfurter Straße, is used between `points[0]` and `points[2]`, and the second, Zollweg, between `points[2]` and `points[6]`. Read more about the usage of path details [here](https://discuss.graphhopper.com/t/2539). - **points_order** (array (integer)): An array of indices (zero-based), specifiying the order in which the input points are visited. Only present if the `optimize` parameter was used. - **info** (object): Additional information for your request - **copyrights** (array (string)): Attribution according to our documentation is necessary if no white-label option included. - **took** (number (double)) ### Example Usage ```bash curl -X POST "https://graphhopper.com/api/1/match?gps_accuracy=0&profile=value&locale=en&elevation=false&details=item1,item2&instructions=true&calc_points=true&points_encoded=true" \ -H "Content-Type: application/json" \ -d '{ "example": "data" }' ``` ``` -------------------------------- ### GET /matrix/solution/{jobId} Source: https://docs.graphhopper.com/_bundle/openapi.json API endpoint for GET /matrix/solution/{jobId} ```markdown ### Parameters - **jobId** (string, path, required): The jobId you received when you submitted the job. ### Responses #### 200 - A response containing the matrix ### Example Usage ```bash curl -X GET "https://graphhopper.com/api/1/matrix/solution/{jobId}" ``` ``` -------------------------------- ### POST /cluster/calculate Source: https://docs.graphhopper.com/_bundle/openapi.json Prefer the [synchronous endpoint](#operation/solveClusteringProblem) and use this Batch Cluster endpoint for long running problems only. The work flow is asynchronous: - send a POST request towards `https://graphhopper.com/api/1/cluster/calculate?key=` and fetch the job_id. - poll the solution every 500ms until it gives `status=finished`. Do this with a GET request towards `https://graphhopper.com/api/1/cluster/solution/?key=`. ```markdown ### Request Body **Content-Type:** application/json - **configuration** (object) - **response_type** (string): Specifies the response format. You can either choose `geojson` or `json`. (example: "json") - **routing** (object) - **profile** (string): The routing profile. It determines the network, speed and other physical attributes used when computing the route. See the section about [routing profiles](#tag/Map-Data-and-Routing-Profiles) for more details and valid profile values. - **cost_per_second** (number (double)): Cost per second (travel time) (example: 1) - **cost_per_meter** (number (double)): Cost per meter (travel distance) (example: 0) - **clustering** (object) - **num_clusters** (number (int32)): Specifies the number of clusters (example: 10) - **max_quantity** (number (int32)): Specifies max. quantity in a cluster (example: 50) - **min_quantity** (number (int32)): Specifies min. quantity in a cluster (example: 30) - **clusters** (array (Clusters)) Array items: - **name** (string): id of customer (example: "GraphHopper GmbH") - **center** (object) - **lon** (number (double)): Longitude (example: 11.53941) - **lat** (number (double)): Latitude (example: 48.118434) - **street_hint** (string): Optional parameter. Provide a hint that includes only the street name for each address to better snap the coordinates (lon,lat) to road network. E.g. if there is an address or house with two or more neighboring streets you can control for which street the closest location is looked up. (example: "Lindenschmitstraße 52") - **min_quantity** (number (int32)): Specifies min. quantity of this cluster (example: 10) - **max_quantity** (number (int32)): Specifies max. quantity of this cluster (example: 10) - **customers** (array (ClusterCustomer)) Array items: - **id** (string): id of customer (example: "GraphHopper GmbH") - **address** (object) - **quantity** (number (int32)): demand of customer (example: 10) ### Responses #### 200 - A jobId you can use to retrieve your solution from the server - see solution endpoint. **JobId** - **job_id** (string (uuid)): UUID. Unique id for your job/request with which you can fetch your solution (example: "44886560-b584-4da5-b245-768151dacd8f") #### 400 - Error occurred when reading client request. Request is invalid. **BadRequest** - **message** (string): Short error message (example: "Bad Request") - **hints** (array (ErrorMessage)): Optional error information. Array items: - **message** (string): error message (example: "unsupported json property [vehiles]. allowed properties: [vehicles, vehicle_types, services, shipments, relations, algorithm, objectives, cost_matrices, configuration]") - **details** (string): Details (example: "class java.lang.IllegalArgumentException") - **status** (string): status (example: "finished") #### 500 - Error occurred on server side. **InternalErrorMessage** - **code** (integer (int32)) (example: 500) - **message** (string): Details (example: "There has been an internal server error.") ### Example Usage ```bash curl -X POST "https://graphhopper.com/api/1/cluster/calculate" \ -H "Content-Type: application/json" \ -d '{ "configuration": "value", "clusters": [ "value" ], "customers": [ "value" ] }' ``` ``` -------------------------------- ### GET /matrix Source: https://docs.graphhopper.com/_bundle/openapi.json For N origins and M destinations, compute routes from all origins to all destinations and output the result as a matrix of travel times and/or distances. This includes the common cases of routes from one origin to many destinations, or from many origins to one destination. ```markdown ### Parameters - **profile** (VehicleProfileId, query, optional) - **point** (array (string), query, optional): Specify multiple points in `latitude,longitude` for which the weight-, route-, time- or distance-matrix should be calculated. In this case the starts are identical to the destinations. If there are N points, then NxN entries will be calculated. The order of the point parameter is important. Specify at least three points. Cannot be used together with from_point or to_point. - **from_point** (array (string), query, optional): The origin points for the routes in `latitude,longitude`. E.g. if you want to calculate the three routes A->1, A->2, A->3 then you have one from_point parameter and three to_point parameters. - **to_point** (array (string), query, optional): The destination points for the routes in `latitude,longitude`. - **point_hint** (array (string), query, optional): Optional parameter. Specifies a hint for each `point` parameter to prefer a certain street for the closest location lookup. E.g. if there is an address or house with two or more neighboring streets you can control for which street the closest location is looked up. - **from_point_hint** (array (string), query, optional): For the from_point parameter. See point_hint - **to_point_hint** (array (string), query, optional): For the to_point parameter. See point_hint - **snap_prevention** (array (string), query, optional): Optional parameter. 'Snapping' is the process of finding the closest road location for GPS coordinates provided in the `point` parameter. The `snap_prevention` parameter allows you to prevent snapping to specific types of roads. For example, if `snap_prevention` is set to bridge, the routing engine will avoid snapping to a bridge, even if it is the closest road for the given `point`. Current supported values: `motorway`, `trunk`, `ferry`, `tunnel`, `bridge` and `ford`. Multiple values are specified like `snap_prevention=ferry&snap_prevention=motorway`. Note that once snapped the routing algorithm can still route over bridges (or the other values). To avoid this you need to use the `custom_model`. - **curbside** (array (string (any|right|left)), query, optional): Optional parameter. It specifies on which side a point should be relative to the driver when she leaves/arrives at a start/target/via point. You need to specify this parameter for either none or all points. Only supported for motor vehicles and OpenStreetMap. - **from_curbside** (array (string (any|right|left)), query, optional): Curbside setting for the from_point parameter. See curbside. - **to_curbside** (array (string (any|right|left)), query, optional): Curbside setting for the to_point parameter. See curbside. - **out_array** (array (string), query, optional): Specifies which arrays should be included in the response. Specify one or more of the following options 'weights', 'times', 'distances'. To specify more than one array use e.g. out_array=times&out_array=distances. The units of the entries of distances are meters, of times are seconds and of weights is arbitrary and it can differ for different vehicles or versions of this API. - **fail_fast** (boolean, query, optional): Specifies whether or not the matrix calculation should return with an error as soon as possible in case some points cannot be found or some points are not connected. If set to `false` the time/weight/distance matrix will be calculated for all valid points and contain the `null` value for all entries that could not be calculated. The `hint` field of the response will also contain additional information about what went wrong (see its documentation). ### Responses #### 200 - Matrix API response **MatrixResponse** - **distances** (array (array (number (int64)))): The distance matrix for the specified points in the same order as the time matrix. The distances are in meters. If `fail_fast=false` the matrix will contain `null` for connections that could not be found. - **times** (array (array (number (int64)))): The time matrix for the specified points in the order [[from1->to1, from1->to2, ...], [from2->to1, from2->to2, ...], ...]. The times are in seconds. If `fail_fast=false` the matrix will contain `null` for connections that could not be found. - **weights** (array (array (number (double)))): The weight matrix for the specified points in the same order as the time matrix. The weights for different vehicle profiles can have a different unit but the weights array is perfectly suited as input for Vehicle Routing Problems as it is currently faster to calculate. If `fail_fast=false` the matrix will contain `null` for connections that could not be found. - **info** (object): Additional information for your request - **copyrights** (array (string)): Attribution according to our documentation is necessary if no white-label option included. - **took** (number (double)) - **hints** (array (object)): Optional. Additional response data. Array items: - **message** (string): Short description of this hint - **details** (string): Details of this hint - **invalid_from_points** (array (number (int32))): Optional. An array of from_point indices of points that could not be found. Will only be added if `fail_fast=false` and some `from_point`s were not found.` - **invalid_to_points** (array (number (int32))): Optional. An array of to_point indices of points that could not be found. Will only be added if `fail_fast=false` and some `to_point`s were not found.` - **point_pairs** (array (array (number (int32)))): Optional. An array of two-element arrays representing the from/to_point indices of points for which no connection could be found. Will only be added if `fail_fast=false` and some connections were not found. ### Example Usage ```bash curl -X GET "https://graphhopper.com/api/1/matrix?profile=value&point=item1,item2&from_point=item1,item2&to_point=item1,item2&point_hint=item1,item2&from_point_hint=item1,item2&to_point_hint=item1,item2&snap_prevention=item1,item2&curbside=item1,item2&from_curbside=item1,item2&to_curbside=item1,item2&out_array=item1,item2&fail_fast=true" ``` ```