NAV Navbar
shell javascript
  • Introduction
  • Authentication
  • Find tolls on routes
  • Errors
  • Introduction

    Welcome to TollGuru Toll REST API 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.

    To get you started, we have created language bindings in JavaScript and Shell. You can view code examples in the dark pane to the right. To switch between the programming languages, use tabs on the top right.

    As you will see, the Toll API accepts GET and POST requests to return toll information based on an origin and destination pair (see location object). You can also pass an array of tracked locations (geo-coordinate pairs as waypoints) along a route, such as those received from a smartphone, car GPS or a fleet GPS device. With the Toll API you can use various parameters to get tolls. 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

    Find tolls on routes

    Find tolls on all routes between a location pair (and waypoints). You want to use this request when you have a pair of coordinates or an array of coordinates but do not have the Google route polyline. In other words, you have locations but not the routes between the location. You will receive all the logical routes between your origin and destination (and waypoints) and tolls and fuel expenses for all those routes.

    Find routes

    Find tolls on routes returned from Google maps or HERE maps.

    The sample POST request should look like the following

    curl -X POST "https://dev.tollguru.com/beta00/calc/here" \    # for HERE Maps routes
    # curl -X POST "https://dev.tollguru.com/beta00/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" }
        ],
        "vehicleType": "2AxlesAuto",
        "fuelPrice": "3",
        "fuelPriceCurrency": "USD",
        "fuelEfficiency": {
          "city": 24,
          "hwy": 30,
          "units": "mpg"
        }
      }'
    
    const unirest = require('unirest');
    
    unirest.post("https://dev.tollguru.com/beta00/calc/gmaps")
    .headers({"x-api-key": "developer_key"})
    .send({ 
      "from": {
        "address": "Main str, Dallas, TX"
      }, 
      "to": {
        "address": "Addison, TX"
      },
      "waypoints": [
        {"address": "Plano, TX"}
        ],
      "vehicleType": "2AxlesAuto",
        "fuelPrice": "3.00",
        "fuelPriceCurrency": "USD",
        "fuelEfficiency": {
            "city": 24,
            "hwy": 30,
            "units": "mpg"
        }
     })
    .end(function (response) {
      console.log(response.body);
    });
    

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

    {
        "status": "OK",
        "summary": {
            "route": [
                {
                    "address": "Main Street District, Dallas, TX, USA",
                    "place_id": "ChIJBXlgQR-ZToYR5XkbUFSkdDE",
                    "location": {
                        "lat": 32.7813791,
                        "lng": -96.7969224
                    }
                },
                {
                    "address": "Addison, TX, USA",
                    "place_id": "ChIJOThsZkohTIYRhvmYx7ZKWeY",
                    "location": {
                        "lat": 32.96179,
                        "lng": -96.82916850000001
                    }
                }
            ],
            "rates": {
                "USD": 1,
                "CAD": 1.33,
                "MXN": 20.26,
                "INR": 67.79
            },
            "departure_time": 1599999999,
            "fuelPrice": {
                "value": 3,
                "currency": "USD"
            },
            "fuelEfficiency": {
                "city": 24,
                "hwy": 30,
                "units": "mpg"
            }
        },
        "routes": [
            {
                "summary": {
                    "distance": {
                        "text": "14.3 mi",
                        "value": 23015
                    },
                    "duration": {
                        "text": "21 min",
                        "value": 1282
                    },
                    "name": "Dallas North Tollway N",
                    "hasTolls": true,
                    "diffs": {
                        "cheapest": 1.72,
                        "fastest": 0
                    }
                },
                "costs": {
                    "fuel": 1.6,
                    "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,
                        "creditCardCost": false,
                        "currency": "USD",
                        "tagPrimary": "TxTag",
                        "tagSecondary": "TollTag, EZ TAG, K-TAG, PikePass",
                        "licensePlatePrimary": false,
                        "licensePlateSecondary": false,
                        "id": 130000,
                        "lat": 32.81415,
                        "lng": -96.81765,
                        "name": "Wycliff Main Lane Gantry (MLP1)",
                        "road": "Dallas North Tollway",
                        "state": "Texas"
                    },
                    {
                      ...
                    }
                ],
                "tagPrimary": "TxTag",
                "tagSecondary": [
                    "TollTag",
                    "EZ TAG",
                    "K-TAG",
                    "PikePass"
                ],
                "licensePlatePrimary": "ZipCash",
                "licensePlateSecondary": [
                    "Pay By Mail"
                ],
                "polyline": "..."
            },
            {
              ...
            }
        ]
    }
    

    This endpoint retrieves all routes for the origin destination pair (including waypoints). You will see tolls and fuel estimates for all the routes returned from Google maps / HERE maps.

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

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

    HTTP Request for trucks, buses, RVs

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

    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
    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

    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

    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
    Enum [explosive | gas | flammable | combustible | organic | poison | radioActive | corrosive | poisonousInhalation | harmfulToWater | other]
    limitedWeight Number Optional
    Vehicle weight including trailers and shipped goods, in tons. The provided value must be between 0 and 1000.
    weightPerAxle Number Optional
    Vehicle weight per axle in tons. The provided value must be between 0 and 1000.
    height Number Optional
    Vehicle height in meters. The provided value must be between 0 and 50.
    width Number Optional
    Vehicle width in meters. The provided value must be between 0 and 50.
    length Number Optional
    Vehicle length in meters. 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

    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)

    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, Toll 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
    tagSecondary All other transponders that can be used on the facility
    licensePlatePrimary Name of the primary license plate toll (video toll) collection system
    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

    Find tolls on a route

    You want to use this request when you have the Google Maps route polyline or set of route points for which you want to know tolls. 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 from the Google Maps polyline.

    # Find tolls using set of points
    curl -X POST "https://dev.tollguru.com/beta00/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 Google Maps polyline
    curl -X POST "https://dev.tollguru.com/beta00/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?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SAoB?o@?uKEwH?yA@oA@eD@M?[?O?MA[?M?yFC_E?c@@e@De@Dc@H]FgG~AkCt@cAVa@Je@JYDi@Fg@Bc@B]@[@yDB??e@EsB@I?Q?[?c@AUAU?G?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"
      }'
    
    const unirest = require('unirest');
    
    // Find tolls using set of points
    unirest.post("https://dev.tollguru.com/beta00/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 Google Maps polyline
    unirest.post("https://dev.tollguru.com/beta00/calc/route")
    .headers({"x-api-key": "developer_key"})
    .send({ 
        "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}AZoD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@LA?A?]Hu@RuA`@s@PYFk@HSDIBg@Ds@D_ABI?cBCc@AUAA?W?SAW?y@?M@{@FM@YD_@Hg@J}DfAy@Pe@Jg@FWDi@@C?U@]?SAoB?o@?uKEwH?yA@oA@eD@M?[?O?MA[?M?yFC_E?c@@e@De@Dc@H]FgG~AkCt@cAVa@Je@JYDi@Fg@Bc@B]@[@yDB??e@EsB@I?Q?[?c@AUAU?G?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);
    });
    

    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": 1599999999,
            "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.81415,
                    "lng": -96.81765,
                    "name": "Wycliff Main Lane Gantry (MLP1)",
                    "road": "Dallas North Tollway",
                    "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.

    HTTP Request

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

    Request Parameters

    Parameter Type Default Description
    vehicleType String 2AxlesAuto Optional
    Vehicle type
    source String gmaps Optional
    Specify route source, either gmaps for Google Maps polylines or here for HERE maps routes
    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 (|)

    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)

    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.