{"id":2626,"date":"2023-12-18T17:13:30","date_gmt":"2023-12-18T17:13:30","guid":{"rendered":"https:\/\/developers.maplink.global\/example-1-independent-endpoint\/"},"modified":"2025-12-16T21:19:53","modified_gmt":"2025-12-16T21:19:53","slug":"response-structure-standalone-endpoint","status":"publish","type":"post","link":"https:\/\/developers.maplink.global\/en\/response-structure-standalone-endpoint\/","title":{"rendered":"Response Structure \u2013 Standalone Endpoint"},"content":{"rendered":"\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p><strong>Note: <\/strong>The independent endpoint <strong>is only recommended if you use third-party routers<\/strong>. If you use the <strong>Trip API<\/strong>, you can get the tolls in the same request.<\/p>\n<\/blockquote>\n\n\n\n<p><\/p>\n\n\n\n<p>In this example, we have a simple route that passes through the Tres Mar\u00edas toll booth in Mexico. We will use the standalone endpoint to calculate the tolls.<\/p>\n\n\n\n<p>The route was generated by <a href=\"https:\/\/developers.google.com\/maps\/documentation\/routes\" data-type=\"link\" data-id=\"https:\/\/developers.google.com\/maps\/documentation\/routes\" rel=\"nofollow\">Google&#8217;s Routes API<\/a> and is in polyline format.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Request<\/h2>\n\n\n\n<p>Since the route was generated by a Google API, you will need to set the parameter <code>source<\/code> to <code>GMAPS<\/code>. If the route was generated by the Trip API, or some other service, you will not need to provide the parameter <code>source<\/code>.<\/p>\n\n\n\n<p>In <code>billing<\/code>, we will define it as <code>FREE_FLOW<\/code>, to obtain the return of both tolls and gantries. If the value is <code>DEFAULT<\/code>, only conventional tolls will be returned.<\/p>\n\n\n\n<p>The parameter <code>legs<\/code> is an array of objects where each object represents a section of the route. In each leg, we must define the parameter <code>points<\/code> , which contains the coordinates that make up the route. In this case, we will have only one leg that corresponds to the entire route. The route coordinates are in string format, encoded as polyline.<\/p>\n\n\n\n<p>In each object contained in <code>legs<\/code>, we will need to inform the type of vehicle used for that section. In the parameter <code>vehicleType<\/code>,  we will define that the route will be carried out with a truck with four double axles, for this we will use the value <code>TRUCK_WITH_FOUR_DOUBLE_AXLES<\/code>. In parameter <code>condition<\/code>, we will inform <code>billingType<\/code> as <code>NORMAL<\/code> and <code>period<\/code> as <code>NORMAL<\/code>.<\/p>\n\n\n\n<p>Below is the full request:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n    \"source\": \"GMAPS\",\n    \"billing\": \"FREE_FLOW\",\n    \"legs\": [\n        {\n            \"vehicleType\": \"TRUCK_WITH_FOUR_DOUBLE_AXLES\",\n            \"condition\": {\n                \"period\": \"NORMAL\",\n                \"billingType\": \"NORMAL\"\n            },\n            \"points\": \"gzwtBnkk|Q_EoAGqDyAKiIh@cID_HcGiA}H_@iLCcHd@wMhAqSTuGbAcO|Dak@vBcJ|FiJtZyTfJ{GrHkExD{BrBEbAZfAxAdLlRbO~WhFtGrJ|FfYzOvGdCfDWpFcCdPgGrFG~H~AtWjG~G~AnD?fB_@~CyBrJiMnTmYvJ}LlEuB~CSpJ\\\\hEeAvGoGnFsHhBiFbBqExCyChGuF~GaDrG{@rGgBtUuJdNiFtOwCzDp@zBdCzAzBjBnAjD`@vKQfCqA`CqE`AcFeA}DwBgEAcDbBmClCkC`@_Dm@iCqCkBaFJkFYwFmE}B{FcBaHTgDjBwCpMsH~EaB~LVrE~@zCvEnAbAfB^dF[nDh@hFpEjPhKbEhArIZ|Hs@tC~@vIrHdIhDlIj@nI@~DfAfB`BvAvD@pGo@`Qf@|F`Sjh@`InTzCnLhAtCrBdClExB~HTdOwExRuG|KsCvRuA~HeC`a@gVxJaFtCObI`@~FhA~CvCbBtFdCzFzDbCxBd@zDAzOOnCj@hFfDfMrJhLtF|g@xQfg@nQbTvHpFrBrD`CtCfDvIpOpOrMlb@b\\\\|NdLjInFxc@fLzKzF|KvGzIdGlCpD|JxZ`ElMnFtKtWnf@dTt`@jKrRxDhEli@na@dE|FdBpFnDxe@rAzPtBnF~EdE|KbDvj@tOvCzAvGrF|GhFpE|@|DUfHsAxE\\\\bG`CtFXlHi@bDf@hGbElJlGbJtB~JWzNcCpGiDrFaJ|EqHlKwJvUmThKmMhC}BhEsAlJ_DlFuE`J_JpB}EpFuTGwFiB_LFeElBuKWyFcDiLi@iK]qTbEcN|EkM|CoDxNsHrH{DtCoEl@{EqA_Zk@sG}A}HiOs_@m@uFnDqPjDaOGiND}MhBkEhEeDzCyCdAgCfDoKlGyIpAgF@{Fm@yLbAqFfF{KxAwJr@cK}CuSv@cKSiG_EyKwAuFWsLDaPt@eA|Ak@rCh@fApB?bBkDbI@rGdUxi@~HtMtA|E`Bhg@vDl`@lAfKdBlFbJxQxChLdGjZtL`[|BzSjZhm@hEhEdMnIhBpC`BlGtE~PxJbJdNzKfDtDdApC`ElMrSjYxQxV|AnFj@tHpBrc@gA~QRjE~AtHhAlFtAxCxAvAnCnAfPh@jFtA~CbCdBrCjAxEFxEC|Nd@xCnBbDnCzAbC`@vEB|DyBdD{Dx@A`Ar@b@xD\\\\xAvKx[lCrJ\\\\Vh@Slw@iGvc@mCNIDIhTmEfScG|CoAi@UeCGYs@rAcC`@o@UOwBd@yC|AoJvBv@vDHb@RhAcAX}@VkBf@\"\n        }\n    ]\n}<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Response<\/h2>\n\n\n\n<p>In the response, we will have the following fields:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>totalCost<\/code>&nbsp;\u2013 Total toll value on the entire route;<\/li>\n\n\n\n<li><code>legs<\/code>&nbsp;\u2013 Array of objects where each object represents a section of the route. Each <strong><em>leg <\/em><\/strong>of the response corresponds to a <strong><em>leg <\/em><\/strong>of the request. The following fields will be returned in each object:\n<ul class=\"wp-block-list\">\n<li><code>tolls<\/code>&nbsp;\u2013 Object with the values \u200b\u200band information for each toll in the corresponding section. Each object returned in tolls represents a toll and will contain the following information:\n<ul class=\"wp-block-list\">\n<li><code>id<\/code>\u00a0\u2013 Unique toll identifier;<\/li>\n\n\n\n<li><code>type<\/code>\u00a0\u2013 Toll type. Possible values \u200b\u200bare:\n<ul class=\"wp-block-list\">\n<li><code>TOLL_BOOTH<\/code>\u00a0\u2013 Conventional toll booths;<\/li>\n\n\n\n<li><code>MUNICIPAL_TOLL_BOOTH<\/code>\u00a0<strong>\u2013\u00a0<\/strong>Similar to\u00a0<code>TOLL_BOOTH<\/code>, serving only to identify that the toll booth is municipal;<\/li>\n\n\n\n<li><code>TOLL_GANTRY<\/code>\u00a0\u2013 Corresponds to conventional gantries;<\/li>\n\n\n\n<li><code>ENTRY_GANTRY<\/code>\u00a0\u2013 This refers to the entrance gantries used on highways with segment-based toll collection;<\/li>\n\n\n\n<li><code>EXIT_GANTRY<\/code>\u00a0\u2013 This refers to exit gantries, used on highways with segment-based toll collection.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><code>name<\/code> &#8211; Toll name;<\/li>\n\n\n\n<li><code>address<\/code>  &#8211; Toll address;<\/li>\n\n\n\n<li><code>city<\/code>  &#8211; Toll city;<\/li>\n\n\n\n<li><code>state<\/code>  &#8211; Object containing the name of the state (<code>name<\/code>) and its acronym (<code>code<\/code>);<\/li>\n\n\n\n<li><code>country<\/code>  &#8211; Toll country;<\/li>\n\n\n\n<li><code>concession<\/code>  &#8211; Concessionaire responsible for the toll;<\/li>\n\n\n\n<li><code>coordinates<\/code>  &#8211; Coordinates (latitude and longitude) of the tollbooth;<\/li>\n\n\n\n<li><code>price<\/code>  &#8211; Price per toll;<\/li>\n\n\n\n<li><code>serviceTypes<\/code> &#8211; Array with codes for integration with automatic payment systems. Currently only available in Brazil:\n<ul class=\"wp-block-list\">\n<li><code>serviceId<\/code> &#8211; Code for integration;<\/li>\n\n\n\n<li><code>name<\/code> &#8211; Description of the service code.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><code>legTotalCost<\/code>&nbsp;\u2013 Total toll value for the section;<\/li>\n\n\n\n<li><code>vehicleType&nbsp;<\/code>\u2013 Type of vehicle considered for the section;<\/li>\n\n\n\n<li><code>calculationDate<\/code>&nbsp;\u2013 Date and time considered for the section, in timestamp format;<\/li>\n\n\n\n<li><code>condition<\/code>&nbsp;\u2013 If the parameter <code>condition<\/code> is used in the request, this object will be returned containing which billingType and period were considered for the leg.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>The full response can be found below:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"json\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">{\n    \"legs\": [\n        {\n            \"tolls\": [\n                {\n                    \"id\": \"1910\",\n                    \"type\": \"TOLL_GANTRY\",\n                    \"name\": \"P\u00f3rtico - Cuicuilco\",\n                    \"address\": \"Anillo Perif\u00e9rico Boulevard Adolfo L\u00f3pez Mateos\",\n                    \"city\": \"Ciudad de M\u00e9xico\",\n                    \"state\": {\n                        \"name\": \"Ciudad de M\u00e9xico\",\n                        \"code\": \"Ciudad de M\u00e9xico\"\n                    },\n                    \"country\": \"M\u00e9xico\",\n                    \"concession\": \" \",\n                    \"direction\": \"EAST\",\n                    \"coordinates\": {\n                        \"latitude\": 19.30299684,\n                        \"longitude\": -99.17621448\n                    },\n                    \"serviceTypes\": [],\n                    \"price\": 0.00\n                },\n                {\n                    \"id\": \"2602\",\n                    \"type\": \"TOLL_GANTRY\",\n                    \"name\": \"P\u00f3rtico - Viaducto Tlalpan (V.E.T.)\",\n                    \"address\": \"Ciudad de M\u00e9xico - Cuernavaca\",\n                    \"city\": \"Ciudad de M\u00e9xico\",\n                    \"state\": {\n                        \"name\": \"Ciudad de M\u00e9xico\",\n                        \"code\": \"Ciudad de M\u00e9xico\"\n                    },\n                    \"country\": \"M\u00e9xico\",\n                    \"concession\": \" \",\n                    \"direction\": \"SOUTH\",\n                    \"coordinates\": {\n                        \"latitude\": 19.23586718,\n                        \"longitude\": -99.14526105\n                    },\n                    \"serviceTypes\": [],\n                    \"price\": 0.00\n                }\n            ],\n            \"legTotalCost\": 0.00,\n            \"vehicleType\": \"TRUCK_WITH_FOUR_DOUBLE_AXLES\",\n            \"condition\": {\n                \"billingType\": \"NORMAL\",\n                \"period\": \"NORMAL\"\n            },\n            \"calculationDate\": 1765914894477\n        }\n    ],\n    \"totalCost\": 0.00\n}<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Note: The independent endpoint is only recommended if you use third-party routers. If you use the Trip API, you can get the tolls in the same request. In this example, we have a simple route that passes through the Tres Mar\u00edas toll booth in Mexico. We will use the standalone endpoint to calculate the tolls. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[163],"tags":[],"class_list":["post-2626","post","type-post","status-publish","format-standard","hentry","category-toll-en"],"acf":[],"_links":{"self":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/comments?post=2626"}],"version-history":[{"count":8,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2626\/revisions"}],"predecessor-version":[{"id":3607,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/posts\/2626\/revisions\/3607"}],"wp:attachment":[{"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/media?parent=2626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/categories?post=2626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/developers.maplink.global\/en\/wp-json\/wp\/v2\/tags?post=2626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}