iRail

Transport API · Works in Belgium · NMBS/SNCB data · No API key

TL;DR

iRail provides free, real-time access to Belgian railway data from NMBS/SNCB, including train schedules, station information, vehicle positions, and live departures. Query connections between any two Belgian stations, get vehicle details by train ID, or list live departures from a specific station. Data is sourced from NMBS/SNCB open data feeds. JSON format, no API key needed. Essential for Belgian commuters, travel apps, and public transport enthusiasts.

Quick start: https://api.irail.be/vehicle/?id=BE.NMBS.IC1832&format=json

No API key needed — just make a request!

How to Use This API

1. Get Vehicle (Train) Information

https://api.irail.be/vehicle/?id=BE.NMBS.IC1832&format=json

2. Live Departures from a Station

https://api.irail.be/liveboard/?station=Brussel-Zuid&format=json

3. JavaScript — Track a Train

fetch('https://api.irail.be/vehicle/?id=BE.NMBS.IC1832&format=json')
  .then(r => r.json())
  .then(data => {
    console.log(`Train: ${data.vehicle}`);
    console.log(`From: ${data.stops[0].station}`);
    console.log(`To: ${data.stops[data.stops.length-1].station}`);
    data.stops.forEach(s => {
      console.log(`  ${s.scheduledDepartureTime}: ${s.station}`);
    });
  });

4. Python — Find Connections

import requests

params = {
    'from': 'Antwerpen-Centraal',
    'to': 'Brussel-Noord',
    'format': 'json'
}
data = requests.get(
    'https://api.irail.be/connections/', params=params
).json()

for conn in data['connection'][:3]:
    dep = conn['departure']['time']
    arr = conn['arrival']['time']
    print(f"Departs {conn['departure']['station']} -> {conn['arrival']['station']}")
IC1832 details: https://api.irail.be/vehicle/?id=BE.NMBS.IC1832&format=json

Frequently Asked Questions

What train ID format should I use?
Train IDs follow the pattern BE.NMBS.{trainNumber} (e.g., BE.NMBS.IC1832). The train number is found on NMBS/SNCB schedules and station displays.
What endpoints are available?
/vehicle/ (train details), /connections/ (journey planning), /liveboard/ (station departures), /stations/ (all stations), and /disturbances/ (disruptions).
Can I search stations?
Yes, use https://api.irail.be/stations/?format=json to get all NMBS/SNCB stations with names, coordinates, and IDs.
What format does the API use?
Always append &format=json for JSON responses. The API also supports XML without the parameter.
How often is data updated?
Liveboard and vehicle data updates in real-time from NMBS/SNCB. Connection data is based on the published schedule with real-time delay adjustments.
Is the API rate limited?
iRail is a free community project. Reasonable usage is expected. For high-volume applications, consider self-hosting.

API Details

API URL
https://api.irail.be/
Documentation
docs.irail.be
Category
Transport
Authentication
Not Required
Geographic Coverage
Belgium (BE) — NMBS/SNCB railway network

What You Can Build