VRP API
The VRP(vehicle routing problem) API is designed to help optimize vehicle routes for delivery and fleet management tasks, where multiple depots and vehicles are involved. This API efficiently calculates the best routes, considering vehicle capacities, depot locations, customer demands, and other key factors.
Key Features
With the VRP API, you can:
-
Optimize Routes: Find the most efficient routes for a fleet of vehicles across multiple depots, considering vehicle capacities, travel times, and depot locations.
-
Comprehensive Route Details: Access detailed information, including:
- Order of Visits: The recommended sequence for your stops.
- Total Distance and Travel Time: Clear insights into the total distance and time for each route.
- Route Instructions: Step-by-step guidance for each vehicle's journey.
- Depot Assignment: Which depot each vehicle should start from, considering the closest and most efficient options.
Use Cases
Fleet Management
Manage routes for a fleet of vehicles across multiple depots while optimizing for fuel consumption, time, or distance.
Delivery Route Optimization
Find the best routes for delivery trucks or couriers based on their starting depots and customer locations.
Logistics and Distribution
Plan logistics operations that involve multiple warehouses or depots for dispatching vehicles to serve various customer locations.
Usage
To use the VRP API, send a POST request:
Request Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
vehicles | Array | A list of vehicles with details such as current location, capacity, and max distance. | yes |
customers | Array | A list of customer locations along with their demand (e.g., number of packages or items to deliver). | yes |
depots | Array | A list of depots with their location. | yes |
Request Example (POST)
Response Codes for ONM API
| Status Code | Message | Description |
|---|---|---|
200 | OK | The request was successful. The system found a valid route and returned the requested data. |
404 | NoRoute | No route exists between the specified locations. Confirm that the locations are accessible by route. |
401 | Not Authorized - No Token | Authentication failed. No valid token was provided. Please include a valid authentication token. |
401 | Not Authorized - Invalid Token | The authentication token provided is either invalid or expired. Use a current, valid token. |
422 | InvalidInput | The request parameters are incorrect. Review the input values and adjust as needed. |
Success Response Example
API Limits and Restrictions
- Rate Limit: 50 requests per second from a single API token. If you exceed this limit, you will receive an error message and your requests will be rejected. To avoid this, you can throttle your requests or use multiple tokens for different applications or users.
- Inter-Country Requests: Not allowed. You can only request directions within the same country or region. If you try to request directions across different countries or regions, you will receive an error message, and your request will be invalid. For inter-country travel, consider using other map services or APIs that support this feature.
- Coordinates Waypoints: Should only be less than or equal to 10.