The data is a periodically-updated snapshot of the CORPUS database. This can be used to translate STANOX, TIPLOC, NLC, UIC & 3-alpha (CRS) codes to location descriptions.

This service exposes that database allowing basic cross-reference lookups based on the various codes.

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

Response from this API

The output of all of the endpoints returns a JSON array of objects. Each object contains the following keys:

stanox
STANOX code
uic
UIC code
talpha
3-letter location code
tiploc
TIPLOC code
nlc
NLC code
nlcdesc
Description of the NLC
nlcdesc16
NLC description (16-character version)

Endpoints

You can perform lookups based on either NLC, stanox, uic, 3alpha or tiploc by using one of the following endpoints:

talpha
http://api.area51.onl/rail/1/ref/corpus/3alpha/:talpha
nlc
http://api.area51.onl/rail/1/ref/corpus/nlc/:nlc
tiploc
http://api.area51.onl/rail/1/ref/corpus/uic/:uic
stanox
http://api.area51.onl/rail/1/ref/corpus/stanox/:stanox
uic
http://api.area51.onl/rail/1/ref/corpus/uic/:uic

For example, say we want to look up 3alpha code MDE which happens to be Maidstone East then we can use

$ curl -s http://api.area51.onl/rail/1/ref/corpus/3alpha/MDE
[{"id":32058,"stanox":89403,"uic":51150,"talpha":"MDE","tiploc":"MSTONEE","nlc":511500,"nlcdesc":"MAIDSTONE EAST","nlcdesc16":null}]

Here's the response made easier to read:

$ curl -s http://api.area51.onl/rail/1/ref/corpus/3alpha/MDE | jq '.'
[
  {
    "id": 32058,
    "stanox": 89403,
    "uic": 51150,
    "talpha": "MDE",
    "tiploc": "MSTONEE",
    "nlc": 511500,
    "nlcdesc": "MAIDSTONE EAST",
    "nlcdesc16": null
  }
]