Simple flask api. Countdown to next train for each station in the subway system. Uses MTA Realtime Feeds:

To run:

  1. Create virtual environment and activate:

python3 -m venv env

source env/bin/activate

  1. Install requirements:

pip install -r requirements.txt

  1. Get api key from and store the following in a .env file in the root of the directory:


export FLASK_ENV=development


  1. Run Flask app

flask run

  1. To find the next train for the stop, go to subway_metadata/stops.csv to find your stop. For example, 137th St City College Station is code '115'. (Do not enter 115N or 115S)
  2. Navigate to:

API fields:

  • direction: N (uptown), S(downtown)
  • nextTime: time in seconds to next train
  • route_id: The route name for the train, see subway_metadata/routes.csv for the routes table.


Things to add:

  • Subway alerts and delays
GitHub - kalyani-subbiah/mta-api at
Simple api that calculates countdown to train arrival for subway stops. May be expanded to include other features. - GitHub - kalyani-subbiah/mta-api at