APIs for mod makers
Hook another Railroader mod into RailCom Pro's radio, or use RailroaderHub's open data in a Discord bot, a website or your own mod.
RailCom Pro's radio
RadioTap is how another mod hears RailCom Pro's radio and talks on it: an AI dispatcher that answers calls, a detector that reads out passing trains, speech-to-text for a radio log. It's C# inside the game, not HTTP.
Getting to it
- Where
VoiceRadio.RadioTap, apublic static classinVoiceRadio.dll, in the RailComPro folder in Railroader's Mods folder. RailCom Pro's mod id issmokey/voice-radio.- No reference needed
- Find it by name in
AppDomain.CurrentDomain.GetAssemblies()and use it through reflection with plain delegates, so your mod builds and runs whether RailCom Pro is installed or not. Look for it when a game loads: RailCom Pro may load after your mod does. - Which version
RadioTap.Version(aconst int, 6 now) says what's there. Check it before you use something newer: Versions lists what came when. RailCom Pro's own version isVoiceRadio.VoiceRadioMod.Version, aconst stringlike "0.6.33".- Threads
- Unity's main thread, for everything. The events fire on it, and calls from another thread are refused:
CanTransmitis false andTransmitdoes nothing. - Errors
- Nothing in
RadioTapthrows at you. If your handler throws, RailCom Pro catches it, notes it once in Player.log, and the radio carries on. - Audio
- 16 kHz mono floats from -1 to 1 (
RadioTap.SampleRate, 16000), in and out.
Finding it
// No reference to RailCom Pro's DLL: find it by name.
Type tap = null;
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
tap = tap ?? assembly.GetType("VoiceRadio.RadioTap", false);
// Not installed, or not loaded yet: look again later.
if (tap == null) return;
int version = (int)tap.GetField("Version").GetRawConstantValue();
// Who keys up and lets go on the player's channel.
var keyed = new Action<string, bool>((who, down) => { /* ... */ });
tap.GetEvent("Keyed").AddEventHandler(null, keyed);
Listening
event Action<string, bool> KeyedVersion 1- Someone keyed up (true) or let go (false) on the player's channel, with who it is. The player's own calls count.
event Action<string, float[], int> AudioVersion 1- The radio as the player hears it, with the radio sound: who's talking, the samples from index 0, and how many. The array is reused straight after, so copy what you keep.
event Action<string, float[], int> CleanAudioVersion 3- The same calls without the radio sound, as they were sent: no static, clicks, squelch, roger beep or volume. For speech-to-text. It only comes between that speaker's
Keyedtrue and false. int ChannelVersion 1- The player's radio channel, 1 to 9.
string LocalNameVersion 2- The player's own name, as it shows for their own calls. Null until the game knows it.
const int SampleRateVersion 1- 16000.
- Only the player's channel comes through, their own calls included. Nearby voice and the crew intercom never do.
- Calls the player hears from another channel, one they scan or someone's emergency call, come through the every-channel events on their own channel, not these.
- People are named as the game names them (callsigns don't change that). Other mods' voices end in " (AI)", and people talking from a live map end in " (web)".
Talking
bool CanTransmitVersion 2- Whether a line can start now: in the host's game (or single player), with F9 > Radio > Voices from other mods on, no other line going out, and nobody keyed up on the channel: the player, anyone in the game, or someone talking from the live map.
void Transmit(string speaker, float[] samples, int count)Version 2- Clean voice for one line,
countsamples from index 0, all at once or in pieces. RailCom Pro plays it out in real time with the radio sound, the key-up click and the squelch, on the player's channel, to everyone on it. The samples are copied, so the array is yours again. void TransmitEnd(string speaker)Version 2- The line is done: what's left plays out, then the squelch closes it.
- Starting: the first
Transmitof a line only counts whileCanTransmitis true. Otherwise nothing is queued and nothing throws, so check right before. - One line at a time, from all mods together. While yours is going, more
Transmitcalls with the same speaker add to it, and anyone else's are skipped. - Real time: faster is fine, a whole line in one call included. Streamed slower, the line has gaps, and 1.5 seconds without audio ends it by itself.
- 30 seconds a line at most. Anything past that is dropped.
- The speaker: up to 32 characters, without <, > or control characters, and an empty name becomes AI. A player's name is refused (noted once in Player.log). Everyone sees AI by it.
Talking with text
bool CanSpeakTextVersion 4- Whether RailCom Pro can make voices on this computer: Windows' own text-to-speech, through Windows PowerShell. False under Proton or Wine.
bool TransmitText(string speaker, string text, string voice)Version 4- Windows says the text and RailCom Pro sends it as a line, like
Transmit.voice: null for Windows' default voice, a voice's name ("Microsoft Zira Desktop"), a language and region ("pt-BR") or a language ("pt"). When none of the voices on the host's computer matches, the default speaks. True when the line is on its way.
- Making the voice takes a moment, often a second or two. Then the line goes out as soon as the channel is clear, or is dropped after waiting 10 seconds (Player.log says why).
- At most 500 characters (the rest is cut), one text line at a time, and like any line, 30 seconds.
Channels
string ChannelName(int channel)Version 5- What the host calls a channel (1 to 9): "Road", "Yard", "MOW" and so on, or "" when it has no name. In someone else's game these are the host's names, once their game has sent them.
bool CanTransmitOn(int channel)Version 5CanTransmiton a channel you pick: 1 to 9, or anything else for the player's own.void TransmitOn(int channel, string speaker, float[] samples, int count)Version 5Transmiton a channel you pick, so a dispatcher can answer on Road while the host is on Yard. The players on that channel hear it, and the host only when they're on it too. The channel is taken from a line's first call. End the line withTransmitEndas usual.bool TransmitTextOn(int channel, string speaker, string text, string voice)Version 5TransmitTexton a channel you pick.
Every channel
event Action<int, string, float[], int> ChannelAudioVersion 6Audioon every channel, with the channel (1 to 9) first, whichever channel the player's radio is on. The game hears the other channels for you without playing them, so an AI dispatcher can listen on Road while the host switches to Yard and back.event Action<int, string, float[], int> ChannelCleanAudioVersion 6CleanAudioon every channel, with the channel first.event Action<int, string, bool> ChannelKeyedVersion 6Keyedon every channel, with the channel first.
- These also carry the calls the player hears from other channels: the ones they scan, and emergency calls.
- Only the host's game hears its own mods' lines on every channel. Other players' games hear those on their own channel.
- Nothing extra runs until something listens to them.
Example code
Copy this into your mod. It finds RailCom Pro by name, checks the version before each call, and has a collector that hands you each radio call whole, for speech-to-text. It builds against the game's own libraries with C# 7.3.
RailComRadio.cs
using System;
using System.Collections.Generic;
/// <summary>
/// RailCom Pro's radio (VoiceRadio.RadioTap), found by name, so your mod builds and runs
/// without RailCom Pro. Use it on Unity's main thread only.
/// </summary>
public static class RailComRadio
{
private static Type _tap;
/// <summary>RadioTap.Version, or 0 while RailCom Pro isn't found.</summary>
public static int Version { get; private set; }
/// <summary>
/// Looks for RailCom Pro. Call it when a game loads: RailCom Pro may load after your mod.
/// </summary>
public static bool Find()
{
if (_tap != null) return true;
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
var type = assembly.GetType("VoiceRadio.RadioTap", false);
if (type == null) continue;
_tap = type;
Version = (int)type.GetField("Version").GetRawConstantValue();
return true;
}
return false;
}
/// <summary>The player's radio channel, 1 to 9 (0 while RailCom Pro isn't found).</summary>
public static int Channel
{
get { return _tap == null ? 0 : (int)Get("Channel"); }
}
/// <summary>The player's own name, as their own radio calls are named.</summary>
public static string LocalName
{
get { return Version < 2 ? null : (string)Get("LocalName"); }
}
/// <summary>What the host calls a channel, like "Road" or "Yard", or "".</summary>
public static string ChannelName(int channel)
{
return Version >= 5 ? (string)Call("ChannelName", channel) : "";
}
/// <summary>Whether a line can start now: on a channel (1 to 9), or 0 for the player's.</summary>
public static bool CanTransmit(int channel = 0)
{
if (Version >= 5) return (bool)Call("CanTransmitOn", channel);
return Version >= 2 && channel == 0 && (bool)Get("CanTransmit");
}
/// <summary>Says a line your mod made (16 kHz mono, -1 to 1). False if it can't start now.</summary>
public static bool Say(string speaker, float[] samples, int count, int channel = 0)
{
if (!CanTransmit(channel)) return false;
if (Version >= 5) Call("TransmitOn", channel, speaker, samples, count);
else Call("Transmit", speaker, samples, count);
Call("TransmitEnd", speaker);
return true;
}
/// <summary>
/// Says text in a voice Windows makes. voice: null for Windows' default, a language
/// ("en-US", "pt") or a voice's name ("Microsoft Zira Desktop"). False if it can't start now.
/// </summary>
public static bool SayText(string speaker, string text, string voice = null, int channel = 0)
{
if (Version < 4 || !(bool)Get("CanSpeakText")) return false;
if (Version >= 5) return (bool)Call("TransmitTextOn", channel, speaker, text, voice);
return channel == 0 && (bool)Call("TransmitText", speaker, text, voice);
}
/// <summary>
/// Listens to one of RadioTap's events by name: Keyed, Audio, CleanAudio (version 3), or
/// ChannelKeyed, ChannelAudio and ChannelCleanAudio (version 6). The handler's type has to
/// be the event's.
/// </summary>
public static bool Listen(string name, Delegate handler)
{
var e = _tap == null ? null : _tap.GetEvent(name);
if (e == null) return false;
e.AddEventHandler(null, handler);
return true;
}
/// <summary>Stops listening (do it when your mod unloads).</summary>
public static void StopListening(string name, Delegate handler)
{
var e = _tap == null ? null : _tap.GetEvent(name);
if (e != null) e.RemoveEventHandler(null, handler);
}
private static object Get(string property)
{
return _tap.GetProperty(property).GetValue(null, null);
}
private static object Call(string method, params object[] args)
{
return _tap.GetMethod(method).Invoke(null, args);
}
}
/// <summary>
/// Each radio call whole, for speech-to-text: the clean voice from the moment someone keys up
/// until they let go.
/// </summary>
public sealed class CallCollector
{
private readonly Dictionary<string, List<float>> _calls =
new Dictionary<string, List<float>>();
private readonly Action<string, float[]> _done;
private readonly Action<string, bool> _keyed;
private readonly Action<string, float[], int> _voice;
/// <summary>done gets who talked and their call: 16 kHz mono, -1 to 1.</summary>
public CallCollector(Action<string, float[]> done)
{
_done = done;
_keyed = Keyed;
_voice = Voice;
}
public bool Start()
{
return RailComRadio.Version >= 3
&& RailComRadio.Listen("Keyed", _keyed)
&& RailComRadio.Listen("CleanAudio", _voice);
}
public void Stop()
{
RailComRadio.StopListening("Keyed", _keyed);
RailComRadio.StopListening("CleanAudio", _voice);
}
private void Keyed(string who, bool down)
{
if (down)
{
_calls[who] = new List<float>();
return;
}
List<float> call;
if (!_calls.TryGetValue(who, out call)) return;
_calls.Remove(who);
if (call.Count > 0) _done(who, call.ToArray());
}
private void Voice(string who, float[] samples, int count)
{
List<float> call;
if (!_calls.TryGetValue(who, out call)) return;
// The array is reused straight after this, so copy what's in it.
for (int i = 0; i < count; i++) call.Add(samples[i]);
}
}
Using it
// When a game loads (RailCom Pro may load after your mod does):
if (RailComRadio.Find())
{
collector = new CallCollector((who, call) =>
{
// The whole call, 16 kHz mono. Hand it to your speech-to-text away from
// the main thread, then answer from the main thread.
});
collector.Start();
}
// Answering on Road (channel 1) in Windows' voice:
if (RailComRadio.CanTransmit(1))
RailComRadio.SayText("Dispatcher", "PVR 101, you're clear to Bryson City.", "en-US", 1);
// When your mod unloads:
collector.Stop();
Versions
| Version | RailCom Pro | What it added |
|---|---|---|
| 1 | 0.6.2 | Audio, Keyed, Channel, SampleRate |
| 2 | 0.6.4 | CanTransmit, Transmit, TransmitEnd, LocalName. Other mods' voices come through Audio and Keyed, named with " (AI)". |
| 3 | 0.6.5 | CleanAudio |
| 4 | 0.6.6 | CanSpeakText, TransmitText. From 0.6.7, people talking from a live map come through too, named with " (web)". |
| 5 | 0.6.12 | ChannelName, CanTransmitOn, TransmitOn, TransmitTextOn |
| 6 | 0.6.22 | ChannelAudio, ChannelCleanAudio, ChannelKeyed. From 0.6.28, calls heard from other channels come through these only. |
RailCom Pro updates itself, so players have a new version within minutes of it coming out. RailCom Pro's changelog has every change.
RailroaderHub's open data
What anyone can see on RailroaderHub without signing in, as JSON: live maps running now, communities, their sessions and news, a live map's trains, leaderboards and Holiday Lights layouts. Read only.
The basics
- Where
https://railroaderhub.com, then the path. Every answer is JSON withok: true, except the calendar and layout files.- Who you are
- Nobody: no key and no sign-in. You see what a visitor sees, so maps set to Only the crew and communities' private parts aren't here.
- Before December 1
- Communities, live maps and layouts are open now. Leaderboards open with the rest of the site on December 1, and until then answer 403.
- Errors
- An HTTP status with
{ "ok": false, "reason": "..." }: 404 for something that isn't there, 403 for something that isn't open to you. - Addresses
- Paths in answers, like
/c/pine-valley, are on railroaderhub.com. Times are UTC, like2026-12-05T01:00:00.000Z. - Where from
- A server, a bot or a mod. Pages on other websites can't read these answers (there's no CORS), so a website asks from its server.
Be kind to the site
- Send a
User-Agentthat names your mod or bot and how to reach you, likeMyMod/1.0 (Discord: yourname). - Ask at most once a minute, and keep what you get. One live map's state can be asked for every 10 seconds while you show it.
- Use the lists, rather than asking for every community one by one.
- New fields can turn up in any answer, so skip the ones you don't know. If something you use changes, the changelog says so.
Live now
/api/maps/liveEvery live map running right now that anyone may watch, the busiest first: what the site's Live now page shows.
maps[].name, path | The map's name, and its page. |
|---|---|
maps[].community | The community: slug (its address), name, tagline, icon, path and more. |
maps[].trains, watching | Trains out, and how many people are watching the map. |
maps[].since | When it went live. |
maps[].railroad, gameTime, weather | The railroad's name in the game, its day and time, and the weather. |
curl -A "MyMod/1.0 (Discord: yourname)" https://railroaderhub.com/api/maps/live
Example answer
{
"ok": true,
"maps": [
{
"id": 1,
"name": "Main line",
"path": "/c/pine-valley/map/1",
"crewOnly": false,
"community": {
"id": 1,
"slug": "pine-valley",
"name": "Pine Valley Railroad",
"tagline": "Mainline freight through the Pine Valley",
"icon": null,
"banner": null,
"accent": "#f0287f",
"status": "open",
"region": "North America, Friday evenings Eastern",
"tags": [],
"path": "/c/pine-valley"
},
"trains": 4,
"watching": 0,
"since": "2026-11-28T02:36:02.753Z",
"railroad": "Pine Valley Railroad",
"gameTime": "Day 12, 6:58 AM",
"weather": "Light Rain"
}
]
}Communities
/api/communitiesThe communities in the directory, 24 at a time, the biggest crew first.
q | Words to look for in the name, reporting marks, tagline, region or what they run. |
|---|---|
hiring | 1 for only the ones hiring. |
sort | crew (the default), new or name. |
offset | Where to start. When more is true, ask again with offset set to next. |
communities[].slug, name, path | Its address (railroaderhub.com/c/slug), name and page. |
|---|---|
communities[].marks, tagline, region | Reporting marks, its one line, and where and when it runs. |
communities[].status | open while it's hiring, closed when it isn't. |
communities[].crew, mods | How many crew, and how many mods it lists. |
communities[].nextSession | When its next session starts, or null. |
communities[].positions | The jobs it's hiring for. |
curl -A "MyMod/1.0 (Discord: yourname)" https://railroaderhub.com/api/communities?hiring=1&sort=new
Example answer
{
"ok": true,
"communities": [
{
"id": 1,
"slug": "pine-valley",
"name": "Pine Valley Railroad",
"tagline": "Mainline freight through the Pine Valley",
"icon": null,
"banner": null,
"accent": "#f0287f",
"status": "open",
"region": "North America, Friday evenings Eastern",
"tags": [],
"path": "/c/pine-valley",
"marks": "PVR",
"crew": 2,
"estYear": 2025,
"mods": 2,
"nextSession": "2026-12-05T01:00:00.000Z",
"positions": [
"Engineer",
"Dispatcher"
]
}
],
"more": false,
"next": 24
}/api/communities/{slug}One community, by its address, with its crew, open positions, mods and live maps. Communities that aren't in the directory still answer here.
community.description, mapInfo | About the community, and what it runs. |
|---|---|
community.inviteUrl | Its Discord invite, or null. |
community.crew[] | Who's on the crew: user (name, handle, avatar, path), role and since. |
community.positions[] | Open positions: title, about and openings (null for any number). |
community.mods | Its mods list, as below. |
community.maps[] | Its live maps: live, trains, watching, lastLiveAt. Maps only the crew may watch are listed too, with watch: "crew". |
curl -A "MyMod/1.0 (Discord: yourname)" https://railroaderhub.com/api/communities/pine-valley
Example answer, shortened
{
"ok": true,
"community": {
"id": 1,
"slug": "pine-valley",
"path": "/c/pine-valley",
"name": "Pine Valley Railroad",
"marks": "PVR",
"tagline": "Mainline freight through the Pine Valley",
"description": "A friendly operating group running the Pine Valley line every Friday night: mainline freight, a daily passenger train and switching at Bryson City. New crew are welcome, no experience needed.",
"mapInfo": "Whittier to Bryson City in the 1950s: mainline freight, a daily passenger train and switching at Bryson.",
"region": "North America, Friday evenings Eastern",
"estYear": 2025,
"icon": null,
"banner": null,
"accent": "#f0287f",
"status": "open",
"inviteUrl": "https://discord.gg/pinevalley",
"createdAt": "2026-11-28T02:14:49.420Z",
"memberCount": 2,
"crew": [
{
"user": {
"id": 1,
"handle": "railfan42",
"name": "Railfan42",
"avatar": "https://cdn.discordapp.com/embed/avatars/1.png",
"accent": "#f0287f",
"path": "/u/railfan42"
},
"owner": true,
"role": {
"name": "Management",
"color": "#ffc35c"
},
"title": "",
"since": "2026-11-28T02:14:49.420Z"
}
],
"positions": [
{
"id": 1,
"title": "Engineer",
"about": "Road freight between Whittier and Bryson City.",
"openings": 2
}
],
"mods": {
"items": [
{
"id": "m1-p0chh",
"url": "https://railroaderhub.com/railcom",
"name": "RailCom Pro",
"note": "Radio and the live map.",
"loader": "",
"version": "0.6.33",
"required": true
}
],
"updatedAt": "2026-11-28T02:35:39.614Z"
},
"maps": [
{
"id": 1,
"name": "Main line",
"watch": "anyone",
"path": "/c/pine-valley/map/1",
"live": true,
"trains": 4,
"watching": 0,
"lastLiveAt": "2026-11-28T02:36:02.753Z"
}
]
}
}Sessions
/api/communities/{slug}/sessionsA community's scheduled sessions that haven't ended yet, soonest first (up to 20).
sessions[].title, details | The session, and what it says about it. |
|---|---|
sessions[].startsAt, endsAt, durationMinutes | When it runs. |
sessions[].crewWanted, going | How many crew it wants, and how many have said they're going. |
curl -A "MyMod/1.0 (Discord: yourname)" https://railroaderhub.com/api/communities/pine-valley/sessions
Example answer
{
"ok": true,
"sessions": [
{
"id": 1,
"title": "Friday night ops",
"startsAt": "2026-12-05T01:00:00.000Z",
"endsAt": "2026-12-05T03:30:00.000Z",
"durationMinutes": 150,
"details": "Line-up in #sessions on Discord. Bryson City yard job and two road freights.",
"crewWanted": 8,
"going": 0,
"youGoing": false,
"people": null
}
]
}/api/communities/{slug}/sessions/{id}/calendarOne session as a calendar file (text/calendar), to add to Google Calendar, Outlook or Apple's Calendar.
Answer
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//RailroaderHub//Sessions//EN
CALSCALE:GREGORIAN
METHOD:PUBLISH
BEGIN:VEVENT
UID:session-1@railroaderhub.com
DTSTAMP:20261128T023604Z
DTSTART:20261205T010000Z
DTEND:20261205T033000Z
SUMMARY:Friday night ops (Pine Valley Railroad)
DESCRIPTION:Line-up in #sessions on Discord. Bryson City yard job and two
road freights.\n\nhttps://railroaderhub.com/c/pine-valley#session-1
URL:https://railroaderhub.com/c/pine-valley#session-1
END:VEVENT
END:VCALENDAR
News and mods
/api/communities/{slug}/newsA community's news, newest first, 10 at a time, with pinned posts on their own.
before | For older posts: when more is true, ask again with before set to the answer's before. |
|---|
curl -A "MyMod/1.0 (Discord: yourname)" https://railroaderhub.com/api/communities/pine-valley/news
Example answer
{
"ok": true,
"pinned": [],
"posts": [
{
"id": 1,
"title": "Bryson City yard is open",
"body": "The new yard at Bryson City is in. The yard job starts there from this Friday.",
"pinned": false,
"createdAt": "2026-11-28T02:35:39.632Z",
"editedAt": null,
"author": {
"id": 1,
"handle": "railfan42",
"name": "Railfan42",
"avatar": "https://cdn.discordapp.com/embed/avatars/1.png",
"accent": "#f0287f",
"path": "/u/railfan42"
}
}
],
"more": false,
"before": 1
}/api/communities/{slug}/modsThe mods a community runs: what players install before they join. required is false for the optional ones.
curl -A "MyMod/1.0 (Discord: yourname)" https://railroaderhub.com/api/communities/pine-valley/mods
Example answer
{
"ok": true,
"mods": {
"items": [
{
"id": "m1-p0chh",
"url": "https://railroaderhub.com/railcom",
"name": "RailCom Pro",
"note": "Radio and the live map.",
"loader": "",
"version": "0.6.33",
"required": true
},
{
"id": "m2-3wcep",
"url": "https://railroaderhub.com/mods/holiday-lights",
"name": "Holiday Lights",
"note": "For the Christmas runs.",
"loader": "",
"version": "0.15.1",
"required": false
}
],
"updatedAt": "2026-11-28T02:35:39.614Z"
}
}Live maps
/api/maps/{id}A live map: whether it's live, trains out, people watching, and when it was last live. The map's id is in its address: railroaderhub.com/c/pine-valley/map/1.
Example answer
{
"ok": true,
"map": {
"id": 1,
"name": "Main line",
"watch": "anyone",
"path": "/c/pine-valley/map/1",
"canWatch": true,
"live": true,
"dispatching": false,
"talking": false,
"watching": 0,
"trains": 4,
"lastLiveAt": "2026-11-28T02:36:02.753Z",
"keepReplays": true,
"radioListen": "off",
"recaps": []
}
}/api/maps/{id}/stateevery 10 seconds at mostThe game as the host's RailCom Pro last sent it. Maps set to Only the crew answer 403.
name, day, clock, wx | The railroad's name in the game, its day and time, and the weather. |
|---|---|
bal | Money in the bank, in dollars. |
trains[].n, s | The train's name, and its speed in mph (0 is stopped). |
trains[].m, mx | How it's running: Road, Yard, Waypoint or Off (by hand), and its top speed in that mode. |
trains[].u, c, ft | Locomotives, cars, and its length in feet. |
trains[].to | Where its cars are going, in words, or null. |
pl | Players, as [name, x, z], only when the map shows players. |
sent, v | When the game sent it (milliseconds since 1970), and the format's version. |
The rest of the state is packed for the map's own page and changes with RailCom Pro, so lean only on the fields above.
curl -A "MyMod/1.0 (Discord: yourname)" https://railroaderhub.com/api/maps/1/state
Example answer, shortened
{
"v": 8,
"kind": "state",
"sent": 1794591106524,
"name": "Pine Valley Railroad",
"day": "Day 12",
"clock": "6:58 AM",
"wx": "Light Rain",
"bal": 1234567,
"trains": [
{
"i": 1,
"n": "PVR 101",
"s": 28,
"m": "Road",
"mx": 40,
"u": 1,
"c": 15,
"ft": 827,
"to": "Cedar Gap Lumber (4), Millbrook Lumber (4), Ashford Lumber (3)"
},
{
"i": 18,
"n": "PVR 202",
"s": 35,
"m": "Road",
"mx": 40,
"u": 2,
"c": 9,
"ft": 558,
"to": "Millbrook Freight House (3), Ashford Freight House (2), Pine Hollow Freight House (2)"
}
],
"pl": [
[
"Kate",
-20517,
-9879
],
[
"Railfan42",
-14940,
-7587
]
]
}Leaderboards From December 1
/api/leaderboardsThe most miles, hours on duty or cars delivered, from the numbers RailCom Pro sends for connected players.
by | miles (the default), hours or cars. |
|---|---|
period | week (the last 7 days, the default) or all. |
community | A community's address, for its crew only. |
n | How many people, 1 to 50 (25 if you don't say). |
curl -A "MyMod/1.0 (Discord: yourname)" https://railroaderhub.com/api/leaderboards?by=hours&period=all&community=pine-valley
Example answer
{
"ok": true,
"by": "miles",
"period": "week",
"label": "Miles",
"community": null,
"rows": [
{
"rank": 1,
"user": {
"id": 1,
"handle": "railfan42",
"name": "Railfan42",
"avatar": "https://cdn.discordapp.com/embed/avatars/1.png",
"accent": "#f0287f",
"path": "/u/railfan42"
},
"value": 159
},
{
"rank": 2,
"user": {
"id": 2,
"handle": "kate",
"name": "Conductor Kate",
"avatar": "https://cdn.discordapp.com/embed/avatars/1.png",
"accent": "#f0287f",
"path": "/u/kate"
},
"value": 84
}
],
"me": null
}Holiday Lights layouts
/api/layoutsThe layouts members have shared for the Holiday Lights builder, newest first, or with sort=popular the most downloaded first. /api/layouts/{id} answers with one.
layouts[].name, note, by | The layout, what its maker says about it, and who shared it. |
|---|---|
layouts[].download | The layout file, as layout-export.txt, ready for the builder's Import. |
layouts[].items, runs, shapes, onCars | How many runs of lights and shapes it has, and how many are on cars. |
layouts[].picture, downloads | Its picture, if it has one, and how many times it's been downloaded. |
layouts[].drawing | Where its lights are, seen from above, as the gallery draws them. |
curl -A "MyMod/1.0 (Discord: yourname)" https://railroaderhub.com/api/layouts?sort=popular
Example answer
{
"ok": true,
"layouts": [
{
"id": 1,
"name": "Bryson City depot",
"note": "Warm white on the depot eaves, a star on the water tower.",
"path": "/mods/holiday-lights/layouts/1",
"download": "/mods/holiday-lights/layouts/1/layout-export.txt",
"by": {
"id": 1,
"handle": "railfan42",
"name": "Railfan42",
"avatar": "https://cdn.discordapp.com/embed/avatars/1.png",
"accent": "#f0287f",
"path": "/u/railfan42"
},
"items": 2,
"runs": 1,
"shapes": 1,
"onCars": 0,
"picture": null,
"downloads": 0,
"createdAt": "2026-11-28T02:35:39.761Z",
"mine": false,
"canRemove": false,
"drawing": {
"box": [
1210.5,
-791,
1262,
-780
],
"items": [
{
"shape": false,
"theme": 1,
"points": [
[
1210.5,
-790
],
[
1240,
-790.5
],
[
1262,
-791
]
]
},
{
"shape": true,
"theme": 3,
"points": [
[
1260,
-780
]
]
}
]
}
}
]
}Example code
A Discord bot: post when your map goes live (JavaScript, Node 18 or newer)
// Posts in your Discord when your community's live map goes live.
// Node 18 or newer, on your own computer or server.
const COMMUNITY = 'pine-valley'; // your address: railroaderhub.com/c/pine-valley
const WEBHOOK = process.env.DISCORD_WEBHOOK; // Edit Channel > Integrations > Webhooks
const SITE = 'https://railroaderhub.com';
const HEADERS = { 'User-Agent': 'pine-valley-bot/1.0 (Discord: railfan42)' };
let liveBefore = new Set();
async function check() {
const answer = await fetch(`${SITE}/api/maps/live`, { headers: HEADERS });
if (!answer.ok) return; // try again next time
const { maps } = await answer.json();
const ours = maps.filter((map) => map.community.slug === COMMUNITY);
for (const map of ours) {
if (liveBefore.has(map.id)) continue;
const words = `${map.name} is live, ${map.trains} trains out: ${SITE}${map.path}`;
await fetch(WEBHOOK, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ content: words }),
});
}
liveBefore = new Set(ours.map((map) => map.id));
}
check();
setInterval(check, 60 * 1000); // once a minute is plenty
In a mod: your community's live maps (C# 7.3, with the game's Newtonsoft.Json)
using System;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
/// <summary>RailroaderHub's Live now, from inside a mod. One HttpClient for the whole mod.</summary>
public static class HubLive
{
public static string Site = "https://railroaderhub.com";
private static readonly HttpClient Http = MakeClient();
private static HttpClient MakeClient()
{
var client = new HttpClient { Timeout = TimeSpan.FromSeconds(10) };
client.DefaultRequestHeaders.UserAgent.ParseAdd("MyMod/1.0");
return client;
}
/// <summary>
/// One community's live maps that anyone may watch right now, by its address ("pine-valley").
/// </summary>
public static async Task<JToken[]> LiveMaps(string community)
{
string json = await Http.GetStringAsync(Site + "/api/maps/live");
return JObject.Parse(json)["maps"]
.Where(map => (string)map["community"]["slug"] == community)
.ToArray();
}
}
Await it from Unity's main thread and your code carries on there when the answer comes.
Questions
Building something with these, or need something they don't have yet? Message us on Support. Changes to RadioTap are in RailCom Pro's changelog, and changes to the site's data in RailroaderHub's.