Routing service

The routing service allows you to perform several types of spatial analysis on transportation networks, such as finding the best route across a city, finding the closest emergency vehicle or hospital, identifying a service area around a location, or servicing a set of orders with a fleet of vehicles.

Turn-by-turn directions and a route obtained using the routing service

Key features

  • High quality street data with global coverage to perform analyses in 247 countries.
  • Find routes that account for predictive, live, or historical traffic patterns.
  • Use travel modes (driving, walking, and trucks).
  • Define additional restrictions when finding routes such as avoiding toll roads or using preferred truck routes.
  • Add dynamic barriers that can either restrict or slow down travel.
  • Generate driving or walking directions in many languages.

How the routing service works

The routing service performs a number of operations. To learn more about the service URL, parameters, and responses for each operation, visit the links below.

  • Routing: get a simple route and turn-by-turn directions between two or more locations.
  • Optimized Routing: get a route with the most efficient sequence of stops and turn-by-turn directions between two or more locations.
  • Fleet routing: get optimal routes for a number of vehicles between a number of locations.
  • Closest facility routing: find one or more nearby facilities from incidents based on travel time or distance.
  • Service areas: get the area that can be reached by driving or walking from a location in a given time. You can also calculate the area based on travel to a location, and can consider distance traveled rather than time taken.
  • Travel cost matrix: get a matrix of travel times or distances between multiple origins and destinations.
  • Location-allocation: find a set of facilities that will best serve demand from surrounding areas.

Direct vs job requests

You can use the routing service by either making a Direct request or a Job request to the service endpoint. Both Direct and Job request types support all of the capabilities of the service, however, Direct is better suited for shorter requests, and Job is better suited for longer, more complex requests. The request type you choose depends on the complexity of the problem you are trying solve and limits of the request.

Simple routing

You can find a route and directions by making an HTTPS request to the routing service solve operation or by using client APIs. Specify the origin, destination, and optionally, additional parameters to refine the results with directions. Some of the most common parameters are described provided below.

Required parameters

NameDescriptionExamples
fThe format of the data returned.f=json f=pjson f=geojson f=html
tokenAn API key or OAuth 2.0 access token. Learn how to get an access token in Security and authentication.token=<YOUR_API_KEY>
token=<ACCESS_TOKEN>
stopsThe two or more locations that need to be visited in the route.stops=-117,34; -117.5,34.5
findBestSequenceSpecify whether the service should find the best sequence when visiting multiple destinations. Note: Set this parameter to true to generate an optimized route.findBestSequence=true

Direct

Use for shorter transactions with less than 150 stops that will complete in less than 5 minutes.

Use dark colors for code blocksCopy
1
https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve?<parameters>
Use dark colors for code blocksCopy
1
https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve?<parameters>

Key parameters

Name (Direct)DescriptionExamples
travelModeThe mode of transportation such as driving a car or a truck or walking.travelMode=JSON Object
startTimeThe time at which travel begins from the input stops. You can also specify a value of now, to set the depart time to the current time.startTime=now
returnDirectionsGenerate driving directions for each route.returnDirections=true
directionsLanguageThe language to be used when generating driving directions.directionsLanguage=es

Additional parameters: Set additional constraints for a route such as temporary slowdowns, using polygonBarriers, or set outputLines to specify the type of route feature created by the service.

Job

Use for longer transactions with up to 10,000 stops that will complete in less than 60 minutes.

Use dark colors for code blocksCopy
1
https://logistics.arcgis.com/arcgis/rest/services/World/Route/GPServer/FindRoutes/submitJob?<parameters>

Required parameters

NameDescriptionExamples
fThe format of the data returned.f=json f=pjson f=geojson f=html
tokenAn API key or OAuth 2.0 access token. Learn how to get an access token in Security and authentication.token=<YOUR_API_KEY>
token=<ACCESS_TOKEN>
stopsThe two or more locations that need to be visited in the route.stops=-117,34; -117.5,34.5
reorder_stops_to_find_optimal_routesSpecify whether the service should find the best sequence when visiting multiple destinations. Note:Set this parameter to true to return an optimized route.reorder_stops_to_find_optimal_routes=true

Key parameters

Name (Job)DescriptionExamples
travel_modeThe mode of transportation such as driving a car or a truck or walking.travel_mode=JSON Object
time_of_dayThe time at which travel begins from the input stops.time_of_day=1608022800000
populate_directionsGenerate driving directions for each route.populate_directions=true
directions_languageThe language to be used when generating driving directions.directions_language=es

Additional parameters: Set additional constraints such as temporary slowdowns, using polygon_barriers, route_shape to specify the type of route feature created by the service, or set return_to_start if the start and end location for your route is same.

Optimized routing

Optimized routing, also known as the traveling salesperson problem (TRP), is the process of finding the best route between an origin and multiple destinations for an individual or single vehicle. Optimized routing differs from simple routing because it can reorder the sequence of stops to create the most efficent route possible, while minimizing the travel distance or travel time.

You can find a route and directions by making an HTTPS request to the routing service solve operation or by using client APIs. Specify the origin, destination, and optionally, additional parameters to refine the results with directions. Some of the most common parameters are described provided below.

Required parameters

NameDescriptionExamples
fThe format of the data returned.f=json f=pjson f=geojson f=html
tokenAn API key or OAuth 2.0 access token. Learn how to get an access token in Security and authentication.token=<YOUR_API_KEY>
token=<ACCESS_TOKEN>
stopsThe two or more locations that need to be visited in the route.stops=-117,34; -117.5,34.5
findBestSequenceSpecify whether the service should find the best sequence when visiting multiple destinations. Note: Set this parameter to true to generate an optimized route.findBestSequence=true

Direct

Use for shorter transactions with less than 150 stops that will complete in less than 5 minutes.

Use dark colors for code blocksCopy
1
https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve?<parameters>
Use dark colors for code blocksCopy
1
https://route.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World/solve?<parameters>

Key parameters

Name (Direct)DescriptionExamples
travelModeThe mode of transportation such as driving a car or a truck or walking.travelMode=JSON Object
startTimeThe time at which travel begins from the input stops. You can also specify a value of now, to set the depart time to the current time.startTime=now
returnDirectionsGenerate driving directions for each route.returnDirections=true
directionsLanguageThe language to be used when generating driving directions.directionsLanguage=es

Additional parameters: Set additional constraints for a route such as temporary slowdowns, using polygonBarriers, or set outputLines to specify the type of route feature created by the service.

Job

Use for longer transactions with up to 10,000 stops that will complete in less than 60 minutes.

Use dark colors for code blocksCopy
1
https://logistics.arcgis.com/arcgis/rest/services/World/Route/GPServer/FindRoutes/submitJob?<parameters>

Required parameters

NameDescriptionExamples
fThe format of the data returned.f=json f=pjson f=geojson f=html
tokenAn API key or OAuth 2.0 access token. Learn how to get an access token in Security and authentication.token=<YOUR_API_KEY>
token=<ACCESS_TOKEN>
stopsThe two or more locations that need to be visited in the route.stops=-117,34; -117.5,34.5
reorder_stops_to_find_optimal_routesSpecify whether the service should find the best sequence when visiting multiple destinations. Note:Set this parameter to true to return an optimized route.reorder_stops_to_find_optimal_routes=true

Key parameters

Name (Job)DescriptionExamples
travel_modeThe mode of transportation such as driving a car or a truck or walking.travel_mode=JSON Object
time_of_dayThe time at which travel begins from the input stops.time_of_day=1608022800000
populate_directionsGenerate driving directions for each route.populate_directions=true
directions_languageThe language to be used when generating driving directions.directions_language=es

Additional parameters: Set additional constraints such as temporary slowdowns, using polygon_barriers, route_shape to specify the type of route feature created by the service, or set return_to_start if the start and end location for your route is same.

Fleet routing

You can perform fleet routing by making an HTTPS request to the Fleet Routing service execute operation or by using client APIs. Specify the orders, depots, routes, and optionally, additional parameters such as the travel mode used when finding routes or if you need to generate driving directions.

Required parameters

Direct

Use for shorter transactions that complete in less than 5 minutes and optimize up to 2 routes and 100 orders.

Use dark colors for code blocksCopy
1
https://logistics.arcgis.com/arcgis/rest/services/World/VehicleRoutingProblemSync/GPServer/EditVehicleRoutingProblem/execute?<parameters>

Key parameters

Name (Direct)Description
orders

A list of locations to visit with attributes such as the order name or the time required to complete the delivery at each order.

depots

The start and the return location for the vehicles.

routes

The characteristics and constraints for each vehicle. For example, the start and the return depot name, the maximum number of orders a vehicle is allowed to visit, and the total time the vehicle is allowed to operate.

travel_mode

The mode of transportation such as driving a car or a truck.

default_date

The date on which all of your routes start.

populate_directions

Generate driving directions for the routes.

Additional parameters: Solve complex fleet routing scenarios by specifying additional inputs such as route_renewals, order_pairs, breaks, route_zones or setting additional constraints when finding routes using time_window_factor, excess_transit_factor, spatially_cluster_routes.

Job

Use for longer transactions that can take up to 4 hours and optimize up to 100 routes and 2,000 orders.

Use dark colors for code blocksCopy
1
https://logistics.arcgis.com/arcgis/rest/services/World/VehicleRoutingProblem/GPServer/SolveVehicleRoutingProblem/submitJob?<parameters>

Key parameters

Name (Job)Description
orders

A list of locations to visit with attributes such as the order name or the time required to complete the delivery at each order.

depots

The start and the return location for the vehicles.

routes

The characteristics and constraints for each vehicle. For example, the start and the return depot name, the maximum number of orders a vehicle is allowed to visit, and the total time the vehicle is allowed to operate.

travel_mode

The mode of transportation such as driving a car or a truck.

default_date

The date on which all of your routes start.

populate_directions

Generate driving directions for the routes.

Additional parameters: Solve complex fleet routing scenarios by specifying additional inputs such as route_renewals, order_pairs, breaks, route_zones or setting additional constraints when finding routes using time_window_factor, excess_transit_factor, spatially_cluster_routes.

Closest facility routing

You can perform closest facility routing by making an HTTPS request to the closest facility service solveClosestFacility operation or by using client APIs. Specify the facilities to search for, one or more incidents, and optionally, additional parameters to refine the operation. Some of most common parameters are described below.

Required parameters

NameDescriptionExamples
fThe format of the data returned.f=json f=pjson
tokenAn API key or OAuth 2.0 access token. Learn how to get an access token in Security and authentication.token=<YOUR_API_KEY>
token=<ACCESS_TOKEN>

Direct

Use for shorter transactions to find up to 10 facilities from 100 facilities and 100 incidents in less than 5 minutes.

Use dark colors for code blocksCopy
1
https://route-api.arcgis.com/arcgis/rest/services/World/ClosestFacility/NAServer/ClosestFacility_World/solveClosestFacility?<parameters>
Use dark colors for code blocksCopy
1
https://route.arcgis.com/arcgis/rest/services/World/ClosestFacility/NAServer/ClosestFacility_World/solveClosestFacility?<parameters>

Key parameters

Name (Direct)DescriptionExamples
facilitiesSet of locations from which to choose the nearest locations.facilities=-117.190774,34.057301;-117.199781,34.06047
incidentsOne or more locations from which to start searching for the nearby locations.incidents=-117.195696,34.056503
travelModeThe mode of transportation such as driving a car or a truck or walking.travelMode=JSON Object
defaultTargetFacilityCountThe number of closest facilities to find per incident.defaultTargetFacilityCount=3
defaultCutoffThe travel time or travel distance value at which to stop searching for facilities for a given incident.defaultCutoff=5
travelDirectionWhether you want to search for the closest facility as measured from the incident to the facility or from the facility to the incident.travelDirection=esriNATravelDirectionToFacility

Additional parameters: Set additional constraints when finding closest facilities such as timeOfDay to use live traffic conditions or returnDirections and directionsLanguage to generate driving directions to each nearby facility.

Job

Use for longer transactions to find up to 100 facilities from 5,000 facilities and 5,000 incidents in less than 60 minutes.

Use dark colors for code blocksCopy
1
https://logistics.arcgis.com/arcgis/rest/services/World/ClosestFacility/GPServer/FindClosestFacilities/submitJob?<parameters>

Key parameters

Name (Direct)DescriptionExamples
facilitiesSet of locations from which to choose the nearest locations.facilities={"features":[{"geometry":{"x":-117.190774,"y":34.057301}},{"geometry":{"x":-117.199781,"y":34.06047}}]}
incidentsOne or more locations from which to start searching for the nearby locations.incidents={"features":[{"geometry":{"x":-117.195696,"y":34.056503}}]}
travel_modeThe mode of transportation such as driving a car or a truck or walking.travelMode=JSON Object
number_of_facilities_to_findThe number of closest facilities to find per incident.number_of_facilities_to_find=3
cutoffThe travel time or travel distance value at which to stop searching for facilities for a given incident.cutoff=5
travel_directionWhether you want to search for the closest facility as measured from the incident to the facility or from the facility to the incident.travel_direction=Incident To Facility

Additional parameters: Set additional constraints when finding closest facilities such as time_of_day to use live traffic conditions or populate_directions and directions_language to generate driving directions to each nearby facility.

Service areas

You can generate service areas by making an HTTPS request to the Service Area service solveServiceArea operation or by using client APIs. Specify the one or more input facilities, and optionally, additional parameters to refine the operation. Some of the most common parameters are described provided below.

Required parameters

NameDescriptionExamples
fThe format of the data returned.f=json f=pjson
tokenAn API key or OAuth 2.0 access token. Learn how to get an access token in Security and authentication.token=<YOUR_API_KEY>
token=<ACCESS_TOKEN>

Direct

Use for shorter transactions with less than 100 facilities that will complete in less than 5 minutes.

Use dark colors for code blocksCopy
1
https://route-api.arcgis.com/arcgis/rest/services/World/ServiceAreas/NAServer/ServiceArea_World/solveServiceArea?<parameters>
Use dark colors for code blocksCopy
1
https://route.arcgis.com/arcgis/rest/services/World/ServiceAreas/NAServer/ServiceArea_World/solveServiceArea?<parameters>

Key parameters

Name (Direct)DescriptionExamples
facilitiesOne or more locations around which service areas are generated.facilities=-117,34
defaultBreaksThe size and number of service areas to generate for each facility.defaultBreaks=5,10,15
travelModeThe mode of transportation such as driving a car or a truck or walking.travelMode=JSON Object
travelDirectionThe direction of travel (away from facility or towards facility) that should be used when generating service areas.travelDirection=esriNATravelDirectionFromFacility
timeOfDayThe time to depart from or arrive at facilities. You can also specify a value of now, to set the depart or arrive time to current time.timeOfDay=now

Additional parameters: Exercise fine-grained control on how the service area polygons are generated by specifying outputPolygons, splitPolygonAtBreaks, overlapPolygons, and mergeSimilarPolygonRanges parameters.

Job

Use for longer transactions with up to 1,000 facilities that will complete in less than 2 hours.

Use dark colors for code blocksCopy
1
https://logistics.arcgis.com/arcgis/rest/services/World/ServiceAreas/GPServer/GenerateServiceAreas/submitJob?<parameters>

Key parameters

Name (Job)DescriptionExamples
facilitiesOne or more locations around which service areas are generated.facilities={"features":[{"geometry":{"x":-117,"y":34.5}}]}
break_valuesThe size and number of service areas to generate for each facility.break_values=5 10 15
travel_modeThe mode of transportation such as driving a car or a truck or walking.travel_mode=JSON Object
travel_directionThe direction of travel (away from facility or towards facility) that should be used when generating service areas.travel_direction=Away From Facility
time_of_dayThe time to depart from or arrive at facilities.time_of_day=1608022800000

Additional parameters: Exercise fine-grained control on how the service area polygons are generated by specifying polygon_detail, polygon_overlap_type, and polygons_for_multiple_facilities parameters.

Travel cost matrix

You can create travel cost matrix by making an HTTPS request to the origin-destination cost matrix service solveODCostMatrix operation or by using client APIs. Specify one or more origins and destinations, and optionally, additional parameters to refine the operation. Some of the most common parameters are described below.

Required parameters

NameDescriptionExamples
fThe format of the data returned.f=json f=pjson
tokenAn API key or OAuth 2.0 access token. Learn how to get an access token in Security and authentication.token=<YOUR_API_KEY>
token=<ACCESS_TOKEN>

Direct

Use for shorter transactions with up to 10 origins and 10 destinations that will complete in less than 5 minutes.

Use dark colors for code blocksCopy
1
https://route-api.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/NAServer/OriginDestinationCostMatrix_World/solveODCostMatrix?<parameters>
Use dark colors for code blocksCopy
1
https://route.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/NAServer/OriginDestinationCostMatrix_World/solveODCostMatrix?<parameters>

Key parameters

Name (Direct)DescriptionExamples
originsStarting locations from which to travel to the destinations.origins=-118.245843,34.057794;-117.16274,32.719178
destinationsEnding locations to travel to from the origins.destinations=-117.182676,34.055909;-118.144184,34.147832
travelModeThe mode of transportation such as driving a car or a truck or walking.travelMode=JSON Object
defaultTargetDestinationCountThe number of destinations to find per origin. A null value or no value for this parameter results in a search for all destinations from every origin.defaultTargetDestinationCount=null
defaultTargetDestinationCount=3
defaultCutoffThe travel time or travel distance value at which to stop searching for destinations from a given origin. The default value is null which means to search until all destinations are found for every origin. The units are time or distance based depending on your travel mode.defaultCutoff=5

Additional parameters: Set additional constraints when creating the travel cost matrix such as timeOfDay to use live traffic conditions or outputType to specify if the output is a table or a matrix representing travel costs.

Job

Use for longer transactions with up to 1,000 origins and 1,000 destinations that will complete in less than 60 minutes.

Use dark colors for code blocksCopy
1
https://logistics.arcgis.com/arcgis/rest/services/World/OriginDestinationCostMatrix/GPServer/GenerateOriginDestinationCostMatrix/submitJob?<parameters>

Key parameters

Name (Direct)DescriptionExamples
originsStarting locations from which to travel to the destinations.origins={"features":[{"geometry":{"x":-118.245843,"y":34.057794}},{"geometry":{"x":-117.16274,"y":32.719178}}]}
destinationsEnding locations to travel to from the origins.destinations={"features":[{"geometry":{"x":-117.182676,"y":34.055909}},{"geometry":{"x":-118.144184,"y":34.147832}}]}
travel_modeThe mode of transportation such as driving a car or a truck or walking.travel_mode=JSON Object
number_of_destinations_to_findThe number of destinations to find per origin. A null value or no value for this parameter results in a search for all destinations from every origin.number_of_destinations_to_find=null
number_of_destinations_to_find=3
cutoffThe travel time or travel distance value at which to stop searching for destinations from a given origin. The default value is null which means to search until all destinations are found for every origin. The units are time or distance based depending on your travel mode.cutoff=5

Additional parameters: Set additional constraints when creating the travel cost matrix such as time_of_day to use live traffic conditions or output_format to specify if the output is a table or a file in CSV or GeoJSON format.

Location-allocation

You can perform location allocation by making an HTTPS request to the location-allocation service submitJob operation or by using client APIs. Specify one or more facilities, demand points, the location-allocation problem type, and additional parameters to refine the operation. Some of the most common parameters are described below.

Location-allocation only supports job requests.

URL

Use dark colors for code blocksCopy
1
https://logistics.arcgis.com/arcgis/rest/services/World/LocationAllocation/GPServer/SolveLocationAllocation/submitJob?<parameters>

Required parameters

NameDescriptionExamples
fThe format of the data returned.f=json f=pjson
tokenAn API key or OAuth 2.0 access token. Learn how to get an access token in Security and authentication.token=<YOUR_API_KEY>
token=<ACCESS_TOKEN>

Key parameters

NameDescriptionExamples
facilitiesOne or more locations that serve as facilities.facilities={"features":[{"geometry":{"x":-117.195696,"y":34.056503}}]}
demand_pointsOne or more locations that represent demand for the services offered at the facilities.demand_points={"features":[{"geometry":{"x":-117.190774,"y":34.057301}},{"geometry":{"x":-117.199781,"y":34.06047}}]}
travel_modeThe mode of transportation such as driving a car or a truck or walking.travelMode=JSON Object
problem_typeThe objective of the location-allocation analysisproblem_type=Maximize Attendance
number_of_facilities_to_findNumber of facilities the service should choosenumber_of_facilities_to_find=2

Additional parameters: Set additional constraints when performing location-allocation such as default_measurement_cutoff to limit the travel time or travel distance between a facility and a demand point, ortravel_direction to indicate if travel occurs from facility to demand points or vice versa.

Authentication

To make authenticated requests you need to use one of the following:

  • API key: A permanent token that grants your application access to ready-to-use services and, with an ArcGIS Developer account, private hosted layer (items) and data services.
  • User authentication (formerly _ArcGIS identity): Grants a short-lived token, generated via OAuth 2.0, giving your application permission to access the content and services authorized to an existing ArcGIS user's account.

Learn more about getting access tokens in Security and authentication.

API support

RoutingOptimized RoutingFleet routingClosest facility routingService areasLocation-allocationTravel cost matrix
ArcGIS Maps SDK for JavaScript111
ArcGIS Maps SDK for .NET111
ArcGIS Maps SDK for Kotlin111
ArcGIS Maps SDK for Swift111
ArcGIS Maps SDK for Java111
ArcGIS Maps SDK for Qt111
ArcGIS API for Python
ArcGIS REST JS
Esri Leaflet2222222
MapLibre GL JS2222222
OpenLayers2222222
Full supportPartial supportNo support
  • 1. Access with geoprocessing task.
  • 2. Access via ArcGIS REST JS.

Pricing

To determine how much it costs to access the service:

  1. If you have an ArcGIS Developer account, go to Pricing. Transactions are billed in US dollars. A free tier of transactions may be available.
  2. If you have an ArcGIS Online account, go to Understand credits. Transactions are billed in credits.

Service data

The routing service uses industry-leading reference street data that is frequently updated. The main sources for data is HERE. Additional sources may be used for different countries.

The accuracy and quality of routing will vary by geographic region. Street data may include not only major interstates, highways, and roads, but also local and rural roads. This map shows the street data coverage for the world. Click on a country to determine the quality of data available in a geographic region.

Global routing service data coverage
Coverage typeColorDescriptionService functionality
Predictive TrafficHistorical, live, and predictive traffic informationCan take into account changing traffic conditions based on current, future, and past observations
Live TrafficHistorical and live traffic informationCan take into account changing traffic conditions based on current and past observations
Historical TrafficHistorical traffic informationCan take into account changing traffic conditions, but travel speeds are only based on past observations
Posted Speed LimitsStatic travel times derived from historical average speeds for automobilesCan not take into accout the time of day
LimitedMajor roads, but no secondary or local roadsTravel times are static and derived from speed limits
MinimalSome major roads, but no secondary or local roadsNot recommended for critical operations

See the complete list of street data coverage by country or visit the Streets data coverage web map.

Tutorials

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.