Vehicle Positions
The Vehicle Positions API is a GraphQL service that provides real-time positions and status for public transport vehicles across Norway. It enables fetching and streaming live vehicle data including location, delays, occupancy, and journey information.
Base URL: https://api.entur.io/realtime/v2/vehicles/graphql
GraphQL IDE: https://api.entur.io/graphql-explorer/vehicles-v2
Are you new to GraphQL? You can read more about it here: https://graphql.org/
Authentication
Vehicle Positions is an Open Service licensed under NLOD and requires the ET-Client-Name header for all requests.
Use a value that uniquely identifies your company and application, in the form <company>-<application> (lowercase, no spaces).
For detailed authentication instructions and requirements, see Authentication.
Query
Fetch the current state of vehicles with a GraphQL query.
POST https://api.entur.io/realtime/v2/vehicles/graphql
Headers
- Content-Type:
application/json - ET-Client-Name:
<company>-<application>
Example
Fetch all vehicles for a given codespace:
Code
Filtering
The vehicles query accepts several arguments for narrowing the result set, including:
codespaceId- all vehicles for a codespace (e.g.ATB,RUT,SKY)lineRef/lineName- vehicles on a specific linemode- filter by transport mode (e.g.bus,rail,tram)boundingBox- vehicles within a geographic areamonitored- only vehicles with active real-time monitoringmaxDataAge- maximum age of data as an ISO-8601 duration (e.g.PT1M)
To discover the available codespaces to filter by:
Code
WebSocket Subscriptions
For real-time streaming updates, the API provides GraphQL subscriptions over WebSocket:
WebSocket URL: wss://api.entur.io/realtime/v2/vehicles/subscriptions
Subscriptions allow your application to receive continuous updates as vehicle positions change, rather than polling for data. The connection uses the graphql-ws protocol, and the ET-Client-Name header must be included in the initial connection request.
Example Subscription
Subscribe to vehicle updates within a geographic bounding box:
Code
Updates are buffered before being pushed to the client. Use the bufferSize and bufferTime arguments on the subscription to tune how frequently batches are delivered.
Additional Resources
- Real-Time Data Overview - Information about SIRI and GTFS-RT feeds