Get started
This section outlines how to quickly get started using the Public Transit API v8 on the HERE platform.
- Get a HERE account
- Create a project
- Get an API key
- Send a request
Note
This section provides information on the minimum setup required to quickly begin using the Public Transit API v8. For more detailed information on HERE account setup, project creation, service linking, app registration, and authentication, see the Identity & Access Management Guide.
Get a HERE account
You can get started with a free HERE platform account from the flexible HERE Base Plan. For more information, see the HERE Base Plan Pricing. Alternatively, if your company has already established a HERE platform organization, contact your organization admin who can invite you to join your company's organization.
Create a project
To create a project, follow these steps:
- Sign in to the HERE platform using your HERE account.
- Open the Projects Manager from the launcher.
- Click Create new project.
- Enter a name for the project. Project names don't have to be unique.
- Enter a project ID. Project IDs must be unique within an organization and cannot be changed for the lifetime of the organization. Project IDs must be between 4 and 16 characters in length.
- Optional: Enter an optional description.
- Click Save.
Get an API key
To get an API key, follow these steps:
- Sign in to the HERE platform using your HERE account.
- Select the Access Manager from the launcher.
- Select the Apps tab and click Register new app.
- Enter a name for the app.
- Optional: Enter a description for the app.
- Optional: Select the project you created in the previous procedure from the Default access to a project field.
- Click Register. The HERE platform creates a new app with a unique app ID.
- On the Credentials tab, select API Keys and then click Create API key to generate a maximum of two API Keys for your application authentication credentials. The API key is created and displayed.
Send a request
This example request calculates 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
If the route calculation was successful, the /routes
response contains the requested details about the calculated route:
- One optimal transit route, unless the
alternatives
is greater than zero. - Multiple transit sections with each segment, representing either a pedestrian or a transit segment, containing departure and 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 the 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
parameters, the current time when the request is triggered is taken. As a result, you may not obtain the same response.
Next steps
We encourage you to further browse the examples of the most typical use cases of the Public Transit API that you can find below in this Developer Guide: Public Transit Routing API, Public Transit Next Departures API, and Public Transit Station Search API. For a full list of the parameters used in the API requests and the data provided in the responses, see the HERE Public Transit API Reference.