Journey Planner v2

This API is the core service for journey planning and uses OpenTripPlanner software to provide departure boards for individual stops, and point-to-point journey planning for all public transport in Norway, including real-time information, regardless of transport mode, or operator. All data is presented as a Transmodel-based GraphQL-API.

Entur is currently transitioning to a new version of OpenTripPlanner. The following examples and instructions are only valid for API v2 (OpenTripPlanner 1.x).

Base URL: https://api.entur.io/journey-planner/v2/graphql

To make it easier for our users to construct valid API-queries, we have an IDE for the API where you also find the documentation.

GraphQL IDE: https://api.entur.io/journey-planner/v2/ide

Are you new to GraphQL? You can read more about it here: https://graphql.org/

We also provide a JavaScript SDK which supports a lot of JourneyPlanner's queries.

Example queries

Authentication

This API is open under NLOD licence, however, it is required that all consumers identify themselves by using the header ET-Client-Name. Entur will deploy strict rate-limiting policies on API-consumers who do not identify with a header and reserves the right to block unidentified consumers. The structure of ET-Client-Name should be: "company-application"

Header examples:

  • "brakar-journeyplanner"
  • "fosen_utvikling-departureboard"
  • "norway_bussekspress-nwy-app"

API

There is only one endpoint!

POST https://api.entur.io/journey-planner/v2/graphql

Headers

  • Content-Type: application/json
  • ET-Client-Name: <company>-<application> (See Authentication section above)

Body

A JSON body with a "query" field and optionally "variables".

{
    "query": "string",
    "variables": {
        "myVariable": "value"
    }
}

Examples

Here are some examples of JourneyPlanner calls in different languages/technologies.

Check out the example query in the GraphQL Editor.

curl

curl https://api.entur.io/journey-planner/v2/graphql \
    -H 'Content-Type: application/json' \
    -H 'ET-Client-Name: awesomecompany-awesomeapp' \
    -d '{"query":"{stopPlace(id:\"NSR:StopPlace:337\"){name id estimatedCalls{expectedDepartureTime destinationDisplay{frontText}serviceJourney{line{publicCode transportMode}}}}}"}'

JavaScript Fetch API

fetch('https://api.entur.io/journey-planner/v2/graphql', {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'ET-Client-Name': 'awesomecompany-awesomeapp',
    },
    body: JSON.stringify({
        query:
            '{stopPlace(id%3A"NSR%3AStopPlace%3A337"){name id estimatedCalls{expectedDepartureTime destinationDisplay{frontText}serviceJourney{line{publicCode transportMode}}}}}',
    }),
})