We'd recommend first reading through our
V3 API pages — the main page includes an example of using the
/predictions endpoint, which is the one you'll need to fetch real-time departures, and at the bottom of the
Best Practices page you'll find info on how to interpret prediction data and how to implement our "countdown display" rules (which seems to be exactly what you're aiming for). Then take a look at the
Swagger reference, which lists the format of all resources (e.g. predictions) and the parameters accepted by all endpoints. Finally, since the V3 API conforms to the
JSON:API spec, you might want to see if there is a
JSON:API library for your language, which can simplify making the requests and parsing the response data.