Route Optimization API Overview

Route Optimization is a Google Maps Platform API that accepts vehicle routing objectives and operational constraints in the form of structured data to provide a route plan for one or more vehicles.

Why use Route Optimization

With Route Optimization API, you can establish or refine an automated dispatch or route planning process that improves the operational efficiency of your transportation needs. With parameters to express your unique operational objectives and constraints, and an algorithm built on top of the trusted Google Maps data, the service generates the best possible route plans to meet those constraints. Some use-case examples follow:

  • A logistics company uses Route Optimization to optimize the assignments of all next-day shipments, providing a route for each shipment that optimizes for distance and time efficiency, cost saving, on time delivery, and driver and end customer satisfaction.
  • An on demand food delivery company uses Route Optimization in their real-time dispatch process to choose the best active driver to pick up several new orders and insert it in their existing routes.
  • A medical service provider uses Route Optimization to map health providers to appointments, improving the efficiency of the routes for each provider across their day.
  • A field service provider uses Route Optimization to find the optimal route and sequence for technician's service appointments, and re-optimize when condition changes occur, such as en route delays.

What you can do with Route Optimization

With Route Optimization API, you can optimize the routes and assignments of tasks for a fleet of vehicles, taking into account various objectives and constraints.

Examples of the objectives:

  • Travel efficiency: Define your requirements for travel efficiency based on parameters such as distance and time-to-destination.
  • On time arrival: Ensure vehicles arrive for their tasks on time. For example, define a given time window for a pickup, delivery, or service action.
  • Vehicle utilization cost: Minimize the number of vehicles required to perform the tasks to save cost.
  • Load balancing: Ensure tasks are fairly distributed across the fleet of vehicles and personnel.

Examples of the constraints:

  • Drivers work hours: Start and end time for work and time for breaks.
  • Vehicle capacity: The maximum amount of load a vehicle can carry at a time.
  • Time windows: Specific time slot required for arrival, such as customer availability or store operation hours.
  • Dependencies and compatibility: Define work dependencies in one of the following ways:

    • Requires specific types of vehicle or personnel
    • Requires other work to be performed first
    • A shipment must be the only one in the vehicle at a given time.

See developer reference guides (REST, gRPC) for details and all available parameters.

How Route Optimization works

The Route Optimization API uses a number of inputs to return a route plan. Inputs include vehicles, tasks or shipments, objectives, and constraints. A route plan includes tasks assignment to vehicles, the multi-stop routes for each vehicle, and the related metrics.

Route Optimization API achieves this using two methods:

  • OptimizeTours: A synchronous API, which requires the client to wait for the server's response before proceeding with other tasks.
  • BatchOptimizeTours: An asynchronous API, which allows the client to proceed with other tasks before the server finishes and responds.

Both methods share the same interface and supported parameters. You can read more about BatchOptimizeTours in Synchronous and Asynchronous Endpoints.

The Route Optimization API accepts an HTTP POST request with a JSON request body that contains the details of the input.

The OptimizeTours Request

The request consists of the following required entities:

  • Model: a global entity where global level settings and constraints are configured. It also contains Shipments and Vehicles.
  • Shipment: used to define a task or an actual shipment that could include a pickup task and a delivery visit and the corresponding attributes including locations and other attributes, constraints, and cost functions. See the Shipment reference documentation (REST, gRPC) for details.
  • Vehicle: used to define a vehicle (or driver, personnel) and the corresponding travel attributes including starting locations and other vehicle or travel attributes, constraints, and cost functions. See (REST, gRPC) for details.

See Pickup and Delivery Stop Order Optimization for a simple example.

The OptimizeTours response

The Route Optimization API returns a JSON response that includes the route plan for the vehicles and the tasks or shipments.

  • Routes: it contains the routes for each vehicle with its assigned tasks (or shipments)
  • Metrics: aggregated metrics about the generated route plan

See Pickup and Delivery Stop Order Optimization for a simple example.

Read more details about constructing the request and interpreting the response in Interpret the Response.


The following table summarizes the resources available through the Route Optimization API along with the data it returns.

Data resources Data returned Return format
batchOptimizeTours (REST, gRPC) Returns the resource name of a Long Running Operation, which indicates when processing is complete. JSON or gRPC proto
optimizeTours (REST, gRPC) Returns an optimized route, with details of the visits and metrics. JSON or gRPC proto

How to use Route Optimization

1 Get set up Start with Set up your Google Cloud project and complete the setup instructions that follow.
2 Run a basic request and receive a response After setup, start with sending a basic request and get the response, following Constructing a Request and Interpret the Response.
3 Try a more advanced scenario and start creating your own request Explore example scenarios starting with Pickup and Delivery Stop Order Optimization and start building requests that match your use cases.

Available client libraries

For a list of the available client libraries for Route Optimization API, see Client Libraries.

What's next