# Retrieve solution of a route optimization job

Take the job id and fetch the solution for the vehicle routing problem from this URL:


https://graphhopper.com/api/1/vrp/solution/?key=


You get the job id by sending a vehicle routing problem to the batch mode URL.

Endpoint: GET /vrp/solution/{jobId}
Version: 1.0.0
Security: key

## Path parameters:

  - `jobId` (string, required)
    Request solution with jobId

## Response 200 fields (application/json):

  - `copyrights` (array)
    Example: ["GraphHopper","OpenStreetMap contributors"]

  - `status` (string)
    Indicates the current status of the job
    Enum: "waiting_in_queue", "processing", "finished"

  - `waiting_time_in_queue` (integer)
    Waiting time in milliseconds.
    Example: 300000

  - `processing_time` (integer)
    Processing time in ms. If job is still waiting in queue, processing_time is 0
    Example: 900000

  - `solution` (object)
    Only available if status field indicates finished.

  - `solution.distance` (integer)
    Overall distance traveled in meters, i.e. the sum of each route's transport distance.
    Example: 1200

  - `solution.transport_time` (integer)
    Overall time travelled in seconds, i.e. the sum of each route's transport time.
    Example: 12000

  - `solution.max_operation_time` (integer)
    Operation time of longest route in seconds.
    Example: 4000

  - `solution.waiting_time` (integer)
    Overall waiting time in seconds.
    Example: 200

  - `solution.service_duration` (integer)
    Overall service time in seconds.
    Example: 1200

  - `solution.preparation_time` (integer)
    Overall preparation time in seconds.

  - `solution.setup_time` (integer)
    Overall setup time in seconds.

  - `solution.completion_time` (integer)
    Overall completion time in seconds, i.e. the sum of each route's operation time.
    Example: 12000

  - `solution.no_vehicles` (integer)
    Number of employed vehicles.
    Example: 10

  - `solution.no_unassigned` (integer)
    Number of jobs that could not be assigned to final solution.
    Example: 1

  - `solution.routes` (array)
    An array of routes

  - `solution.routes.vehicle_id` (string)
    Id of vehicle that operates route
    Example: "driver-stefan"

  - `solution.routes.distance` (integer)
    Distance of route in meters.
    Example: 10000

  - `solution.routes.transport_time` (integer)
    Transport time of route in seconds
    Example: 1800

  - `solution.routes.completion_time` (integer)
    Completion time of route in seconds
    Example: 1800

  - `solution.routes.waiting_time` (integer)
    Waiting time of route in seconds

  - `solution.routes.service_duration` (integer)
    Service duration of route in seconds

  - `solution.routes.preparation_time` (integer)
    Preparation time of route in seconds

  - `solution.routes.setup_time` (integer)
    Setup time of route in seconds

  - `solution.routes.activities` (array)
    Array of activities

  - `solution.routes.activities.type` (string)
    type of activity
    Enum: "start", "end", "service", "pickupShipment", "deliverShipment", "pickup", "delivery", "break"

  - `solution.routes.activities.id` (string)
    Id referring to the underlying service or shipment, i.e. the shipment or service this activity belongs to

  - `solution.routes.activities.name` (string)
    Human-readable name copied from the underlying service or shipment, if one was set on the request. Omitted for start/end activities and when the request did not specify a name.

  - `solution.routes.activities.location_id` (string)
    Id that refers to address

  - `solution.routes.activities.address` (object)
    Address of activity

  - `solution.routes.activities.address.location_id` (string)
    Specifies the id of the location.
    Example: "550e8400-e29b-11d4-a716-446655440000"

  - `solution.routes.activities.address.name` (string)
    Name of location.
    Example: "Queens Victoria Street 70, Second Floor, Flat 245"

  - `solution.routes.activities.address.lon` (number)
    Longitude of location.
    Example: -0.092869

  - `solution.routes.activities.address.lat` (number)
    Latitude of location.
    Example: 51.512665

  - `solution.routes.activities.address.street_hint` (string)
    Optional parameter. Specifies a hint 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: "Queens Victoria Street 70"

  - `solution.routes.activities.address.snapped_waypoint` (object)
    Access point to the road network. It is only available if return_snapped_waypoints is true (by default it is false).

  - `solution.routes.activities.address.snapped_waypoint.lon` (number)
    Longitude of location.
    Example: -0.092869

  - `solution.routes.activities.address.snapped_waypoint.lat` (number)
    Latitude of location.
    Example: 51.512665

  - `solution.routes.activities.arr_time` (integer)
    Arrival time at this activity in seconds. If type is start, this is not available (since it makes no sense to have arr_time at start). However, end_time is available and actually means \"departure time\" at start location. It is important to note that arr_time does not necessarily mean \"start of underlying activity\", it solely means arrival time at activity location. If this activity has no time windows and if there are no further preparation times, arr_time is equal to activity start time.

  - `solution.routes.activities.end_time` (integer)
    End time of and thus departure time at this activity. If type is end, this is not available (since it makes no sense to have an end_time at end) end_time at each activity is equal to the departure time at the activity location.

  - `solution.routes.activities.end_date_time` (string)
    Translation of unix timestamp in end_time to end date time string with zone offset. It will be in the following ISO-8601 format: 2007-12-03T10:15:30+01:00.

  - `solution.routes.activities.arr_date_time` (string)
    Translation of unix timestamp in arr_time to arrival date time string with zone offset. It will be in the following ISO-8601 format: 2007-12-03T10:15:30+01:00.

  - `solution.routes.activities.waiting_time` (integer)
    Waiting time at this activity in seconds. A waiting time can occur if the activity has at least one time window. If arr_time < time_window.earliest a waiting time of time_window_earliest - arr_time occurs.

  - `solution.routes.activities.preparation_time` (integer)
    preparation time at this activity in seconds

  - `solution.routes.activities.setup_time` (integer)
    Setup time at this activity in seconds. Setup time is charged when the location differs from the previous activity, representing location overhead like dock check-in or security clearance.

  - `solution.routes.activities.distance` (integer)
    Cumulative distance from start to this activity in meters.

  - `solution.routes.activities.driving_time` (integer)
    Cumulative driving time from start to this activity in seconds.

  - `solution.routes.activities.load_before` (array)
    Array with size/capacity dimensions before this activity

  - `solution.routes.activities.load_after` (array)
    Array with size/capacity dimensions after this activity

  - `solution.routes.activities.priority` (integer)
    Priority copied from the underlying service or shipment (1 = highest, 10 = lowest, default 2). Omitted for start/end activities.

  - `solution.routes.activities.group` (string)
    Group identifier copied from the underlying activity (pickup or delivery side for shipments). Omitted for start/end activities and when the request did not specify a group.

  - `solution.routes.activities.time_window` (object)
    The time window the solver actually scheduled this activity into. Only present when the request specified at least one explicit, non-default time window for the activity; the trivial [0, MAX] window is suppressed.

  - `solution.routes.activities.time_window.earliest` (integer)
    Specifies the opening time of the time window in seconds, i.e. the earliest time the service can start.

  - `solution.routes.activities.time_window.latest` (integer)
    Specifies the closing time of the time window in seconds, i.e. the latest time the service can start. Omit this field to indicate no limit.

  - `solution.routes.points` (array)
    One entry for every vehicle

  - `solution.unassigned` (object)

  - `solution.unassigned.services` (array)
    An array of ids of unassigned services
    Example: ["service-1","service-3"]

  - `solution.unassigned.shipments` (array)
    An array of ids of unassigned shipments
    Example: ["shipment-5"]

  - `solution.unassigned.breaks` (array)
    An array of ids of unassigned breaks

  - `solution.unassigned.details` (array)
    An array of details, i.e. reason for unassigned services or shipments

  - `solution.unassigned.details.id` (string)
    Id of unassigned service/shipment

  - `solution.unassigned.details.code` (integer)
    Reason code (most likely reason). See reasons array for additional probable reasons.

Code   |  Reason
:------|:---------
1 | cannot serve required skill
2 | cannot be visited within time window
3 | does not fit into any vehicle due to capacity
4 | cannot be assigned due to max distance constraint of vehicles
21 | could not be assigned due to relation constraint
22 | could not be assigned due to allowed vehicle constraint
23 | could not be assigned due to max-time-in-vehicle constraint
24 | driver does not need a break
25 | could not be assigned due to disallowed vehicle constraint
26 | could not be assigned due to max drive time constraint
27 | could not be assigned due to max job constraint
28 | could not be assigned due to max activity constraint
29 | could not be assigned due to group relation constraint
30 | could not be assigned due to driving time break
50 | underlying location cannot be accessed over road network by at least one vehicle
51 | location is isolated and cannot reach any other location over road network

  - `solution.unassigned.details.reason` (string)
    Human readable reason as listed above (most likely reason)

  - `solution.unassigned.details.reasons` (array)
    Array of probable reasons why this job could not be assigned, sorted by likelihood (most likely first).
This provides more context than the single code/reason fields, which only show the most likely reason.
For example, a job might fail due to a relation constraint (code 21), but the underlying cause
could be a time window violation (code 2). In this case, both reasons would appear in this array.

  - `solution.unassigned.details.reasons.code` (integer)
    Reason code (see Detail.code for the full list of codes)

  - `solution.unassigned.details.reasons.reason` (string)
    Human readable reason

  - `solution.unassigned.activities` (array)
    Per-activity breakdown of every unassigned job. For each unassigned service there is exactly one entry; for each unassigned shipment there are two entries (one with type: "pickupShipment" and one with type: "deliverShipment"), both sharing the shipment id.

Schedule-derived fields (arr_time, end_time, waiting_time, distance, driving_time, preparation_time, setup_time, load_before, load_after) are zero or omitted because the job was never placed on a route. The descriptive fields name, priority, and group are echoed from the original request when present, so consumers can render or audit unassigned stops without joining back to the request. time_window is omitted because the solver never picked one.

  - `solution.costs` (integer)

  - `solution.time` (integer)
    Use transport_time instead.

## Response 400 fields (application/json):

  - `message` (string)
    Short error message
    Example: "Bad Request"

  - `hints` (array)
    Optional error information.

  - `hints.message` (string)
    error message
    Example: "unsupported json property [vehiles]. allowed properties: [vehicles, vehicle_types, services, shipments, relations, algorithm, objectives, cost_matrices, configuration]"

  - `hints.details` (string)
    Details
    Example: "class java.lang.IllegalArgumentException"

  - `status` (string)
    status
    Example: "finished"

## Response 404 fields (application/json):

  - `message` (string)
    Error message
    Example: "Invalid job_id 73314c89-ee4b-459c-aca4-0ad6d6e558da"

  - `status` (string)
    status
    Example: "finished"


## Response 500 fields
