The SMART database contains details of train describer berths and allows movements into berths to be translated into arrivals and departures from locations. The data feed contains a periodically-updated snapshot of the SMART database.

Please make certain you have read the Conditions of use before using this API.

TD describer areas

The rail network is split into multiple TD describer areas within which you then have the berth movements. To retrieve a list of the TD describer areas currently in the database simply issue an HTTP GET to http://api.area51.onl/rail/1/ref/smart and a JSON array of the areas are returned:

$ curl -s http://api.area51.onl/rail/1/ref/smart | jq '.'
[
  {
    "area": "A2",
    "comment": "Ashford IECC B",
    "enabled": true
  },
  {
    "area": "A3",
    "comment": "Ashford Front-End TD",
    "enabled": true
  },
  ...
]
area
The TD describer area id
comment
The Name (if known) of this area
enabled
Internal flag to indicate we have a signal map available

Berths within a signal area

This end point returns a JSON array of signal berths within a specified area which have a known movement. It's not an exhaustive list of possible berth's in that train describer, just those that have an entry in SMART

$ curl -s http://api.area51.onl/rail/1/ref/smart/A3 | jq '.'
{
  "area": {
    "area": "A3",
    "comment": "Ashford Front-End TD",
    "enabled": true
  },
  "berths": [
    "COUT",
    "E870",
    "E873",
    ...
    "RY05",
    "RY25",
    "RY27"
  ]
}

Here the area key is the same as above, however the berths key is a JSON array of berth names.

Movements for a berth

This endpoint returns all movements that are possible for a signal berth.

For example, looking up the COUT berth in signal area A3 we have the following result:

$ curl -s http://api.area51.onl/rail/1/ref/smart/A3/COUT | jq '.'
[
  {
    "area": "A3",
    "fromberth": "RY25",
    "toberth": "COUT",
    "fromline": null,
    "toline": null,
    "berthoffset": -56,
    "platform": "",
    "event": "depart up",
    "route": "2",
    "stanox": 89439,
    "stanme": "RYE",
    "steptype": "B",
    "comment": "05/02/2013"
  },
  {
    "area": "A3",
    "fromberth": "RY05",
    "toberth": "COUT",
    "fromline": null,
    "toline": null,
    "berthoffset": -22,
    "platform": "",
    "event": "depart down",
    "route": "1",
    "stanox": 89439,
    "stanme": "RYE",
    "steptype": "B",
    "comment": "05/02/2013"
  }
]

The objects returned have the following definition

area
Train describer area
fromberth
TD berth that movement is from
toberth
TD berth that movement is to
fromline
Line which the movement is from
toline
Line which the movement is to
berthoffset
Difference between the time the berth event occurs and the time to be recorded in TRUST, in seconds
platform
Platform
event
One of: 'arrive up', 'depart up', 'arrive down' or 'depart down'
route
stanox
STANOX code for location
stanme
Abbreviated description of location
steptype
One of B, F, C, D, I, T, E
comment

The steptype is one of

B
Between
F
From
T
To
D
Intermediate First
C
Clearout
I
Interpose
E
Intermediate

Movements between berths

You can refine the above query by specifying an additional term.

For example to query a movement between two beths then you would use http://api.area51.onl/rail/1/ref/smart/A3/RY35/COUT and you would get the same results for any movements from RY35 to COUT.

Another query is to return all movements from a berth, so for movements from RY35 to any other berth then use: http://api.area51.onl/rail/1/ref/smart/A3/from/RY35

Similarly to return all movements into a berthyou can use: http://api.area51.onl/rail/1/ref/smart/A3/to/COUT