It is possible to get this data directly from the MTA: <a href="http://datamine.mta.info/" rel="nofollow">http://datamine.mta.info/</a><p>It is a good bit messier than this, but it is free, unlike this site. And after all, you never know how long sites like these will be around.
Another project that does this - <a href="https://github.com/jonthornton/MtaSanitizer" rel="nofollow">https://github.com/jonthornton/MtaSanitizer</a>. Free and self-hosted.
Putting your API on the same hostname and presumably the same codebase as your website is not a great long-term strategy. And mentioned before, consider HTTPS to protect the API key.
Does google maps/citymapper consume this sort of real-time train location data?<p>If not, perhaps you could use the NYC subway REST API to cross reference route calculations