---
title: "route(request, callback)"
framework: mapkitjs
role: symbol
role_heading: Instance Method
path: mapkitjs/directions/route1
---

# route(request, callback)

Retrieves directions and estimated travel time based on the specified start and end points.

## Declaration

```data
route(
    request: DirectionsRequest,
    callback: (
        error: Error | null,
        result: DirectionsResponse | null,
    ) => void,
): Promise<DirectionsResponse>;
```

## Parameters

- `request`: A doc://com.apple.mapkitjs/documentation/MapKitJS/DirectionsRequest object that specifies details for the directions you want to retrieve.
- `callback`: A callback function that receives the directions, returned asynchronously.

## Return Value

Return Value A promise that resolves with a DirectionsResponse on success.

## Discussion

Discussion Call the route(request, callback) method to get directions. MapKit JS returns directions asynchronously via a callback function. This callback function is invoked with two arguments, error on failure and data on success. error contains an error code and a text description of the error. data is a DirectionsResponse object with the following two properties: request is the request object associated with this response. routes contains an array of up to three Route objects returned by the server.

## See Also

### Deprecated

- [eta(request, callback)](mapkitjs/directions/eta1.md)
- [Transport](mapkitjs/directions/transport.md)
