Real-Time Rail Predictions icon

Real-Time Rail Predictions

Real-time rail prediction methods

COMMUNITYAPI KEY0 INSTALLS
OpenAPI Specificationv3.0
{
  "swagger": "2.0",
  "schemes": [
    "http",
    "https"
  ],
  "host": "api.wmata.com",
  "basePath": "/StationPrediction.svc",
  "info": {
    "description": "Real-time rail prediction methods.",
    "title": "Real-Time Rail Predictions",
    "version": "1.0",
    "x-apisguru-categories": [
      "transport"
    ],
    "x-logo": {
      "url": "https://api.apis.guru/v2/cache/logo/https_twitter.com_wmata_profile_image.png"
    },
    "x-origin": [
      {
        "format": "swagger",
        "url": "https://developer.wmata.com/docs/services/547636a6f9182302184cda78/export?DocumentFormat=Swagger",
        "version": "2.0"
      }
    ],
    "x-providerName": "wmata.com",
    "x-serviceName": "rail-realtime"
  },
  "securityDefinitions": {
    "apiKeyHeader": {
      "in": "header",
      "name": "api_key",
      "type": "apiKey"
    },
    "apiKeyQuery": {
      "in": "query",
      "name": "api_key",
      "type": "apiKey"
    }
  },
  "security": [
    {
      "apiKeyHeader": []
    },
    {
      "apiKeyQuery": []
    }
  ],
  "tags": [],
  "paths": {
    "/GetPrediction/{StationCodes}": {
      "get": {
        "description": "<h4 class=\"text-primary\">Description</h4>\r\n\r\n<p>Returns next train arrival information for one or more stations. Will return\r\nan empty set of results when no predictions are available. Use <span class=\r\n\"text-info\">All</span> for the StationCodes parameter to return predictions for\r\nall stations.</p>\r\n\r\n<p>For terminal stations (e.g.: Greenbelt, Shady Grove, etc.), predictions may\r\nbe displayed twice.</p>\r\n\r\n<p>Some stations have two platforms (e.g.: Gallery Place, Fort Totten, L'Enfant\r\nPlaza, and Metro Center). To retrieve complete predictions for these stations,\r\nbe sure to pass in both StationCodes.</p>\r\n\r\n<p>For trains with no passengers, the DestinationName will be <span class=\r\n\"text-info\">No Passenger</span>.</p>\r\n\r\n<p>Next train arrival information is refreshed once every 20 to 30 seconds approximately.</p>\r\n\r\n<h4 class=\"text-primary\">Response Elements</h4>\r\n\r\n<table class=\"table table-condensed table-hover\">\r\n<thead>\r\n<tr>\r\n<th class=\"col-md-3\">Element</th>\r\n\r\n<th>Description</th>\r\n</tr>\r\n</thead>\r\n\r\n<tbody>\r\n<tr>\r\n<td>Trains</td>\r\n\r\n<td>\r\nArray containing train prediction information (<a href=\r\n\"#AIMPredictionTrainInfo\">AIMPredictionTrainInfo</a>).\r\n</td>\r\n</tr>\r\n\r\n<tr>\r\n<td colspan=\"2\">\r\n<div class=\"text-primary\" style=\"margin-top: 1em\">\r\n<a id=\"AIMPredictionTrainInfo\" name=\r\n\"AIMPredictionTrainInfo\">AIMPredictionTrainInfo\r\nElements</a>\r\n</div>\r\n</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>Car</td>\r\n\r\n<td>Number of cars on a train, usually 6 or 8, but might also\r\nreturn <span class=\"text-info\">-</span> or NULL.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>Destination</td>\r\n\r\n<td>Abbreviated version of the final destination for a train. This\r\nis similar to what is displayed on the signs at stations.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>DestinationCode</td>\r\n\r\n<td>Destination station code. Can be NULL. Use this value in other\r\nrail-related APIs to retrieve data about a station.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>DestinationName</td>\r\n\r\n<td>When DestinationCode is populated, this is the full name of the\r\ndestination station, as shown on the WMATA website.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>Group</td>\r\n\r\n<td>Denotes the track this train is on, but does not necessarily\r\nequate to Track 1 or Track 2. With the exception of terminal\r\nstations, predictions at the same station with different Group\r\nvalues refer to trains on different tracks.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>Line</td>\r\n\r\n<td>Two-letter abbreviation for the line (e.g.: RD, BL, YL, OR, GR,\r\nor SV). May also be blank or <span class=\"text-info\">No</span> for\r\ntrains with no passengers.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>LocationCode</td>\r\n\r\n<td>Station code for where the train is arriving. Useful when\r\npassing in <span class=\"text-info\">All</span> as the StationCodes\r\nparameter. Use this value in other rail-related APIs to retrieve\r\ndata about a station.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>LocationName</td>\r\n\r\n<td>Full name of the station where the train is arriving. Useful\r\nwhen passing in <span class=\"text-info\">All</span> as the\r\nStationCodes parameter.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>Min</td>\r\n\r\n<td>Minutes until arrival. Can be a numeric value, <span class=\r\n\"text-info\">ARR</span> (arriving), <span class=\r\n\"text-info\">BRD</span> (boarding), <span class=\r\n\"text-info\">---</span>, or empty.</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<hr>",
        "operationId": "547636a6f918230da8553640",
        "parameters": [
          {
            "default": "B03",
            "description": "Comma-separated list of station codes.  For all predictions, use \"All\".",
            "enum": [
              "B03",
              "All"
            ],
            "in": "path",
            "name": "StationCodes",
            "required": true,
            "type": "string"
          }
        ],
        "produces": [
          "text/xml"
        ],
        "responses": {
          "200": {
            "description": "Default return code.",
            "examples": {
              "text/xml": "<AIMPredictionResp\n    xmlns=\"http://www.wmata.com\"\n    xmlns:i=\"http://www.w3.org/2001/XMLSchema-instance\">\n    <Trains>\n        <AIMPredictionTrainInfo>\n            <Car>8</Car>\n            <Destination>Glenmont</Destination>\n            <DestinationCode>B11</DestinationCode>\n            <DestinationName>Glenmont</DestinationName>\n            <Group>1</Group>\n            <Line>RD</Line>\n            <LocationCode>A01</LocationCode>\n            <LocationName>Metro Center</LocationName>\n            <Min>1</Min>\n        </AIMPredictionTrainInfo>\n        <AIMPredictionTrainInfo>\n            <Car>8</Car>\n            <Destination>Shady Gr</Destination>\n            <DestinationCode>A15</DestinationCode>\n            <DestinationName>Shady Grove</DestinationName>\n            <Group>2</Group>\n            <Line>RD</Line>\n            <LocationCode>A01</LocationCode>\n            <LocationName>Metro Center</LocationName>\n            <Min>1</Min>\n        </AIMPredictionTrainInfo>\n        <AIMPredictionTrainInfo>\n            <Car>6</Car>\n            <Destination>SilvrSpg</Destination>\n            <DestinationCode>B08</DestinationCode>\n            <DestinationName>Silver Spring</DestinationName>\n            <Group>1</Group>\n            <Line>RD</Line>\n            <LocationCode>A01</LocationCode>\n            <LocationName>Metro Center</LocationName>\n            <Min>3</Min>\n        </AIMPredictionTrainInfo>\n        <AIMPredictionTrainInfo>\n            <Car>6</Car>\n            <Destination>Grsvnor</Destination>\n            <DestinationCode>A11</DestinationCode>\n            <DestinationName>Grosvenor-Strathmore</DestinationName>\n            <Group>2</Group>\n            <Line>RD</Line>\n            <LocationCode>A01</LocationCode>\n            <LocationName>Metro Center</LocationName>\n            <Min>4</Min>\n        </AIMPredictionTrainInfo>\n        <AIMPredictionTrainInfo>\n            <Car>6</Car>\n            <Destination>Glenmont</Destination>\n            <DestinationCode>B11</DestinationCode>\n            <DestinationName>Glenmont</DestinationName>\n            <Group>1</Group>\n            <Line>RD</Line>\n            <LocationCode>A01</LocationCode>\n            <LocationName>Metro Center</LocationName>\n            <Min>5</Min>\n        </AIMPredictionTrainInfo>\n        <AIMPredictionTrainInfo>\n            <Car>8</Car>\n            <Destination>Shady Gr</Destination>\n            <DestinationCode>A15</DestinationCode>\n            <DestinationName>Shady Grove</DestinationName>\n            <Group>2</Group>\n            <Line>RD</Line>\n            <LocationCode>A01</LocationCode>\n            <LocationName>Metro Center</LocationName>\n            <Min>6</Min>\n        </AIMPredictionTrainInfo>\n    </Trains>\n</AIMPredictionResp>"
            }
          }
        },
        "summary": "XML - Next Trains"
      }
    },
    "/json/GetPrediction/{StationCodes}": {
      "get": {
        "description": "<h4 class=\"text-primary\">Description</h4>\r\n\r\n<p>Returns next train arrival information for one or more stations. Will return\r\nan empty set of results when no predictions are available. Use <span class=\r\n\"text-info\">All</span> for the StationCodes parameter to return predictions for\r\nall stations.</p>\r\n\r\n<p>For terminal stations (e.g.: Greenbelt, Shady Grove, etc.), predictions may\r\nbe displayed twice.</p>\r\n\r\n<p>Some stations have two platforms (e.g.: Gallery Place, Fort Totten, L'Enfant\r\nPlaza, and Metro Center). To retrieve complete predictions for these stations,\r\nbe sure to pass in both StationCodes.</p>\r\n\r\n<p>For trains with no passengers, the DestinationName will be <span class=\r\n\"text-info\">No Passenger</span>.</p>\r\n\r\n<p>Next train arrival information is refreshed once every 20 to 30 seconds approximately.</p>\r\n\r\n<h4 class=\"text-primary\">Response Elements</h4>\r\n\r\n<table class=\"table table-condensed table-hover\">\r\n<thead>\r\n<tr>\r\n<th class=\"col-md-3\">Element</th>\r\n\r\n<th>Description</th>\r\n</tr>\r\n</thead>\r\n\r\n<tbody>\r\n<tr>\r\n<td>Trains</td>\r\n\r\n<td>\r\nArray containing train prediction information (<a href=\r\n\"#AIMPredictionTrainInfo\">AIMPredictionTrainInfo</a>).\r\n</td>\r\n</tr>\r\n\r\n<tr>\r\n<td colspan=\"2\">\r\n<div class=\"text-primary\" style=\"margin-top: 1em\">\r\n<a id=\"AIMPredictionTrainInfo\" name=\r\n\"AIMPredictionTrainInfo\">AIMPredictionTrainInfo\r\nElements</a>\r\n</div>\r\n</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>Car</td>\r\n\r\n<td>Number of cars on a train, usually 6 or 8, but might also\r\nreturn <span class=\"text-info\">-</span> or NULL.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>Destination</td>\r\n\r\n<td>Abbreviated version of the final destination for a train. This\r\nis similar to what is displayed on the signs at stations.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>DestinationCode</td>\r\n\r\n<td>Destination station code. Can be NULL. Use this value in other\r\nrail-related APIs to retrieve data about a station.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>DestinationName</td>\r\n\r\n<td>When DestinationCode is populated, this is the full name of the\r\ndestination station, as shown on the WMATA website.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>Group</td>\r\n\r\n<td>Denotes the track this train is on, but does not necessarily\r\nequate to Track 1 or Track 2. With the exception of terminal\r\nstations, predictions at the same station with different Group\r\nvalues refer to trains on different tracks.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>Line</td>\r\n\r\n<td>Two-letter abbreviation for the line (e.g.: RD, BL, YL, OR, GR,\r\nor SV). May also be blank or <span class=\"text-info\">No</span> for\r\ntrains with no passengers.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>LocationCode</td>\r\n\r\n<td>Station code for where the train is arriving. Useful when\r\npassing in <span class=\"text-info\">All</span> as the StationCodes\r\nparameter. Use this value in other rail-related APIs to retrieve\r\ndata about a station.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>LocationName</td>\r\n\r\n<td>Full name of the station where the train is arriving. Useful\r\nwhen passing in <span class=\"text-info\">All</span> as the\r\nStationCodes parameter.</td>\r\n</tr>\r\n\r\n<tr>\r\n<td>Min</td>\r\n\r\n<td>Minutes until arrival. Can be a numeric value, <span class=\r\n\"text-info\">ARR</span> (arriving), <span class=\r\n\"text-info\">BRD</span> (boarding), <span class=\r\n\"text-info\">---</span>, or empty.</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<hr>",
        "operationId": "547636a6f918230da855363f",
        "parameters": [
          {
            "default": "B03",
            "description": "Comma-separated list of station codes.  For all predictions, use \"All\".",
            "enum": [
              "B03",
              "All"
            ],
            "in": "path",
            "name": "StationCodes",
            "required": true,
            "type": "string"
          }
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "Default return code.",
            "examples": {
              "application/json": "{\"Trains\":[{\"Car\":\"6\",\"Destination\":\"SilvrSpg\",\"DestinationCode\":\"B08\",\"DestinationName\":\"Silver Spring\",\"Group\":\"1\",\"Line\":\"RD\",\"LocationCode\":\"A01\",\"LocationName\":\"Metro Center\",\"Min\":\"3\"},{\"Car\":\"6\",\"Destination\":\"Grsvnor\",\"DestinationCode\":\"A11\",\"DestinationName\":\"Grosvenor-Strathmore\",\"Group\":\"2\",\"Line\":\"RD\",\"LocationCode\":\"A01\",\"LocationName\":\"Metro Center\",\"Min\":\"4\"},{\"Car\":\"6\",\"Destination\":\"Shady Gr\",\"DestinationCode\":\"A15\",\"DestinationName\":\"Shady Grove\",\"Group\":\"2\",\"Line\":\"RD\",\"LocationCode\":\"A01\",\"LocationName\":\"Metro Center\",\"Min\":\"6\"},{\"Car\":\"8\",\"Destination\":\"Glenmont\",\"DestinationCode\":\"B11\",\"DestinationName\":\"Glenmont\",\"Group\":\"1\",\"Line\":\"RD\",\"LocationCode\":\"A01\",\"LocationName\":\"Metro Center\",\"Min\":\"8\"},{\"Car\":\"6\",\"Destination\":\"SilvrSpg\",\"DestinationCode\":\"B08\",\"DestinationName\":\"Silver Spring\",\"Group\":\"1\",\"Line\":\"RD\",\"LocationCode\":\"A01\",\"LocationName\":\"Metro Center\",\"Min\":\"9\"},{\"Car\":\"6\",\"Destination\":\"Grsvnor\",\"DestinationCode\":\"A11\",\"DestinationName\":\"Grosvenor-Strathmore\",\"Group\":\"2\",\"Line\":\"RD\",\"LocationCode\":\"A01\",\"LocationName\":\"Metro Center\",\"Min\":\"9\"}]}"
            }
          }
        },
        "summary": "JSON - Next Trains"
      }
    }
  }
}