RapidAPI logo

Sign Up

Log In

iRail

FREE
By pietercolpaert
Updated 3 months ago
Travel
5.6/10
Popularity Score
311ms
Latency
-
Success Rate

iRail API Documentation

Search for train trips in Belgium using the iRail API. You can search for train departures in a certain station and search for all the stations in Belgium.

View API Details
GETDepartures
GETStations list
GETDepartures

Departures of trains in Belgium

Header Parameters
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
Required Parameters
monthSTRING
REQUIREDThe number of the month
daySTRING
REQUIREDThe number of the day
hourSTRING
REQUIREDThe number of hours in 24h style
stationnameSTRING
REQUIREDYou can find the appropriate names in the Stations list
yearSTRING
REQUIREDThe year you want to query
minutesSTRING
REQUIREDThe minutes you want to retrieve responses from
Request Snippet
unirest.get("https://irail.p.rapidapi.com/NMBS/Departures/Gent%20Sint-Pieters/2013/11/02/13/02.json")
.header("X-RapidAPI-Host", "irail.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
Sample Response
Log inSign up

Install SDK for NodeJS

Installing

To utilize unirest for node.js install the the npm module:

$ npm install unirest

After installing the npm package you can now start simplifying requests like so:

var unirest = require('unirest');

Creating Request

unirest.get("https://irail.p.rapidapi.com/NMBS/Departures/Gent%20Sint-Pieters/2013/11/02/13/02.json")
.header("X-RapidAPI-Host", "irail.p.rapidapi.com")
.header("X-RapidAPI-Key", "SIGN-UP-FOR-KEY")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2 Authentication
Client ID
Client Secret
OAuth2 Authentication