This is the old developer portal

Entur's developer portal has moved to developer.entur.no. Use the new portal for the latest documentation. This old version will be retired once its content has moved, but API changes are still published here for now, under News and Notifications.

Introduction

This service provides a GraphQL API for fetching/streaming live vehicle-positions.

The API is explorable in our GraphQL IDE: https://api.entur.io/graphql-explorer/vehicles-v2.

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"
  • "nor_way_bussekspress-nwy-app"

Query

Enables fetching vehicle-positions in a GraphQL API.

Base URL: https://api.entur.io/realtime/v2/vehicles/graphql

Example:

{
  vehicles(codespaceId:"ATB") {
    lastUpdated
    location {
      latitude
      longitude
    }
  }
}

Subscription

Enables creating a GraphQL-subscription that will open a websocket and let the server stream all updates to the client continuously.

Base URL: wss://api.entur.io/realtime/v2/vehicles/subscriptions

(Uses the websocket-protocol graphql-ws)

Example:

subscription {
  vehicles(codespaceId:"ATB") {
    lastUpdated
    location {
      latitude
      longitude
    }
  }
}

For GraphQL-subscriptions, the Et-Client-Name header should be included in the initial connection request.

Example (using the graphql-ws client-library):

createClient({
  url: "wss://api.entur.io/realtime/v2/vehicles/subscriptions",
  connectionParams: {
    headers: {
      "Et-Client-Name": "company-application",
    },
  },
})

More details about GraphQL-subscriptions: https://graphql.org/blog/subscriptions-in-graphql-and-relay/