API Docs

Transit API

Real‑time NYC subway and LIRR train positions, free for non‑commercial use.

Rate limits

Without API key: 60 requests/min per IP

With API key: 600 requests/min

Commercial use or higher limits? Contact us for an API key.

Authentication

API keys are optional for public access. If you have one, include it via:

x-client-key: YOUR_KEY
# or
Authorization: Bearer YOUR_KEY

GET /api/transit/mta

Live subway train positions across all lines.

curl https://trainETA.com/api/transit/mta

Response:

{
  "ok": true,
  "activeStops": [
    {
      "lineId": "A",
      "trainId": "A01",
      "stopId": "A24",
      "stationName": "34 St-Penn Station",
      "coords": [-73.9912, 40.7527],
      "status": "stopped",
      "nextStopId": "A25",
      "nextStationName": "23 St",
      "arrivalTime": 1704067200000
    }
  ]
}

GET /api/transit/lirr

Live LIRR train positions. Same response shape as the subway endpoint.

curl https://trainETA.com/api/transit/lirr

GET /api/status

Service health and feed freshness.

curl https://trainETA.com/api/status

Response:

{
  "ok": true,
  "timestamp": "2024-01-01T12:00:00.000Z",
  "feedConfigured": true,
  "hasMetrics": true,
  "metrics": {
    "updatedAt": 1704110400000,
    "feedTimestamp": 1704110395000,
    "activeStopsCount": 1355,
    "arrivingCount": 328,
    "stoppedCount": 334,
    "inTransitCount": 693,
    "linesActive": { "A": 84, "1": 53, ... }
  }
}

Error responses

429 Too Many Requests — Rate limit exceeded. Check Retry-After header.

401 Unauthorized — Invalid API key provided.

503 Service Unavailable — Feed temporarily unavailable.