NAV Navbar
shell javascript python
  • Introduction
  • Authentication
  • Toll API Methods
  • Request/Response Objects
  • Errors
  • Introduction

    Welcome to TollGuru Toll REST API decision engine that underpins the Tollguru Toll calculator. Use this guide to seamlessly integrate toll information from our API to your product: trucking freight operations, transportation modeling, mode choice decision analytics, connected vehicles, rideshare services, billing, etc. Before you proceed, we want to remind you that you must not pre-fetch, cache, index, or store any content in any form; and you must not use the information to create your own similar solution.

    You will see cheaper routes that are not shown by any other mapping applications such as Google maps, Apple maps, Waze, HERE, Mapquest, OpenStreetMap, Scout GPS, etc. You will see the cheapest, fastest and compromise routes since we optimize for two vectors - time and cost - versus other mapping and navigation softwares that optimize just for time. Tollguru is built for real America where both costs and times factor in route decisions.

    Let’s say you have to dispatch a 5-axle semi from Englewood, NJ to Scarsdale, NY in upstate New York. Navigation softwares would show you three routes, most likely, all going over the George Washington Bridge (GWB) ($90 one-way toll with E-ZPass NY).

    TollGuru would show the cheapest route over Tappan Zee/ Cuomo Bridge, the fastest route over GWB and some other logical routes. If you drive on the cheapest route (over Tappan Zee), you would take about 16 minutes more (than driving over GWB) but save $69 (if paying with NY E-ZPass). Saving $69 in an hour long trip! You can query with driver wages and value of time. Pretty sweet savings if you ask us.

    To get you started, we have created language bindings in JavaScript, Shell and Python. You can view code examples in the dark pane to the right. To switch between the programming languages, use tabs on the top right. You can also use Postman for quick check before you integrate our Toll API.

    As you will see, the Toll API accepts GET and POST requests to return toll information. You can query for tolls using three methods

    1. Specify origin and destination pair
    2. Specify route polyline from HERE map or Google map
    3. Pass an array of tracked locations (GPS traces/tracks) along a route, such as those received from a smartphone, car GPS or a fleet GPS device.

    Here are some of the ways you can get tolls on a route:

    Before you begin testing the REST API, sign up to get an API key.

    Authentication

    To authorize, use this code:

    # With shell, you can just pass the correct header with each request
    curl "api_endpoint_here"
      -H "Authorization: developer_key"
    
    const unirest = require('unirest');
    
    unirest.post("api_endpoint_here")
    .headers({"x-api-key": "developer_key"})
    .send({ ... })
    .end(function (response) {
      console.log(response.body);
    });
    

    Make sure to replace developer_key with your API key.

    TollGuru uses developer specific API keys to allow access to the API. You can register for a new TollGuru developer API key at our developers portal.

    The API key should be included in all API requests to the server in the header. It should look like:

    x-api-key: developer_key

    Toll API Methods

    As we talked earlier, you can query for tolls using three methods:

    1. Specify origin and destination pair
    2. Specify a particular route from HERE map or Google map. For HERE maps you can specify either the geocoordinate pairs or route polyline. For Google map you can specify route polyline.
    3. Specify GPS traces/tracks. Specify an array of tracked locations (GPS traces/tracks) along a route, such as those received from a smartphone, car GPS or a fleet GPS device as CSV file.

    1. Origin and destination pair

    This endpoint retrieves all routes for the origin destination pair (including waypoints) (see location object). You will see tolls and fuel estimates for all the routes returned from Google maps / HERE maps. You will be able to see the cheapest, the fastest and other compromise routes.

    The sample POST request should look like the following for cars, SUV and pick-ups

    curl -X POST "https://dev.tollguru.com/v1/calc/here" \    # for HERE Maps routes
    # curl -X POST "https://dev.tollguru.com/v1/calc/gmaps" \ # for Google Maps routes
      -H "x-api-key: developer_key" \
      -d '{
        "from": {
          "address": "Main str, Dallas, TX"
        },
        "to": {
          "address": "Addison, TX"
        },
        "waypoints": [
          { "address": "Plano, TX" },
          { "address": "Allen, TX"}
        ],
        "vehicleType": "2AxlesAuto",
        "fuelPrice": "2.79",
        "fuelPriceCurrency": "USD",
        "fuelEfficiency": {
          "city": 24,
          "hwy": 30,
          "units": "mpg"
        },
        "departure_time": 1551541566,
        "driver": {
          "wage": 30,
          "rounding": 15,
          "valueOfTime": 0
        }
      }'
    
    const unirest = require('unirest');
    
    unirest.post("https://dev.tollguru.com/v1/calc/here")
    .headers({"x-api-key": "developer_key"})
    .send({
        "from": {
          "address": "Main str, Dallas, TX"
        },
        "to": {
          "address": "Addison, TX"
        },
        "waypoints": [
          { "address": "Plano, TX" },
          { "address": "Allen, TX"}
        ],
        "vehicleType": "2AxlesAuto",
        "fuelPrice": "2.79",
        "fuelPriceCurrency": "USD",
        "fuelEfficiency": {
          "city": 24,
          "hwy": 30,
          "units": "mpg"
        },
        "departure_time": 1551541566,
        "driver": {
          "wage": 30,
          "rounding": 15,
          "valueOfTime": 0
        }
      })
    .end(function (response) {
      console.log(response.body);
    });
    
    import requests
    
    Tolls_Key = 'developer_key'
    Tolls_URL = 'https://dev.tollguru.com/v1/calc/here'
    headers = {
                'Content-type': 'application/json',
                'x-api-key': Tolls_Key
              }
    params = { 
                'from':
                   {
                       'address': 'Newark, NJ'
                   },
               'to':
                   {'address':
                        'Point Pleasant, NJ'
                    },
                'vehicleType': '2AxlesAuto'
            }
    response = requests.post(Tolls_URL, json=params, headers=headers)
    
    

    The sample POST request should look like the following for trucks

    curl -X POST "https://dev.tollguru.com/v1/calc/here" \    # for HERE Maps routes
      -H "x-api-key: developer_key" \
      -d '{
        "from": {
          "address": "Bedford, Pennsylvania"
        },
        "to": {
          "address": "Harrisburg, Pennsylvania"
        },
        "vehicleType": "5AxlesTruck",
        "fuelPrice": "2.79",
        "fuelPriceCurrency": "USD",
        "fuelEfficiency": {
          "city": 12,
          "hwy": 15,
          "units": "mpg"
        },
        "departure_time": 1551541566,
        "driver": {
          "wage": 30,
          "rounding": 15,
          "valueOfTime": 0
        },
        "truck": {
          "limitedWeight": 44000
        }
      }'
    
    const unirest = require('unirest');
    
    unirest.post("https://dev.tollguru.com/v1/calc/here")
    .headers({"x-api-key": "developer_key"})
    .send({
        "from": {
          "address": "Main str, Dallas, TX"
        },
        "to": {
          "address": "Addison, TX"
        },
        "waypoints": [
          { "address": "Plano, TX" },
          { "address": "Allen, TX"}
        ],
        "vehicleType": "2AxlesAuto",
        "fuelPrice": "2.79",
        "fuelPriceCurrency": "USD",
        "fuelEfficiency": {
          "city": 24,
          "hwy": 30,
          "units": "mpg"
        },
        "departure_time": 1551541566,
        "driver": {
          "wage": 30,
          "rounding": 15,
          "valueOfTime": 0
        },
        "truck": {
          "limitedWeight": 44000
        }
      })
    .end(function (response) {
      console.log(response.body);
    });
    

    The above POST request for cars will return JSON response structured in the following manner:

    {
        "status": "OK",
        "summary": {
            "route": [
                {
                    "location": {
                        "lat": 32.78165,
                        "lng": -96.79448
                    },
                    "address": "Main St, Dallas, TX 75201, United States"
                },
                {
                    "location": {
                        "lat": 33.02079,
                        "lng": -96.69925
                    },
                    "address": "Plano, TX, United States"
                },
                {
                    "location": {
                        "lat": 33.10144,
                        "lng": -96.67449
                    },
                    "address": "Allen, TX, United States"
                },
                {
                    "location": {
                        "lat": 32.95398,
                        "lng": -96.81769
                    },
                    "address": "Addison, TX, United States"
                }
            ],
            "rates": {
                ...
            },
            "currency": "USD",
            "countries": [
                "USA"
            ],
            "departure_time": 1551544964,
            "fuelPrice": {
                "value": 2.79,
                "currency": "USD"
            },
            "fuelEfficiency": {
                "city": 24,
                "hwy": 30,
                "units": "mpg"
            },
            "vehicleType": "2AxlesAuto",
            "share": {
                ...
            },
            "source": "HERE"
        },
        "routes": [
            {
                "summary": {
                    "hasTolls": true,
                    "diffs": {
                        "cheapest": 2.63,
                        "fastest": 0
                    },
                    "url": "https://www.google.com/maps/?saddr=32.781643,-96.7944781&daddr=32.7839434,-96.7915463+to:32.789104,-96.7916107+to:33.0207898,-96.6992516+to:33.1014399,-96.6744947+to:33.007983,-96.7079687+to:32.9539847,-96.81769&via=1,2,3,4,5",
                    "distance": {
                        "text": "45.2 mi",
                        "metric": "72.7 km",
                        "value": 72731
                    },
                    "duration": {
                        "text": "1 h 2 min",
                        "value": 3742
                    },
                    "name": "US-75",
                    "note": []
                },
                "driver": {
                    "billedHours": 1.25,
                    "wage": 30,
                    "total": 37.5
                },
                "costs": {
                    "fuel": 4.31,
                    "tag": 2.46,
                    "cash": false,
                    "licensePlate": 3.69,
                    "creditCard": false,
                    "prepaidCard": 2.46
                },
                "tolls": [
                    {
                        "id": 131030,
                        "lat": 33.00225,
                        "lng": -96.77585,
                        "name": "Coit Main Lane Gantry (MLP7)",
                        "road": "President George Bush Tpke",
                        "state": "Texas",
                        "type": "barrier",
                        "tagCost": 1.34,
                        "tagPriCost": 1.34,
                        "tagSecCost": false,
                        "cashCost": false,
                        "licensePlateCost": 2.01,
                        "prepaidCardCost": 1.34,
                        "creditCardCost": false,
                        "currency": "USD",
                        "tagPrimary": [
                            "TxTAG",
                            "TollTag",
                            "EZ TAG",
                            "K-Tag"
                        ],
                        "tagSecondary": [],
                        "licensePlatePrimary": "ZipCash",
                        "licensePlateSecondary": false,
                        "discountCarDetails": false,
                        "discountCarType": false,
                        "discountTruckDetails": false,
                        "discountTrucks": false,
                        "height": "No"
                    },
                    { ...
                    }
                ],
                "directions": { ...
                    }
                ,
                "polyline": { ... }
        ]
    }
    

    HTTP Request for trucks, buses, RVs, cars, SUV, pick-ups, motorcycles

    POST https://dev.tollguru.com/v1/calc/here

    For trucks you should specify truck weight, wherever possible. Some bridges and tunnels restrict trucks based on weight. If you are transporting HAZMAT material, please specify material type. If you do not specify HAZMAT restrictions and weight restrictions, none will be applied.

    HTTP Request for cars, SUVs, pick-ups, motorcycles

    POST https://dev.tollguru.com/v1/calc/gmaps

    Request Parameters

    You can use the following Request Parameters. Some of the parameters are optional

    Parameter Type Default Description
    from Object empty Required
    Location object
    to Object empty Required
    Location object
    waypoints Array empty Optional
    Array of Location objects
    vehicleType String 2AxlesAuto Optional
    Vehicle type
    departure_time String or Number 2019-02-28T22:30:00 or 1551399000 Optional
    Departure time
    UNIX time or
    time in ISO 8601 format
    fuelPrice Number 3.00 Optional
    Fuel price
    fuelPriceCurrency String USD Optional
    Fuel price currency
    USD, CAD, MXN or INR
    fuelEfficiency Object empty Optional
    Fuel efficiency parameters
    truck Object empty Optional
    Truck routing only (/calc/here endpoint)
    Truck parameters
    driver Object empty Optional
    Driver wage or Value of Time
    Driver Wage parameters

    Response Parameters

    The response JSON from the Toll API returns the following:

    Parameter Type Description
    route Object Routes information including tolls, gas expenses, etc. for each route (See Route object)
    rates Object Currency exchange rates (See Rates object)
    departure_time Number Departure time in UNIX time
    fuelPrice Object Fuel price from request or the default fuel price (including currency)
    fuelEfficiency Object City fuel efficiency and highway fuel efficiency from request or the default values. Returns fuel efficiency units
    routes Array Route information including distance, time, toll (See Routes object)

    2. Route polyline (from HERE/ Google map)

    You want to use this request when you have the polyline you constructed from HERE maps route using Google encoded polyline algorithm or the Google Maps route polyline. Since you pass on the exact route, you will receive toll information for the particular route. You will not receive tolls for alternate routes between origin and destination.

    # Find tolls using set of geocoordinate points from HERE maps
    curl -X POST "https://dev.tollguru.com/v1/calc/route" \
      -H "x-api-key: developer_key" \
      -d '{
        "vehicleType": "2AxlesAuto",
        "source": "here",
        "path": "32.94909,-96.8233|...|32.95043,-96.82314"
      }'
    
    # OR
    
    # Find tolls using set of geocoordinates converted to polyline first (Google algorithm polyline compresses set of geocoordinates into a smaller string, hence it is preferred)
    curl -X POST "https://dev.tollguru.com/v1/calc/route" \
      -H "x-api-key: developer_key" \
      -d '{
        "vehicleType": "2AxlesAuto",
        "source": "here",
        "polyline": "gtagEndxmQMcAmCf@_ARGAe@DMAi@]_@oCu@mEs@gEq@SiDc@mAAuCXeCJqBB_@?c@CyA@]BcARoADe@Fa@L{BnAi@L}CZiBLsJ\\cBA}GRiGLeBHiBRoDLeGHoMAkEJoBLgGTuBDgB?sCIgAIcBQyA[}Bk@qDoAsEiBeH_DwJ}D}GsCoGsCqMqGyD_B_I{CsIaE{@]yBu@aK{CgFyBuFsCqFgDcFkCmBq@uCo@wJkBeBa@}Ak@{Aq@eBiAkBqAsEsDqCaBqHmCcBs@kCmAmAg@]QkEkBaCqAiL}E{Ak@yC{@wJwBkMwDkFiAyFw@uHo@yEYqCEyYEsWIoUAcGE_HHqC?qn@Q}a@I{BE{DOk]mC_AIqDM{GEiZKcUMoi@OaEEsCOmD_@eBWkAWeSeFeDcA_HaBoSiFyFsB}BaAeD{ASMYK}BsAwHeGiAaA_E_EqAyAQWo@w@_C{CmDcFwGoIsIiMqEcGo@w@sDwEiKkNaBaC_GeIsDqEs`@ei@mC{CwBuBqAiA_CkBcCaByA}@qy@md@mDaCsAeAqAiAoDmD_SkUyC}CoAiAy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@|@n@`@Rf@Nf@Hh@BtFKtFSpJc@N@hX@nDAlA@lDLxGHxa@B|PAbBInAMj@O`EoAxA_@xAUn@CzC@pSb@fNTdBAd@Cj@GvAYxAe@rAm@lA}@fAeAbAoA`SaYfAqAnAeAj@]xAq@|A_@`BS`BKnBApPNbEBrFHvPP|D?`AIjBUlAUd@IjAWj@IzBOpC?|A`@~IfBbIz@hGXZB?u["
      }'
    
    # OR
    
    # Find tolls using Google Maps algorithm polyline
    curl -X POST "https://dev.tollguru.com/v1/calc/route" \
      -H "x-api-key: developer_key" \
      -d '{
        "vehicleType": "2AxlesAuto",
        "source": "gmaps",
        "polyline": "sp`gEtrxmQ[wBMcA??d@ItA[??jAxAt@dAJJr@~@NRV\\??J?RDRL\\RVRZ^NNPTR\\P\\P\\LXLV@BVf@Zh@Zj@VTTZV^PVRTHJLRVTpBnCf@t@\\^p@`Ad@r@LPBBBDDDj@t@JPFHFHP^Xv@??Ld@??Lj@Lh@FZD^D`@Fz@??Bp@A~@Ev@It@Oz@YjAe@|A??O`@m@lBm@jBaA`Cg@jA}@bBq@dAo@x@m@d@w@d@{@XKDe@HaAJy@H[FiBPq@F[DkAJw@Hg@DyC\\E@CBMN??iEVM@Q@Q@S?SBeAHcAJyBNmBJcAD}AD_D@cB@[?iA@w@@g@@s@B{@Dy@D}@DG@A?O@I?A??@a@BgAFyCPuAJK@K?M@]DSDUBSDWD}@TaAR{@RaAReATkAT}@PcARaAR}@R{@Pk@Ju@NWF}AZoDt@iCf@gE~@QDYHE@??[GGAMBmATi@Li@Hi@FsB^aAT_@HWB[?q@C]A]CG?WAEAC?[Ag@Ee@EC?o@EE?A?KAQAGAYAI?AAE?c@GM?C?A?A?C?E?QBYHG@EBC@CBKHa@`@cB`B_@X[N]NWHSFSFI@K@YDkAP]DSJ}@N{@Ly@NgBTqAPuHdAmAVq@Lg@Hs@NqAV}@R_@F[FI@O@E@QBgAJ_BJ_BJeABs@@mABkA@yCAs@ASAYAo@EkCQaEWg@EeH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Ck@Ok@IMCOAUAeAE??[A?t@?v@?j@?l@?fE?n@?BA`AA|B?`A?p@AhB?b@@dC@~B?b@?l@?`B???X?bBAx@?bB??qA?}@Ac@?eBAa@?mBAuAAI?wAAyA?U?gBAO?{A@[@uAB_D@yFC??@W?mB"
      }'
    
    const unirest = require('unirest');
    
    // Find tolls using set of geocoordinate points from HERE maps
    unirest.post("https://dev.tollguru.com/v1/calc/route")
    .headers({"x-api-key": "developer_key"})
    .send({ 
        "vehicleType": "2AxlesAuto",
        "source": "here",
        "path": "32.94909,-96.8233|...|32.95043,-96.82314"
     })
    .end(function (response) {
      console.log(response.body);
    });
    
    // OR
    
    // Find tolls using set of geocoordinates converted to polyline first (Google algorithm polyline compresses set of geocoordinates into a smaller string, hence it is preferred)
    unirest.post("https://dev.tollguru.com/v1/calc/route")
    .headers({"x-api-key": "developer_key"})
    .send({
        "vehicleType": "2AxlesAuto",
        "source": "here",
        "polyline": "gtagEndxmQMcAmCf@_ARGAe@DMAi@]_@oCu@mEs@gEq@SiDc@mAAuCXeCJqBB_@?c@CyA@]BcARoADe@Fa@L{BnAi@L}CZiBLsJ\\cBA}GRiGLeBHiBRoDLeGHoMAkEJoBLgGTuBDgB?sCIgAIcBQyA[}Bk@qDoAsEiBeH_DwJ}D}GsCoGsCqMqGyD_B_I{CsIaE{@]yBu@aK{CgFyBuFsCqFgDcFkCmBq@uCo@wJkBeBa@}Ak@{Aq@eBiAkBqAsEsDqCaBqHmCcBs@kCmAmAg@]QkEkBaCqAiL}E{Ak@yC{@wJwBkMwDkFiAyFw@uHo@yEYqCEyYEsWIoUAcGE_HHqC?qn@Q}a@I{BE{DOk]mC_AIqDM{GEiZKcUMoi@OaEEsCOmD_@eBWkAWeSeFeDcA_HaBoSiFyFsB}BaAeD{ASMYK}BsAwHeGiAaA_E_EqAyAQWo@w@_C{CmDcFwGoIsIiMqEcGo@w@sDwEiKkNaBaC_GeIsDqEs`@ei@mC{CwBuBqAiA_CkBcCaByA}@qy@md@mDa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ECnBMrDYpG?p@Dp@N~@\\`APXXd@|@n@`@Rf@Nf@Hh@BtFKtFSpJc@N@hX@nDAlA@lDLxGHxa@B|PAbBInAMj@O`EoAxA_@xAUn@CzC@pSb@fNTdBAd@Cj@GvAYxAe@rAm@lA}@fAeAbAoA`SaYfAqAnAeAj@]xAq@|A_@`BS`BKnBApPNbEBrFHvPP|D?`AIjBUlAUd@IjAWj@IzBOpC?|A`@~IfBbIz@hGXZB?u["
      })
    .end(function (response) {
      console.log(response.body);
    });
    
    // OR
    
    // Find tolls using Google Maps polyline
    unirest.post("https://dev.tollguru.com/v1/calc/route")
    .headers({"x-api-key": "developer_key"})
    .send({ 
        "vehicleType": "2AxlesAuto",
        "source": "here",
        "polyline": "sp`gEtrxmQ[wBMcA??d@ItA[??jAxAt@dAJJr@~@NRV\\??J?RDRL\\RVRZ^NNPTR\\P\\P\\LXLV@BVf@Zh@Zj@VTTZV^PVRTHJLRVTpBnCf@t@\\^p@`Ad@r@LPBBBDDDj@t@JPFHFHP^Xv@??Ld@??Lj@Lh@FZD^D`@Fz@??Bp@A~@Ev@It@Oz@YjAe@|A??O`@m@lBm@jBaA`Cg@jA}@bBq@dAo@x@m@d@w@d@{@XKDe@HaAJy@H[FiBPq@F[DkAJw@Hg@DyC\\E@CBMN??iEVM@Q@Q@S?SBeAHcAJyBNmBJcAD}AD_D@cB@[?iA@w@@g@@s@B{@Dy@D}@DG@A?O@I?A??@a@BgAFyCPuAJK@K?M@]DSDUBSDWD}@TaAR{@RaAReATkAT}@PcARaAR}@R{@Pk@Ju@NWF}AZoDt@iCf@gE~@QDYHE@??[GGAMBmATi@Li@Hi@FsB^aAT_@HWB[?q@C]A]CG?WAEAC?[Ag@Ee@EC?o@EE?A?KAQAGAYAI?AAE?c@GM?C?A?A?C?E?QBYHG@EBC@CBKHa@`@cB`B_@X[N]NWHSFSFI@K@YDkAP]DSJ}@N{@Ly@NgBTqAPuHdAmAVq@Lg@Hs@NqAV}@R_@F[FI@O@E@QBgA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?eDEeAA_@CmAO[I[Ia@IOGYMWMy@c@??eCsAg@U_@KGCk@Ok@IMCOAUAeAE??[A?t@?v@?j@?l@?fE?n@?BA`AA|B?`A?p@AhB?b@@dC@~B?b@?l@?`B???X?bBAx@?bB??qA?}@Ac@?eBAa@?mBAuAAI?wAAyA?U?gBAO?{A@[@uAB_D@yFC??@W?mB"
     })
    .end(function (response) {
      console.log(response.body);
    });
    
    // Find tolls using Google Maps polyline
    import requests
    
    Tolls_Key = 'developer_key'
    Tolls_URL = 'https://dev.tollguru.com/v1/calc/route'
    headers = {
                'Content-type': 'application/json',
                'x-api-key': Tolls_Key
              }
    params = {
                'vehicleType': '2AxlesAuto',
                'source': 'here',
                'polyline': 'gtagEndxmQMcAmCf@_ARGAe@DMAi@]_@oCu@mEs@gEq@SiDc@mAAuCXeCJqBB_@?c@CyA@]BcARoADe@Fa@L{BnAi@L}CZiBLsJ\\cBA}GRiGLeBHiBRoDLeGHoMAkEJoBLgGTuBDgB?sCIgAIcBQyA[}Bk@qDoAsEiBeH_DwJ}D}GsCoGsCqMqGyD_B_I{CsIaE{@]yBu@aK{CgFyBuFsCqFgDcFkCmBq@uCo@wJkBeBa@}Ak@{Aq@eBiAkBqAsEsDqCaBqHmCcBs@kCmAmAg@]QkEkBaCqAiL}E{Ak@yC{@wJwBkMwDkFiAyFw@uHo@yEYqCEyYEsWIoUAcGE_HHqC?qn@Q}a@I{BE{DOk]mC_AIqDM{GEiZKcUMoi@OaEEsCOmD_@eBWkAWeSeFeDcA_HaBoSiFyFsB}BaAeD{ASMYK}BsAwHeGiAaA_E_EqAyAQWo@w@_C{CmDcFwGoIsIiMqEcGo@w@sDwEiKkNaBaC_GeIsDqEs`@ei@mC{CwBuBqAiA_CkBcCaByA}@qy@md@mDaCsAeAqAiAoDmD_SkUyC}CoAiAyBkBsAaAsA{@oDuB}N}HyYaPyE_CmDuAgGyBmc@uOgKqD{E}AcFgAcBWiEe@iQwAqHg@s@EeHm@gKy@YEoHk@yJm@y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d@Cj@GvAYxAe@rAm@lA}@fAeAbAoA`SaYfAqAnAeAj@]xAq@|A_@`BS`BKnBApPNbEBrFHvPP|D?`AIjBUlAUd@IjAWj@IzBOpC?|A`@~IfBbIz@hGXZB?u['
            }
    response = requests.post(Tolls_URL, json=params, headers=headers)
    
    

    The above POST request returns JSON structured like the following:

    {
        "status": "OK",
        "summary": {
            "rates": {
                "USD": 1,
                "CAD": 1.33,
                "MXN": 20.26,
                "INR": 67.79
            },
            "departure_time": 1551405156,
            "source": "here"
        },
        "route": {
            "hasTolls": true,
            "costs": {
                "tag": 1.92,
                "cash": false,
                "licensePlate": 2.95,
                "prepaidCard": 1.92,
                "creditCard": false
            },
            "tolls": [
                {
                    "type": "barrier",
                    "tagCost": 1.56,
                    "cashCost": false,
                    "licensePlateCost": 2.34,
                    "prepaidCardCost": 1.56,
                    "creditCartCost": false,
                    "currency": "USD",
                    "tagPrimary": "TxTag",
                    "tagSecondary": "TollTag, EZ TAG, K-TAG, PikePass",
                    "licensePlatePrimary": false,
                    "licensePlateSecondary": false,
                    "id": 130000,
                    "lat": 32.81413076,
                    "lng": -96.81762628,
                    "name": "Wycliff Main Lane Gantry (MLP1)",
                    "state": "Texas"
                },
                {
                  ...
                }
            ],
            "tagPrimary": "TxTag",
            "tagSecondary": [
                "TollTag",
                "EZ TAG",
                "K-TAG",
                "PikePass"
            ],
            "licensePlatePrimary": "ZipCash",
            "licensePlateSecondary": [
                "Pay By Mail"
            ]
        }
    }
    

    The response endpoint retrieves all tolls on the single route requested. You will not receive tolls for alternate routes possible between the origin and destination.

    HTTP Request

    POST https://dev.tollguru.com/v1/calc/route

    Request Parameters

    Parameter Type Default Description
    source String here Optional
    Specify route source, either here for HERE maps routes based polyline or gmaps for Google Maps polylines
    polyline String empty Required (either a polyline or a path)
    Specify route as Google Maps encoded polyline (see details)
    path String empty Required (either a polyline or a path)
    Specify route as a set of comma-separated lat,lng coordinates delimited by a pipe character (|)
    vehicleType String 2AxlesAuto Optional
    Vehicle type
    departure_time String or Number 2019-02-28T22:30:00 or 1551399000 Optional
    Departure time
    UNIX time or
    time in ISO 8601 format

    Response Parameters

    The response JSON from the Toll API returns the following:

    Parameter Type Description
    rates Object Currency exchange rates (See Rates object)
    route Object Route information including tolls (See Routes object)
    departure_time Number Departure time in UNIX time

    3. GPS traces/tracks

    You want to use this request when you have have vehicle's GPS traces. You can upload the GPS traces (as CSV files) and receive tolls for the GPS trace. In the first stage, a route polyline is constructed from the GPS traces.

    As you know, the GPS traces can be pretty sparse (say the fleet GPS reading is every three minutes). GPS traces can have measurement errors. The US government commits to broadcasting the GPS signal in space with a global average user range error (URE) of ≤25.6 ft. with 95% probability. In practice we see GPS traces everywhere but the road, including opposite side of the road. Therefore, Tollguru first constructs a route polyline specific to the vehicle type. For example, express lanes and general purpose lanes may be contiguous and 5-axle semi may not be allowed to travel on the express lane. Therefore, the route polyline for the 5-axle semi may be different than a taxi sedan. In the second stage, tolls are returned for the constructed polyline (even for locations where tolls change based on time of the day).

    The tolls are specific to vehicle specified. If the vehicle travels on a toll road (such as Pennsylvania turnpike) where the tolls depend on axles and vehicle weight, tolls are returned for the specific weight.

    Since you pass on the GPS traces for a route, you will receive toll information for the particular route. You will not receive tolls for alternate routes possible between the origin and destination.

    GPS traces can be passed in the following format

    The first line in the CSV needs to contain the attribute names. The subsequent lines needs to contain the data in temporal order. The following parameters are available:

    Parameter Description
    latitude Latitude coordinate in WGS84 degree (mandatory)
    longitude Longitude coordinate in WGS84 degree (mandatory)
    timestamp indicates the time and date, for example  2018-05-21T17:05:06Z (mandatory since tolls may change based on time)
    speed_mps speed in meters per second (optional)
    speed_mph speed in miles per hour (optional)
    speed_kmh speed in kilometers per hour (optional)
    heading heading in degrees clockwise from North (optional)

    We prefer CSV files since they are faster to process. If the kml files are not written well, timestamp may be passed correctly. Therefore, tolls may be inaccurate at toll plazas where tolls vary by time.

    # Find tolls using GPS traces 
    curl -X POST "https://dev.tollguru.com/v1/calc/route/upload" \
        -H “x-api-key:developer_key” \
        --data-binary '{
        "path": "@/path-to-csv-file-on-your-computer/yourfile.csv or /yourfile.kml", 
        "vehicleType": "2AxlesTruck",
        "vehicleName": "yourVehicleName",
        "height": "vehicleHeight",
        "weight": "vehicleWeight"
      }'
    
    
    const unirest = require('unirest');
    
    // Find tolls using GPS traces 
    unirest.post("https://dev.tollguru.com/v1/calc/route/upload")
    .headers({"x-api-key": "developer_key"})
    .send({ 
        "path": "@/path-to-csv-file-on-your-computer/yourfile.csv or /yourfile.kml",
        "vehicleType": "2AxlesTruck",
        "vehicleName": "yourVehicleName",
        "height": "vehicleHeight",
        "weight": "vehicleWeight"
     })
    .end(function (response) {
      console.log(response.body);
    });
    
    

    The above POST request returns JSON structured like the following:

    {
        "status": "OK",
        "summary": {
            "rates": {
                "USD": 1,
                "CAD": 1.334555,
                "MXN": 19.206204,
                "INR": 68.96304
            },
            "departure_time": 1526903080,
            "departure_time_formatted": "2018-05-21T11:44:40Z",
            "vehicleType": "2AxlesTruck",
            "vehicleName": "myTruck",
            "source": "HERE",
            "share": {
                "prefix": "route",
                "uuid": "7ff440c2-34e6-4e4e-855e-e6478a5b9092"
            },
            "uploaded": "https://s3.us-east-2.amazonaws.com/tollguru-service/results/7ff440c2-34e6-4e4e-855e-e6478a5b9092-upload.txt",
            "parsed": "https://s3.us-east-2.amazonaws.com/tollguru-service/results/7ff440c2-34e6-4e4e-855e-e6478a5b9092-parsed.json"
        },
        "route": {
            "hasTolls": true,
            "costs": {
                "tag": 1.92,
                "cash": false,
                "licensePlate": 2.95,
                "prepaidCard": 1.92,
                "creditCard": false
            },
            "tolls": [
                {
                    "type": "barrier",
                    "tagCost": 1.56,
                    "cashCost": false,
                    "licensePlateCost": 2.34,
                    "prepaidCardCost": 1.56,
                    "creditCartCost": false,
                    "currency": "USD",
                    "tagPrimary": "TxTag",
                    "tagSecondary": "TollTag, EZ TAG, K-TAG, PikePass",
                    "licensePlatePrimary": false,
                    "licensePlateSecondary": false,
                    "id": 130000,
                    "lat": 32.81413076,
                    "lng": -96.81762628,
                    "name": "Wycliff Main Lane Gantry (MLP1)",
                    "state": "Texas"
                },
                {
                  ...
                }
            ],
            "tagPrimary": "TxTag",
            "tagSecondary": [
                "TollTag",
                "EZ TAG",
                "K-TAG",
                "PikePass"
            ],
            "licensePlatePrimary": "ZipCash",
            "licensePlateSecondary": [
                "Pay By Mail"
            ]
        }
    }
    

    Request Parameters

    Parameter Type Default Description
    path String empty Required
    Specify the folder location on your computer where CSV file is stored
    vehicleType String 2AxlesAuto Required
    Vehicle type
    vehicleName String empty Optional
    Specify name for your vehicle to identify the response json for particular vehicle
    height String empty Optional
    Specify the vehicle height to get accurate tolls for toll roads where tolls depend on axles and vehicle height
    weight String empty Optional
    Specify the vehicle weight to get accurate tolls for toll roads where tolls depend on axles and vehicle weight

    Response Parameters

    The response JSON from the Toll API returns the following:

    Parameter Type Description
    rates Object Currency exchange rates (See Rates object)
    route Object Route information including tolls (See Routes object)
    departure_time Number Departure time in UNIX time

    Request/Response Objects

    Location object

    Parameter Type Default Description
    address String empty Optional
    Specify as string, such as Toronto, Ontario, Canada
    place_id String empty Optional
    Specify as Google Place ID string, such as ChIJlTlXssSPxokROy60gaOlloQ
    lat Number empty Optional
    Specify as geo-coordinates (latitude)
    lng Number empty Optional
    Specify as geo-coordinates (longitude)

    lat and lng parameters are both required when you specify a Location as geo-coordinates.

    Vehicle types

    Car, SUV with two-tires on the rear axle

    SUV or pick-up with four-tires on the rear axle (dual tire)

    Trucks

    Bus

    Motorcycles

    RV/Motorhome

    Vehicle classes supported in India

    Fuel efficiency parameters

    If you want an accurate estimate of fuel expenses, you will need to specify parameters specific to fuel price and fuel efficiency as fuelEfficiency object.

    Parameter Type Default Description
    city Number 23.4 Optional
    hwy Number 29.25 Optional
    units String mpg Optional
    Specify as mpg (miles per gallon), kmpl (kilometers per liter) or l100 (liters per 100 km)

    Truck parameters

    Parameter Type Description
    truckType String Optional
    Specifies the vehicle type
    Enum [truck | tractorTruck]
    Defaults to truck
    Note: Relevant for restrictions that apply exclusively to tractors with semi-trailers (observed in North America). Such restrictions are taken into account only in case of the truckType set to tractorTruck and the trailers count greater than 0 (for example truckType: "tractorTruck", trailersCount: 1). The truck type is irrelevant in case of restrictions common for all types of trucks.
    trailersCount Number Optional
    Specifies number of trailers pulled by a vehicle. The provided value must be between 0 and 4.
    Defaults to 0
    shippedHazardousGoods String Optional
    List of hazardous materials in the vehicle. The names correspond to HAZMAT classes 1 to 9.
    For example, explosive is Class 1 and so on.

    Enum [explosive | gas | flammable | combustible | organic | poison | radioActive | corrosive | miscellaneous]
    limitedWeight Number Optional
    Vehicle weight including trailers and shipped goods, in pounds.
    If truck weight is not specified, incorrect tolls may be calculated for trucks on Pennsylvania turnpike and other toll locations where tolls are based on weight.
    weightPerAxle Number Optional
    Vehicle weight per axle in pounds.
    If truck weight is not specified, incorrect tolls may be calculated for trucks on Pennsylvania turnpike and other toll locations where tolls are based on weight.
    height Number Optional
    Vehicle height in feet. The provided value must be between 0 and 50.
    If vehicle height is not specified, incorrect tolls may be calculated on New York Thruway and other toll roads where tolls are based on axles and weight.
    width Number Optional
    Vehicle width in feet. The provided value must be between 0 and 50.
    length Number Optional
    Vehicle length in feet. The provided value must be between 0 and 300.
    tunnelCategory String Optional
    Specifies the tunnel category to restrict certain route links. The route will pass only through tunnels of a less strict category.
    Enum [ B | C | D | E ]
    truckRestrictionPenalty String Optional
    Specifies the penalty type on violated truck restrictions.
    Enum [ strict | soft ]
    strict: route will not use links with a violated truck restriction at any circumstances
    Note: Route computation will fail and return NoRouteFound if not able to avoid the links with a violated truck restriction and the penalty type is strict.
    soft: route will use links with a violated truck restriction if there is no alternative to avoid them
    Defaults to strict

    Driver Wage parameters

    You need to specify parameters in driver object to estimate driver wages. You can also specify your value of time. For example, if you are willing to spend $2.00 to save 15 minutes (but not a penny more) for a particular trip, your value of time is $2.00* (60/15) = $8.00 per hour.

    Parameter Type Default Description
    wage Number 30 Optional
    Driver wage per hour
    rounding Number 30 Optional
    How is the driver time is rounded (to 30 minutes, an hour, etc.)?
    valueOfTime Number 0 Optional
    If driver wages are specified, do not add value of time. If value of time is specified, it is assumed you are the driver and not being paid for the time. Driver wage calculations will not be returned.

    Route object

    The route object specifying origin and destination as strings, Google Place ID, and geo-coordinate pairs (latitude and longitude) and all other information for all the routes (See Routes object)

    Rates object

    Rates object that specifies conversion factors between currencies with US Dollar as base. It is useful when you are looking for tolls between countries. Say you are looking for tolls between Toronto, Canada, and Monterrey, Mexico. Some of the tolls are in Canadian dollars, some in USD and others in Mexican Pesos. The total costs are specified in one currency using the conversion factors. The conversion factors are based on dynamic exchange rates.

    Routes object

    Routes object for each route containing the following information

    Costs object

    Costs object summarizes the toll cost and the fuel cost for the route. The fuel costs calculated from fuel efficiency (city fuel effiency and highway fuel efficiency) and the speeds on each leg of the route.

    The tolls are added for all the tolls on the route for each payment type. If a payment type cannot be using on all the toll points on the route, the toll cost is returned as false. Else, the sum of tolls for the payment type is returned.

    The tolls are returned for the following payment types:

    Tolls object

    Tolls object contains tolls for all the toll locations on the route. For each toll location, the following parameters are returned:

    Parameter Description
    type Toll type:
    barrier (for example toll roads in Texas ),
    ticketSystem - ticket system (for example toll roads in Oklahoma),
    distBased – distance based (for example ETR 407 in Ontario, Canada).
    tagCost Transponder toll cost
    For example, E-ZPass, TxTag, FasTrak, SunPass, FasTrak, ExpressToll, etc.
    cashCost Cash toll cost
    licensePlateCost License plate (video) toll cost. For example, Pay by Plate in California, ZipCash and Pay by Mail in Texas, Pay by Plate in Florida, License Plate Toll in Colorado, Camera Charges on ETR-407, etc.
    prepaidCardCost Prepaid card such as Nexpress, Nexus Card, etc. toll cost
    creditCardCost Credit card toll cost
    currency Currency
    tagPrimary A primary transponder that can be used on the facility. Typically primary transponders have discounts for each usage or based on volume.
    tagSecondary All other transponders that can be used on the facility. Secondary transponders may not count towards discounts
    licensePlatePrimary Name of the primary license plate toll (video toll) collection system. Typically license Plate tolls are not discounted.
    licensePlateSecondary Name of the secondary license plate toll (video toll) collection system
    id Tollguru toll ID. Useful for error checking
    lat Approximate latitude of the toll location
    lng Approximate longitude of the toll location
    name Name of the toll location
    road Name of the toll road
    state State, province of the toll location

    Driver object

    Driver object summarizes the driver cost for the route:

    Parameter Description
    billedHours Driver billing time in hours (rounded to the units you specify in request).
    wage Driver wage rate per hour specified in the request.
    valueOfTime Value of Time specified in the request.
    If value of time is specified, driver wage calculations are ignored
    total Driver wages for the route.
    Or dollar value assigned to your value of time.
    Value of time is calculated by calculating the difference in travel time between the given route and the fastest route and multiplying that by value of time.
    Say the given route is 15 minutes slower compared to the fastest route, the dollar value is (difference in travel time) times the value of time.

    Errors

    The TollGuru API uses the following error codes:

    Error Code Meaning
    400 Bad Request – Your request is invalid.
    401 Unauthorized – Your API key is wrong.
    403 Forbidden – The action requested is hidden for administrators only.
    404 Not Found – The specified action could not be found.
    405 Method Not Allowed – You tried to access an action with an invalid method.
    406 Not Acceptable – You requested a format that isn't json.
    410 Gone – The action requested has been removed from our servers.
    418 I'm a teapot.
    429 Too Many Requests – You're requesting too often! Please slow down!
    500 Internal Server Error – We had a problem with our server. Try again later.
    503 Service Unavailable – We're temporarily offline for maintenance. Please try again later.