Trafik Proxy API documentation

  1. Stations
  2. Messages
  3. Reason Codes
  4. Delayed Trains

Stations

A station has the following attributes:

LocationSignature
AdvertisedLocationName
Geometry.WGS84
PlatformLine

To get all stations:

GET /stations

Result:

{
  "data": [
    {
      "AdvertisedLocationName": "Astrid Lindgrens värld",
      "Geometry": {
        "WGS84": "POINT (15.840063951305682 57.67270729523255)"
      },
      "LocationSignature": "Alv",
      "PlatformLine": [
        "1"
      ]
    },
    {
      "AdvertisedLocationName": "Aneby",
      "Geometry": {
        "WGS84": "POINT (14.81189626871035 57.837434576066045)"
      },
      "LocationSignature": "Any",
      "PlatformLine": [
        "1",
        "2"
      ]
    },
    {
      "AdvertisedLocationName": "Aspen",
      "Geometry": {
        "WGS84": "POINT (12.240512241673448 57.75442205677955)"
      },
      "LocationSignature": "Apn",
      "PlatformLine": [
        "1",
        "2"
      ]
    },
....

Messages

A message has the following attributes:

EventId
EndDateTime
Geometry.WGS84
ExternalDescription
StartDateTime
LastUpdateDateTime
ReasonCode
TrafficImpact
Header

To get all messages:

GET /messages

Result:

{
  "data": [
    {
      "ExternalDescription": "Trafikverket bygger ut Mälarbanan mellan Sundbyberg och Jakobsberg söndagar kl. 02.00 - 08:20. SL pendeltåg ersätts med buss och tunnelbana.\nInställda avgångar och förlängd restid förekommer.\nFör mer information om din resa, kontakta ditt tågbolag.\n",
      "Geometry": {
        "WGS84": "POINT (17.9025365385664 59.3923400986982)"
      },
      "EventId": "2666822",
      "Header": "Banarbete",
      "ReasonCode": [
        {
          "Code": "IBT",
          "Description": "banarbete"
        }
      ],
      "TrafficImpact": [
        {
          "IsConfirmed": true,
          "FromLocation": [
            "Bål"
          ],
          "AffectedLocation": [
            "Bkb",
            "Brny",
            "Bro",
            "Duo",
            "Huv",
            "Jkb",
            "Khä",
            "Kän",
            "Sod",
            "Spå",
            "Sub",
            "Tmö",
            "Tot"
          ],
          "ToLocation": [
            "Sci"
          ]
        },
        {
          "IsConfirmed": true,
          "FromLocation": [
            "Sub"
          ],
          "AffectedLocation": [
            "Bkb",
            "Duo",
            "Spå"
          ],
          "ToLocation": [
            "Jkb"
          ]
        }
      ],
      "StartDateTime": "2018-12-15T02:00:00.000+01:00",
      "LastUpdateDateTime": "2021-01-21T08:46:30.150+01:00"
    },
....

Reason Codes

A reason code has the following attributes:

Code
GroupDescription
Level1Description
Level2Description
Level3Description

To get all reason codes:

GET /codes

Result:

{
  "data": [
    {
      "Code": "ANA002",
      "GroupDescription": "Annonseringstexter",
      "Level1Description": "Avvikelse",
      "Level2Description": "Nationell",
      "Level3Description": "Bakre tåg"
    },
    {
      "Code": "ANA004",
      "GroupDescription": "Annonseringstexter",
      "Level1Description": "Avvikelse",
      "Level2Description": "Nationell",
      "Level3Description": "Brofel"
    },
    {
      "Code": "ANA003",
      "GroupDescription": "Annonseringstexter",
      "Level1Description": "Avvikelse",
      "Level2Description": "Nationell",
      "Level3Description": "Banarbete"
    },
    {
      "Code": "ANA005",
      "GroupDescription": "Annonseringstexter",
      "Level1Description": "Avvikelse",
      "Level2Description": "Nationell",
      "Level3Description": "Broöppning"
    },
....

Delayed Trains

All delayed trains in Sweden for the coming 14 hours is shown.

A delayed train has the following attributes:

ActivityId
ActivityType
AdvertisedTimeAtLocation
EstimatedTimeAtLocation
AdvertisedTrainIdent
Canceled
FromLocation
ToLocation

To get all delayed trains:

GET /delayed

Result:

{
  "data": [
    {
      "ActivityId": "1500adde-0a5d-1766-08d8-d85aaae62018",
      "ActivityType": "Avgang",
      "AdvertisedTimeAtLocation": "2021-03-11T13:03:00.000+01:00",
      "AdvertisedTrainIdent": "735",
      "Canceled": false,
      "EstimatedTimeAtLocation": "2021-03-11T13:15:00.000+01:00",
      "FromLocation": [
        {
          "LocationName": "Hpbg",
          "Priority": 1,
          "Order": 0
        }
      ],
      "ToLocation": [
        {
          "LocationName": "Cst",
          "Priority": 1,
          "Order": 0
        }
      ]
    },
    {
      "ActivityId": "1500adde-0a5d-1766-08d8-d85a927d1a39",
      "ActivityType": "Avgang",
      "AdvertisedTimeAtLocation": "2021-03-11T13:07:00.000+01:00",
      "AdvertisedTrainIdent": "233",
      "Canceled": true,
      "EstimatedTimeAtLocation": "2021-03-11T13:44:00.000+01:00",
      "FromLocation": [
        {
          "LocationName": "Cst",
          "Priority": 1,
          "Order": 0
        }
      ],
      "ToLocation": [
        {
          "LocationName": "Nr",
          "Priority": 1,
          "Order": 0
        }
      ]
    },
....