You always need to include attribution to OpenStreetMap.

The OpenRailRouting API uses OpenStreetMap data, see the copyright for more details.