Last updated on Sep 12, 2023
{
"from": {
"address": "Dallas, TX 75201 USA"
},
"to": {
"address": "New York, NY 10007 USA"
},
"waypoints": []
}
{
"from": {
"lat": 32.77822,
"lng": -96.79512
},
"to": {
"lat": 40.71453,
"lng": -74.00712
},
"waypoints": []
}
{
"from": {
"lat": 32.77822,
"lng": -96.79512
},
"to": {
"lat": 40.71453,
"lng": -74.00712
},
"waypoints": []
}
{
"from": {
"address": "Dallas, TX 75201 USA"
},
"to": {
"address": "NJ USA"
},
"waypoints": [
{
"address": "New York, NY 10007 USA"
}
]
}
{
"from": {
"lat": 32.77822,
"lng": -96.79512
},
"to": {
"lat": 40.21789,
"lng": -74.75942
},
"waypoints": [
{
"lat": 40.71453,
"lng": -74.00712
}
]
}
By default, the Tolls API uses Here Maps as the mapping service provider if no provider is specified in the request. However, you can specify a different provider by setting the serviceProvider field in the request body.
{
"from": {
"address": "Dallas, TX 75201 USA"
},
"to": {
"address": "New York, NY 10007 USA"
},
"waypoints": [],
"serviceProvider": "gmaps"
}
{
"from": {
"address": "Dallas, TX 75201 USA"
},
"to": {
"address": "New York, NY 10007 USA"
},
"waypoints": [],
"vehicle": {
"type": "4AxlesTruck"
}
}
height - For example, different rates may apply for vehicles with a height between 1-7 feet versus those that are 8 feet or taller.
{
"from": {
"lat": 40.69615,
"lng": -75.18973
},
"to": {
"lat": 40.69447,
"lng": -75.21
},
"vehicle": {
"type": "4AxlesAuto",
"height": {
"value": 10,
"unit": "feet"
}
}
}
weight - For example, specifying a different weight in the request may result in a different toll rate being calculated.
{
"from": {
"lat": 39.33673,
"lng": -74.51198
},
"to": {
"lat": 39.33973,
"lng": -74.52073
},
"vehicle": {
"type": "2AxlesTruck",
"weight": {
"value": 20000,
"unit": "pound"
}
}
}
When making a request to the Tolls API, users have the option to specify either the vehicle’s height or weight, or both. The tolls charged by the API will be calculated based on the provided vehicle parameters.
height - For example, different rates may apply for vehicles with different heights.
{
"from": {
"address": "525, 1839 Sofia, Bulgaria"
},
"to": {
"address": "862, 4000 Tsentar, Plovdiv, Bulgaria"
},
"vehicle":{
"type": "4AxlesTruck",
"weight":{
"value": 14,
"unit": "ton"
},
"height":{
"value": 20,
"unit": "meter"
},
"axles": 4,
"emissionClass": "euro_6"
}
}
weight - For example, different rates may apply for vehicles with a weight between 4-11 tonnes versus those that are 12 tonnes or heavier.
{
"from": {
"address": "525, 1839 Sofia, Bulgaria"
},
"to": {
"address": "862, 4000 Tsentar, Plovdiv, Bulgaria"
},
"vehicle":{
"type": "4AxlesTruck",
"weight":{
"value": 14,
"unit": "ton"
},
"height":{
"value": 20,
"unit": "meter"
},
"axles": 4,
"emissionClass": "euro_6"
}
}
axles -The toll rates in the Tolls API are subject to change based on the number of axles on the vehicle. Therefore, it is important to provide accurate axle information in the request to ensure reliable toll calculations.
{
"from": {
"address": "525, 1839 Sofia, Bulgaria"
},
"to": {
"address": "862, 4000 Tsentar, Plovdiv, Bulgaria"
},
"vehicle":{
"type": "4AxlesTruck",
"weight":{
"value": 14,
"unit": "ton"
},
"height":{
"value": 20,
"unit": "meter"
},
"axles": 4,
"emissionClass": "euro_6"
}
}
emissionClass - For example, different rates may apply for vehicles with an emissionClass between euro_0-2 and those between euro_3-6. It is important to provide accurate vehicle emission information in the request to ensure reliable toll calculations.
{
"from": {
"address": "525, 1839 Sofia, Bulgaria"
},
"to": {
"address": "862, 4000 Tsentar, Plovdiv, Bulgaria"
},
"vehicle":{
"type": "4AxlesTruck",
"weight":{
"value": 14,
"unit": "ton"
},
"height":{
"value": 20,
"unit": "meter"
},
"axles": 4,
"emissionClass": "euro_6"
}
}
Parameters related to calculate fuel expenses are:
{
"from": {
"address": "Dallas, TX 75201 USA"
},
"to": {
"address": "New York, NY 10007 USA"
},
"vehicle":{
"type": "2AxlesAuto"
},
"fuelOptions": {
"fuelCost": {
"value": 4,
"currency": "USD",
"units": "$/gallon"
},
"fuelEfficiency": {
"city": 24,
"hwy": 32,
"units": "mpg"
}
}
}
To retrieve turn-by-turn directions in the Tolls API response, include the parameter ‘directionsFlag’ and set it to ‘true’ in the request body.
{
"from": {
"address": "Dallas, TX 75201 USA"
},
"to": {
"address": "New York, NY 10007 USA"
},
"directionsFlag": true
}
Example 1:
{
"from": {
"lat": 33.71782,
"lng": -117.72101
},
"to": {
"lat": 33.70108,
"lng": -117.73188
},
"departure_time": "2023-05-10T05:00:00-07:00"
}
Example 2
{
"from": {
"lat": 33.71782,
"lng": -117.72101
},
"to": {
"lat": 33.70108,
"lng": -117.73188
},
"departure_time": "2023-05-10T08:00:00-07:00"
}
The Tolls API offers state mileage information for travel within the United States, providing details on the distance traveled and time taken to travel through each state. To retrieve this information, simply include the parameter ‘state_mileage’ and set it to ‘true’ in the request body.
{
"from": {
"address": "Dallas, TX 75201 USA"
},
"to": {
"address": "New York, NY 10007 USA"
},
"state_mileage": true
}
For EVs, along with tolls you might want to know charging points along the route.For this, you will have to use vehicle type as “2AxlesEV”
{
"from": {
"address": "Dallas, TX 75201 USA"
},
"to": {
"address": "New York, NY 10007 USA"
},
"vehicle":{
"type": "2AxlesEV"
}
}
If vignettes are applicable for your route, the Tolls API will include information about them in the response. You can use the following case to retrieve and utilize the vignette information for your application
{
"from": {
"address": "106 2700 Blagoevgrad Bulgaria"
},
"to": {
"address": "Ivan Mihaylov 66, 2700 South-West University Neofit Rilski, Blagoevgrad, Bulgaria"
},
"waypoints": [],
"vehicle":{
"type": "2AxlesAuto"
}
}