PT OPS

Locations & Stations

Arrivals, departures, and platform information for stations.

Last updated: October 8, 2026
GET /locations Public

Returns the map of all known location codes to their names.

{
  "MAS": "Masjok",
  "SK": "Skogviken",
  "SIG": "Skiippagurra",
  "KKN": "Kirkenes"
}

The real response contains every known station code, not just these.

POST /locations Authentication required

Forces an immediate refresh of cached arrivals/departures per station.

POST /forceReset Authentication required

Runs the day reset and refreshes cached station arrivals/departures. Returns { "message": "Day reset" } on success.

GET /locations/:stationCode/arrivals Public

Returns the cached list of arriving trains for a station, sorted by scheduled arrival. Returns 404 with { "error": "Station not found or no trains" } if the station code is unknown; a known station with no trains returns []. The cache is refreshed every minute.

Response (200 OK) — station train entry

[
  {
    "trainNumber": "301",
    "operator": "PTR",
    "extraTrain": false,
    "routeNumber": "R81",
    "continuesAs": null,
    "type": "stasjon",
    "stopType": "passenger",
    "hasPassed": false,
    "isCancelledAtStation": false,
    "track": "1",
    "defaultTrack": "1",
    "arrival": "2026-10-08T06:03:00.000Z",
    "defaultArrival": "2026-10-08T06:00:00.000Z",
    "norwegianArrival": { "hours": 8, "minutes": 3 },
    "norwegianDefaultArrival": { "hours": 8, "minutes": 0 },
    "arrivalDelay": 3,
    "departure": "2026-10-08T06:05:00.000Z",
    "defaultDeparture": "2026-10-08T06:02:00.000Z",
    "norwegianDeparture": { "hours": 8, "minutes": 5 },
    "norwegianDefaultDeparture": { "hours": 8, "minutes": 2 },
    "departureDelay": 3,
    "fullRoute": [ { "name": "Skogviken", "code": "SK", "...": "currentRoute stops" } ],
    "messages": [],
    "currentFormation": {}
  }
]

arrival/departure are the live UTC times, default* the scheduled ones, norwegian* are local-time hours/minutes objects, and delays are in minutes. fullRoute is the train's whole currentRoute. Arrivals exclude a train's first stop; departures exclude its last stop.

GET /locations/:stationCode/departures Public

Returns the cached list of departing trains for a station, sorted by scheduled departure. Each element has the same shape as the arrivals entry above. Same 404/[] behavior as arrivals.

GET /locations/:stationCode/trains/:trainNumber Public

Looks up a specific train at a station (checking departures first, then arrivals). Returns a single station train entry (same shape as arrivals), or 404 with { "error": "Train not found at this station" }.

GET /locations/:stationCode/track/:trackNumber Public

Returns all unique trains (arrivals + departures) currently assigned to a given track, sorted by departure time. The response is an array of station train entries (same shape as arrivals); trains appearing as both arrival and departure are returned once. Returns [] if no trains use the track.

GET /locations/:stationCode/track/:trackNumber/screenInfo Public

Powers platform information screens. Returns up to 3 upcoming passenger trains for a platform, handling track changes, continuations, and a 10-minute grouping window between consecutive trains.

Each element is a station train entry (same shape as arrivals) with one extra field, isDeparture (true if the entry comes from the departures list, false if from arrivals). Matches trains whose track or defaultTrack equals the requested track, so a train moved to another platform can still be shown with its track change.

Returns [] when there is nothing upcoming to display.

GET /locations/SK/mainScreen Authentication required

Returns the main departure board data for the Skogviken (SK) station: upcoming passenger departures, plus the next two trains toward KLH, KKN, SIG, and MAS.

Response (200 OK)

{
  "upcomingDepartures": [ { "trainNumber": "301", "...": "station train entry" } ],
  "nextTrainTo": {
    "KLH": [ { "trainNumber": "301", "...": "station train entry" } ],
    "KKN": [],
    "SIG": [],
    "MAS": []
  }
}

Only passenger stops that haven't departed yet are included. Each nextTrainTo list holds at most 2 trains whose fullRoute includes that destination.