Public Transit API v8

Note

This service is subject to Terms and Conditions as described in Supplier Terms for Developers Using HERE Location Platform APIs.

The Public Transit API v8 offers three REST APIs, namely Public Transit Routing API v8, Public Transit Next Departures API v8, and Public Transit Station Search API v8. They allow you to use agency data, external services and data collected by HERE to discover public transit options, request public transit routes and transit-related information.

Calculate a Transit Route

GET https://transit.router.hereapi.com/v8/routes
    ?apiKey={YOUR_API_KEY}
    &origin=41.79457,12.25473
    &destination=41.90096,12.50243

Note

This example uses a HERE API Key to authenticate your request. For more information on the currently available authentication methods, see Authentication and Authorization Developer Guide.

Response

If the route calculation was successful, the /routes response contains the requested details about the calculated route:

  • one optimal transit route, unless alternatives is greater than zero
  • multiple transit sections with each segment (representing either a pedestrian or a transit segment) containing departure/arrival times, duration and coordinates
  • the transit segment shows the actual stops or stations of departure and arrival. Optionally, all intermediate stops in between can be also requested using the parameter return=intermediate
  • a set of operators that run the services included in the alternatives, including operator code, operator name and links to operator websites, if any.
{
  "routes": [
    {
      "id": "R008001-C0",
      "sections": [
        {
          "id": "R008001-C0-S0",
          "type": "pedestrian",
          "actions": [
            {
              "action": "depart",
              "duration": 74,
              "instruction": "Head northwest on Via Arturo Ferrarin. Go for 74 m.",
              "offset": 0
            },
            {
              "action": "turn",
              "duration": 19,
              "instruction": "Turn left. Go for 10 m.",
              "offset": 1,
              "direction": "left"
            },
            {
              "action": "turn",
              "duration": 21,
              "instruction": "Turn right onto Via Generale Felice Santini. Go for 21 m.",
              "offset": 2,
              "direction": "right"
            },
            {
              "action": "turn",
              "duration": 19,
              "instruction": "Turn left onto Elevator. Go for 19 m.",
              "offset": 3,
              "direction": "left"
            },
            {
              "action": "continue",
              "duration": 72,
              "instruction": "Head west. Go for 72 m.",
              "offset": 4
            },
            {
              "action": "turn",
              "duration": 141,
              "instruction": "Turn slightly left. Go for 141 m.",
              "offset": 5,
              "direction": "left",
              "severity": "light"
            },
            {
              "action": "turn",
              "duration": 77,
              "instruction": "Turn left. Go for 77 m.",
              "offset": 7,
              "direction": "left"
            },
            {
              "action": "arrive",
              "duration": 0,
              "instruction": "Arrive at your destination on the right.",
              "offset": 8
            }
          ],
          "travelSummary": {
            "duration": 420,
            "length": 413
          },
          "polyline": "BHkrsl9Y6503pHq9Gr1O9uB9uBijC5sE3G5sEuNj_Q_jH7zN_jHjtNrjLovK",
          "departure": {
            "time": "2019-12-09T12:31:00+01:00",
            "place": {
              "type": "place",
              "location": {
                "lat": 41.79457,
                "lng": 12.25473
              }
            }
          },
          "arrival": {
            "time": "2019-12-09T12:38:00+01:00",
            "place": {
              "name": "Fiumicino Aeroporto",
              "type": "station",
              "location": {
                "lat": 41.793572,
                "lng": 12.251733
              },
              "id": "722068831"
            }
          }
        },
        {
          "id": "R008001-C0-S1",
          "type": "transit",
          "travelSummary": {
            "duration": 1920,
            "length": 31726
          },
          "polyline": "BHg-4k9Y0871pH_wwE4vwEzjGooJ7wFw9J_mE0iJngDg1Hn9Bw_IvC8jJkcg1H08BkkHgj9Bkh3E0rhDkriHoi6Nkl9egmqB4g3D4qJ49vBz9D0isB3-d89qI8gIwr_Bw2oB87_Ds9oB41oEgvUoyoD0xJ4rjE7jEgqjBrhiBs8jF4Swqa8sHghlBkm4BwngF8x-B4m3Ekq7BsixCgw0B8rmC4gTolrB8oE04rBngIgo8E_qHsqwD44CktyBs4KoppB0mgBg7sBgggF8vnD88sBoyY0k3F41kB88Y0mMgzSstXs4tB8jgCsorB40YkhpB7zBos-BnppBwlQrpF08V0rC8zV8kLo-NgsTolIw-a4hGwrkCoGgkDoGo4BA4rBoGo4Bg9D464B4SoyJAo4B4rBgxTo4B45YojEol9CoG4vEnG4vEvMwienGgvFv3CowU_xBolSn4BolS_nG4qsBnrKohhCn8E4zgB_6Oo8oDAo1FAoxCAg9DvMw2UwM4zyCnGw3CoG4mQ4rBw9TwwDw9TofwiFg-KgyaozQgxToqc41Vg9D4rBg7OwuOg-K40Ow3Cw7FwiFg-KghHo8doxCwpd4kCw9sBoqDw_hBgvFwzY4rBwwD4So4BofwiFgvFo9L4kbgmqB4yZw1mBsvHs9K03asuUoyd0oLk0J3D8mK7nCoiHvjCs9ZzkNwhcrtSsyDnzGw5QnrjBw3C_uFwla3uvBgZ3rBomZ3gxB4kCvpE4_Q36fgyB39C4kC_8Dkmaz10Bwlfn75Boh6Cz-zD89Q72b",
          "departure": {
            "time": "2019-12-09T12:38:00+01:00",
            "place": {
              "name": "Fiumicino Aeroporto",
              "type": "station",
              "location": {
                "lat": 41.793572,
                "lng": 12.251733
              },
              "id": "722068831"
            }
          },
          "arrival": {
            "time": "2019-12-09T13:10:00+01:00",
            "place": {
              "name": "Roma Termini",
              "type": "station",
              "location": {
                "lat": 41.900503,
                "lng": 12.502027
              },
              "id": "722068214"
            }
          },
          "transport": {
            "mode": "regionalTrain",
            "name": "Regionale Veloce 3281",
            "category": "Regional Train",
            "color": "#05655D",
            "textColor": "#FFFFFF",
            "headsign": "Roma Termini"
          },
          "intermediateStops": [],
          "agency": {
            "id": "fKf00800",
            "name": "TRENITALIA",
            "website": "http://www.trenitalia.com"
          },
          "attributions": [
            {
              "id": "R008001-C0-S1-link-0",
              "href": "http://www.trenitalia.com/tcom",
              "text": "TRENITALIA",
              "type": "disclaimer"
            }
          ]
        },
        {
          "id": "R008001-C0-S2",
          "type": "pedestrian",
          "actions": [
            {
              "action": "depart",
              "duration": 61,
              "instruction": "Head northeast on Galleria Termini. Go for 61 m.",
              "offset": 0
            },
            {
              "action": "arrive",
              "duration": 0,
              "instruction": "Arrive at Galleria Termini. Your destination is on the right.",
              "offset": 1
            }
          ],
          "travelSummary": {
            "duration": 60,
            "length": 60
          },
          "polyline": "BHqhmm_Y6hsuuH4qIy7I",
          "departure": {
            "time": "2019-12-09T13:10:00+01:00",
            "place": {
              "name": "Roma Termini",
              "type": "station",
              "location": {
                "lat": 41.900503,
                "lng": 12.502027
              },
              "id": "722068214"
            }
          },
          "arrival": {
            "time": "2019-12-09T13:11:00+01:00",
            "place": {
              "type": "place",
              "location": {
                "lat": 41.90096,
                "lng": 12.50243
              }
            }
          }
        }
      ]
    }
  ]
}

Note

When you do not specify departureTime/arrivalTime parameter, the current time when the request is trigger is taken. As a result, you might not obtain the same response.

results matching ""

    No results matching ""