Welcome to the iRail API! Before you start implementing this API, a lot of code has been written already! Feel free to look around on our Github page for more information on wrappers for your programming language of choice.

1. Query for station / download all stations




optional (leave empty for all stations):



E.g., for Brussels: curl https://irail.be/stations/NMBS?q=Brussels

 "@graph": [
 "longitude": "4.373674",
 "latitude": "50.838943",
 "name": "Brussel-Luxemburg/Bruxelles-Luxembourg",
 "alternative": [
 "@value": "Brussels-Luxemburg/Brussels-Luxembourg",
 "@language": "en"
 "@value": "Bruxelles-Luxembourg",
 "@language": "fr"
 "@value": "Brussel-Luxemburg",
 "@language": "nl"
 "@id": "http://irail.be/stations/NMBS/008811304"


2. Querying for a route from one station to another


http://api.irail.be/connections/?to={station1}&from={station2} (OPTIONAL:) &date={dmy}&time=2359&timeSel=arrive or depart


dmy (day of month with leading 0, number of the month with leading 0, 10 or 11 (for 2010 or 2011)) e.g., 010115 is the first of January 2015


Hours in 24 hour format concatenated with minutes with leading 0!


Whether the date & time are for arrival or depart. Should be “arrive” or “depart”


(with random data)

  <connection id="0">
   <departure delay="xx"> <!--xx in seconds-->
    <station locationX="4.038586" locationY="50.943053">AALST</station>
    <time formatted="Y-m-d\TH:i:s\Z"> <!-- time in iso 8601 -->
     U <!--(= unixtime)-->
    <platform normal="yes">3</platform>
   <vias number="1">
    <via id="0">
      <time formatted="Y-m-d\TH:i:s\Z">
       U<!--(= unixtime)-->
      <time formatted="iso8601">
         U <!--(= unixtime)-->
     <station locationX="..." locationY="...">GENT SINT PIETERS</station>
   <arrival delay="xx"> <!--delay on arrival in seconds -->
    <station location="... ..." >
    <time formatted="Y-m-d\TH:i\Z">
     U <!--(= unixtime)-->
   <platform normal="true">1</platform>
  <duration delay="yes">seconds</duration>

3. Departures and Arrivals in a certain station




Because of the changes in the internal system we were not able to link every station to a geolocation and internal id. Therefore we had to write a very slow workaround for this. If you don’t need geocoordinates or the id, add: &fast=true to your URL.


Name of the station


id returned by a previous request


date of depart/arrival – dmy


time of depart/arrival –


DEP or ARR for arrival or departure


<liveboard version="1.0" timestamp="123456789">
 <station locationX="4.21485" locationY="...">Ghent Sint Pieters</station>
 <departures number="2">
  <departure delay="xx" id="0">
   <station locationX="..." locationY="...">STATIONNAME</station>
   <time formatted="iso8601">U</time>
  <departure delay="xx" id="1">
   <station locationX="..." locationY="...">STATIONNAME</station>
   <time formatted="iso8601">U</time>

4. Vehicle




Because of the recent changes in the internal system we were not able to link every station to a geolocation and internal id. Therefore we had to write a very slow workaround for this. If you don’t need geocoordinates or the id, add: &fast=true to your URL.


specify the vehicle id. This should be according the iRail specification


 <vehicleinformation version="1.0" timestamp="1289951643">
  <vehicle locationX="0" locationY="0">BE.NMBS.P8080</vehicle>
  <stops number="2">
   <stop id="0" delay="0">
    <station id="BE.NMBS.429" locationY="50.854421" locationX="2.736304">POPERINGE</station>
    <time formatted="2010-11-17T15:12:00Z">1290006720</time>
   <stop id="1" delay="X">
    <station id="BE.NMBS.272" locationY="50.8474" locationX="2.876589">IEPER</station>
    <time formatted="2010-11-17T15:21:00Z">1290007260</time>

Error Response

When incorrect requests has been made or when an error occurs, we will provide an error message like this:

 <error version="1.0" timestamp="1289951590" code="1">
   You should ...

at this moment code = 1 is a user error. code = 2 is a server error.

Arguments on all functions


if you add &lang= NL, EN, DE or FR to a function, the given station will be interpreted in that language, and the stationnames will be outputted in that language.


Currently we support 2 formats: xml and json

  • &format=xml will output the above examples
  • &format=json will output the xml-converted json
  • &format=jsonp&callback=foo will package the json string into a callback function.


setting alerts=true will enable alert messages in the response

Comments (15)

  1. Thanks for your efforts to implement this.
    The API https://irail.be/stations/NMBS does not seem to react to no parameters at all. Basically I’m looking for a list of all stations with Latitude and Longitude information.

    • Hi Vincent,

      Check https://github.com/iRail/stations for the raw data in CSV format. If you want the JSON file from the URL you’ve mentioned, you need to configure an Accept header with your request. E.g., “Accept: application/json” will return JSON. We have seen that this is not too straightforward and will soon add a GET parameter to retrieve JSON right away.


  2. Great innitiative :). Is there any way to check vehicle delay from a date in the past ?
    http://api.irail.be/vehicle/?id=BE.NMBS.P1234&fast=true&date= xxx ?

  3. The vehicle location seems to be set to the coordinates of the departure station whilst I would have expected to get its real position. Is that information available somewhere?

    With railtime, it was possible to see when a vehicle was arrived in (or had left) a specific station and this was really useful information. No App (SNCN / Railer) is showing this information.

    Thanks in advance for your answer.

  4. Vraagje, bij de request: http://api.irail.be/connections/?to={station1}&from={station2} Waarom station1 en station2 als gewone strings ipv ID van station? Wat als de stations van naam veranderen? Hoe gebeurt de encoding van deze strings?

  5. Why does “querying for a route from one station to another” use the dmy format and “fepartures and Arrivals in a certain station” the mdy format? BTW, love the api!

  6. Can we get station name from latitude and longitude ?

  7. Pingback: Stations ophalen wordt ook static dan maar… | De toekomst van digitale signalisatie

  8. Peter can you help ?

    We are looking for a system that show us the departures of all busses at uz jette, in a nice formatted way, as well from de lijn but also from the nivb.

    Because i’m not a prorammer, i’m not good at this.

    So could you write a php page that does this ?


    • I want to ask how i can make a page with the leaving times of bussess at jette hostpital.

      For mivb and de lijn.

      Can you help

Leave a Reply