Toll

Example – Billing by segment

This example is specific to roads where billing is conducted by segment—that is, by the combination of an entry and an exit gantry. Thus, the returned value will be proportional to the number of kilometers driven on the road.

For these cases, the type field will return the following options:

  • ENTRY_GANTRY – Entry gantries;
  • EXIT_GANTRY – Exit gantries.

Values, conditional values, and integration codes will always be returned at the exit gantries, with a reference to the corresponding entry gantry, as shown in the examples below.

Note: If the route passes only through the exit gantry without any entry gantry for reference, the returned value and integration code will correspond to the segment with the highest possible value.

Request

In the request, it will be necessary to add the billing parameter with the value FREE_FLOW so that the gantries are returned. In the example below, the route passes through an entry gantry and an exit gantry, located on the Presidente Dutra highway in Brazil.

Request with Independent Endpoint

{
    "legs": [
        {
            "vehicleType": "CAR",
            "points": "`|_nChbjzGdDjK`AvApCrIp\\veAlQtj@jI~WxCjJbS`o@zAvEl@tBFb@x@nCVbArApE"
        }
    ],
    "billing": "FREE_FLOW"
}

Request with the Trip API

{
  "calculationMode": "THE_FASTEST",
  "points": [
    {
      "siteId": "PFE001",
      "latitude": -23.4337710259116,
      "longitude": -46.42357024290983
    },
    {
      "siteId": "PFS001",
      "latitude": -23.450549018021594,
      "longitude": -46.463470746954336
    }
  ],
  "toll": {
    "vehicleType": "CAR",
    "billing": "FREE_FLOW"
  }
}

Response

As in the previous examples, tollCosts contains the total value of tolls for the entire route. Each leg will return a tollCalculation object containing a tolls object with the values and information for each toll in the corresponding segment, as well as the legTotalCost, which shows the total cost of tolls for that specific leg.

Within each object in tolls, we will have the information for each toll, with the following differences:

  • For the entry gantry, ENTRY_GANTRY, the value returned in price will always be 0. Additionally, no integration code will be returned in the serviceTypes field.
  • For the exit gantry, EXIT_GANTRY, the values and integration codes will be returned normally. This data does not refer to the gantry itself, but rather to the segment between the entry gantry and the exit gantry.

The following fields will also be returned:

  • entryGantryId – ID of the corresponding entry gantry;
  • entryGantryName – Name of the corresponding entry gantry;
  • segmentId -ID referring to the segment composed of the entry and exit gantries. It corresponds to the IDs of both gantries concatenated.

Response with Independent Endpoint

{
    "legs": [
        {
            "tolls": [
                {
                    "id": "3700",
                    "type": "ENTRY_GANTRY",
                    "name": "PFE001 - Jd. Maria Dirce (km 211)",
                    "address": "Jd. Maria Dirce (km 211)",
                    "city": "Guarulhos",
                    "state": {
                        "name": "SP",
                        "code": "SP"
                    },
                    "country": "Brasil",
                    "concession": "CCR RioSP",
                    "direction": "SOUTH",
                    "coordinates": {
                        "latitude": -23.43484679,
                        "longitude": -46.42587454
                    },
                    "serviceTypes": [],
                    "price": 0
                },
                {
                    "id": "3709",
                    "type": "EXIT_GANTRY",
                    "name": "PFS001 - Aeroporto (km 215)",
                    "address": "Aeroporto (km 215)",
                    "city": "Guarulhos",
                    "state": {
                        "name": "SP",
                        "code": "SP"
                    },
                    "country": "Brasil",
                    "concession": "CCR RioSP",
                    "direction": "SOUTHWEST",
                    "coordinates": {
                        "latitude": -23.45011179,
                        "longitude": -46.46236207
                    },
                    "serviceTypes": [
                        {
                            "serviceId": "1148",
                            "name": "Via Facil"
                        }
                    ],
                    "price": 1.54,
                    "segmentId": "37003709",
                    "entryGantryId": "3700",
                    "entryGantryName": "PFE001 - Jd. Maria Dirce (km 211)"
                }
            ],
            "legTotalCost": 1.54,
            "vehicleType": "CAR",
            "calculationDate": 1765906825592
        }
    ],
    "totalCost": 1.54
}

Response with the Trip API

{
    "id": "6941b7a2ad10b369362d622a",
    "clientId": "maplink",
    "totalDistance": 4480,
    "totalNominalDuration": 184,
    "averageSpeed": 75.15,
    "tollCosts": 1.54,
    "legs": [
        {
            "distance": 4479,
            "nominalDuration": 184,
            "averageSpeed": 75.15,
            "points": "`|_nChbjzGdDjK`AvApCrIp\\veAlQtj@jI~WxCjJbS`o@zAvEl@tBFb@x@nCVbArApE",
            "tollCalculation": {
                "tolls": [
                    {
                        "id": "3700",
                        "type": "ENTRY_GANTRY",
                        "name": "PFE001 - Jd. Maria Dirce (km 211)",
                        "address": "Jd. Maria Dirce (km 211)",
                        "city": "Guarulhos",
                        "state": {
                            "name": "SP",
                            "code": "SP"
                        },
                        "country": "Brasil",
                        "concession": "CCR RioSP",
                        "direction": "SOUTH",
                        "coordinates": {
                            "latitude": -23.43484679,
                            "longitude": -46.42587454
                        },
                        "serviceTypes": [],
                        "price": 0
                    },
                    {
                        "id": "3709",
                        "type": "EXIT_GANTRY",
                        "name": "PFS001 - Aeroporto (km 215)",
                        "address": "Aeroporto (km 215)",
                        "city": "Guarulhos",
                        "state": {
                            "name": "SP",
                            "code": "SP"
                        },
                        "country": "Brasil",
                        "concession": "CCR RioSP",
                        "direction": "SOUTHWEST",
                        "coordinates": {
                            "latitude": -23.45011179,
                            "longitude": -46.46236207
                        },
                        "serviceTypes": [
                            {
                                "serviceId": "1148",
                                "name": "Via Facil"
                            }
                        ],
                        "price": 1.54,
                        "segmentId": "37003709",
                        "entryGantryId": "3700",
                        "entryGantryName": "PFE001 - Jd. Maria Dirce (km 211)"
                    }
                ],
                "legTotalCost": 1.54,
                "vehicleType": "CAR",
                "calculationDate": 1765914530047
            },
            "arrivalSiteId": "PFS001",
            "departureSiteId": "PFE001"
        }
    ],
    "source": "MAPLINK",
    "createdAt": 1765914530046,
    "expiryIn": 1766519330046
}

Example Brazil – Presidente Dutra Highway Gantries

The example below is of a route that passes through the Presidente Dutra Highway, where entry and exit gantries were installed on the access ramps to the main road. The route enters the main road through entry gantry PFE001 and leaves the highway passing through exit gantry PFS002.

Route on the Presidente Dutra Highway, between gantries PFE001 and PFS002.

The complete request can be found below:

{
  "points": [
    {
      "siteId": "PFE001",
      "latitude": -23.4337710259116,
      "longitude": -46.42357024290983
    },
    {
      "siteId": "PFS002",
      "latitude": -23.496393062325655,
      "longitude": -46.55864556656767
    }
  ],
  "toll": {
    "vehicleType": "CAR",
    "billing": "FREE_FLOW"
  }
}

The response will be returned as shown in the example below:

{
    "id": "693c7582ad10b369362c6eb4",
    "clientId": "maplink",
    "totalDistance": 15549,
    "totalNominalDuration": 638,
    "averageSpeed": 67.68,
    "tollCosts": 3.09,
    "legs": [
        {
            "distance": 15548,
            "nominalDuration": 638,
            "averageSpeed": 67.68,
            "points": "`|_nChbjzGdDjK`AvApCrIp\\veAlQtj@jI~WxCjJbS`o@zAvEl@tB`HnTvLb`@hC|HbOne@nD~KfHhU|Olj@hAhEjAtErBnIzCpL`D`M|E|QbIb[nA`FfBlIpBzJvDpQpBxIhB~GnAtDdCxGzAtDl@rApCpFrZhj@hJnPjd@hy@jRx]~MpUlL`R`I|LJf@dDhFxCzERb@N^D\\@\\A^C\\CNG\\MZ_@t@",
            "tollCalculation": {
                "tolls": [
                    {
                        "id": "3700",
                        "type": "ENTRY_GANTRY",
                        "name": "PFE001 - Jd. Maria Dirce (km 211)",
                        "address": "Jd. Maria Dirce (km 211)",
                        "city": "Guarulhos",
                        "state": {
                            "name": "SP",
                            "code": "SP"
                        },
                        "country": "Brasil",
                        "concession": "CCR RioSP",
                        "direction": "SOUTH",
                        "coordinates": {
                            "latitude": -23.43484679,
                            "longitude": -46.42587454
                        },
                        "serviceTypes": [],
                        "price": 0
                    },
                    {
                        "id": "3710",
                        "type": "EXIT_GANTRY",
                        "name": "PFS002 - Av. Aricanduva (km 226)",
                        "address": "Av. Aricanduva (km 226)",
                        "city": "Guarulhos",
                        "state": {
                            "name": "SP",
                            "code": "SP"
                        },
                        "country": "Brasil",
                        "concession": "CCR RioSP",
                        "direction": "SOUTHWEST",
                        "coordinates": {
                            "latitude": -23.49667945,
                            "longitude": -46.55789037
                        },
                        "serviceTypes": [
                            {
                                "serviceId": "1149",
                                "name": "Via Facil"
                            }
                        ],
                        "price": 3.09,
                        "segmentId": "37003710",
                        "entryGantryId": "3700",
                        "entryGantryName": "PFE001 - Jd. Maria Dirce (km 211)"
                    }
                ],
                "legTotalCost": 3.09,
                "vehicleType": "CAR",
                "calculationDate": 1765569922581
            },
            "arrivalSiteId": "PFS002",
            "departureSiteId": "PFE001"
        }
    ],
    "source": "MAPLINK",
    "createdAt": 1765569922581,
    "expiryIn": 1766174722581
}

Example Chile – Autopista Vespucio Oriente Gantries

The example below shows a route passing through the Autopista Vespucio Oriente in Chile. Billing on this highway also occurs via entry and exit gantries. The route below enters the highway through the Bilbao entry gantry and exits the highway through the Los Militares exit gantry.

Route on the Autopista Vespucio Oriente, between the Bilbao and Los Militares gantries.

The complete request can be found below:

{
    "calculationMode": "THE_FASTEST",
    "points": [
        {
            "siteId": "Entrada",
            "latitude": -33.43082390803889, 
            "longitude":-70.57453931798061
        },
        {
            "siteId": "Salida",
            "latitude": -33.41139939529261, 
            "longitude": -70.5802398377345
        }
    ],
    "toll": {
        "vehicleType": "CAR",
        "billing": "FREE_FLOW"
    }
}

The complete response can be found below:

{
    "id": "6941a837ad10b369362d5acb",
    "clientId": "maplink",
    "totalDistance": 2611,
    "totalNominalDuration": 174,
    "averageSpeed": 50.40,
    "tollCosts": 222.00,
    "legs": [
        {
            "distance": 2610,
            "nominalDuration": 174,
            "averageSpeed": 50.4,
            "points": "rm`kExawmL]LWDYDmAJeA@]B[DkGbAg@Hi@Pa@Vu@j@}EtE{NhNgBrAwMfJ}BxAmAn@eGdCmMrEoHrBSFe@@e@Ae@IQGc@UWWKQcA{B_BwESk@s@}Aw@yAgBsD",
            "tollCalculation": {
                "tolls": [
                    {
                        "id": "3570",
                        "type": "ENTRY_GANTRY",
                        "name": "Pórtico - Entrada - Bilbao",
                        "address": "Autopista Vespucio Oriente",
                        "city": " ",
                        "state": {
                            "name": " ",
                            "code": " "
                        },
                        "country": "Chile",
                        "concession": "Autopista Vespucio Oriente",
                        "direction": "NORTH",
                        "coordinates": {
                            "latitude": -33.43067656,
                            "longitude": -70.57460313
                        },
                        "serviceTypes": [],
                        "price": 0
                    },
                    {
                        "id": "3566",
                        "type": "EXIT_GANTRY",
                        "name": "Pórtico - Salida 1: Los Militares",
                        "address": "Los Militares",
                        "city": " ",
                        "state": {
                            "name": " ",
                            "code": " "
                        },
                        "country": "Chile",
                        "concession": "Autopista Vespucio Oriente",
                        "direction": "NORTHEAST",
                        "coordinates": {
                            "latitude": -33.41151269,
                            "longitude": -70.58041115
                        },
                        "serviceTypes": [],
                        "price": 222.00,
                        "segmentId": "35703566",
                        "entryGantryId": "3570",
                        "entryGantryName": "Pórtico - Entrada - Bilbao"
                    }
                ],
                "legTotalCost": 222.00,
                "vehicleType": "CAR",
                "calculationDate": 1765910583099
            },
            "arrivalSiteId": "Salida",
            "departureSiteId": "Entrada"
        }
    ],
    "source": "MAPLINK",
    "createdAt": 1765910583096,
    "expiryIn": 1766515383096
}

Example Mexico – Toluca – Naucalpan Highway

Some highways in Mexico operate under a closed toll system, where the amount to be paid is determined by the distance traveled. This control is carried out via entry and exit gantries or toll booths.

Closed toll system.

The example below is of a route on the Toluca – Naucalpan Highway, managed by the Autovan concessionaire, heading towards Chamapa. The route passes through the entry toll booth in Ayotuxco and ends by passing through the Chamapa toll booth. The amount to be paid at the Chamapa toll booth is determined by which entry toll booth was used previously.

Route on the Toluca – Naucalpan Highway, between the Ayotuxco and Chamapa toll booths.

The complete request for this example can be found below:

{
    "calculationMode": "THE_FASTEST",
    "points": [
        {
            "siteId": "Entrada",
            "latitude": 19.399862645037803,
            "longitude": -99.38104539680072
        },
        {
            "siteId": "Salida",
            "latitude": 19.43470773197662, 
            "longitude": -99.30359266871034
        }
    ],
    "toll": {
        "vehicleType": "CAR",
        "billing": "FREE_FLOW"
    }
}

The complete response can be found below:

{
    "id": "6941b467ad10b369362d6093",
    "clientId": "maplink",
    "totalDistance": 12516,
    "totalNominalDuration": 567,
    "averageSpeed": 62.55,
    "tollCosts": 68.00,
    "legs": [
        {
            "distance": 12515,
            "nominalDuration": 567,
            "averageSpeed": 62.55,
            "points": "c`luBpjq}QEUyA{DQi@i@wBA}EEqAIqAIq@Io@Kg@Oi@[_A[}@Sc@We@_@k@kCuDwBiCgBaBg@c@k@_@kAk@k@Wo@UaBc@mGoAaNaCqB_@iB_@aD_AgBs@mCoAiAk@oAk@}@]{@ScASuAOuAGyDOaAKsAYyAc@}@e@m@_@o@e@e@e@i@m@{@yA[o@Wu@W}@Ka@K{@KgAA}A@s@JsERsGDgEOkBIo@YuAe@uA}@yBsCuGo@cBw@}Cw@oDu@cEq@oDw@mDe@aCm@}CYcA]aA[{@_A_BqEsHWq@_@uAeA_Fs@gCe@aC]iAm@}A_@g@_BiBYY[W_@Ua@Sc@OeA]e@KoAUoAMg@Ci@AmA?k@?wEMwEAk@Ci@I_@EcBc@WIy@a@i@[i@_@g@c@y@_A]e@Yi@_@q@Ws@Ww@Qu@YsBYcEi@uEe@_FGeACwA?_AFaAF_@N_AJ_@JYXu@Ra@Zg@Ze@`AgAb@a@t@q@\\U^U`@S^S`@O`@MfAWfAOdAIfAAfADb@Dl@HpAV`HxBdBd@^Hb@Hb@Fb@Bd@Bb@@b@Ad@Ab@Cb@Gb@Gd@Ib@M^M`Aa@`Ae@^Uz@o@t@u@\\c@R]Va@R_@Pa@Na@^gA|AiL~@qJZeDNaEBcA@aCDkKJgBRgBNq@Lq@Po@d@_BjAaDjBsE`@kA^iAToAHc@Fe@HmA@kAAkACc@IeAKc@W_A[cAQ_@k@iAs@oAaCqCoA}A{BeCaAqAa@q@u@aBSi@iAqD{@}Be@gAUg@Ye@]i@g@k@k@i@}@u@q@a@{@a@q@Uk@Qw@Oy@O{BUmFe@kAOuHq@yCYmD[_BU_C_@gDa@",
            "tollCalculation": {
                "tolls": [
                    {
                        "id": "2723",
                        "type": "ENTRY_GANTRY",
                        "name": "Caseta - Ayotuxco",
                        "address": "Autopista Toluca - Naucalpan  KM 25+092",
                        "city": " ",
                        "state": {
                            "name": "Estado de México",
                            "code": "Estado de México"
                        },
                        "country": "México",
                        "concession": "Autovan",
                        "direction": "NORTHEAST",
                        "coordinates": {
                            "latitude": 19.39990472,
                            "longitude": -99.38092579
                        },
                        "serviceTypes": [],
                        "price": 0
                    },
                    {
                        "id": "1963",
                        "type": "EXIT_GANTRY",
                        "name": "Caseta - Chamapa",
                        "address": "Autopista Toluca - Naucalpan",
                        "city": "Ciudad de México",
                        "state": {
                            "name": "Estado de México",
                            "code": "Estado de México"
                        },
                        "country": "México",
                        "concession": "Autovan",
                        "direction": "NORTH",
                        "coordinates": {
                            "latitude": 19.4345158,
                            "longitude": -99.3035731
                        },
                        "serviceTypes": [],
                        "price": 68.00,
                        "segmentId": "27231963",
                        "entryGantryId": "2723",
                        "entryGantryName": "Caseta - Ayotuxco"
                    }
                ],
                "legTotalCost": 68.00,
                "vehicleType": "CAR",
                "calculationDate": 1765913703702
            },
            "arrivalSiteId": "Salida",
            "departureSiteId": "Entrada"
        }
    ],
    "source": "MAPLINK",
    "createdAt": 1765913703701,
    "expiryIn": 1766518503701
}