{
  "name": "TrackTO API",
  "version": "4.0.0",
  "base": "http://localhost:3000",
  "rateLimit": "120 requests/minute per IP",
  "endpoints": [
    {
      "method": "GET",
      "path": "/api/v1/vehicles",
      "params": [
        "since (ts)",
        "route (tag)"
      ],
      "desc": "Live vehicle positions. Use ?since= for delta updates (only changed vehicles)."
    },
    {
      "method": "GET",
      "path": "/api/v1/vehicles/trail",
      "params": [
        "id (required)"
      ],
      "desc": "Position history trail for a specific vehicle."
    },
    {
      "method": "GET",
      "path": "/api/v1/routes",
      "params": [],
      "desc": "All TTC routes. Cached 1 hour."
    },
    {
      "method": "GET",
      "path": "/api/v1/route",
      "params": [
        "tag (required)"
      ],
      "desc": "Route detail: stops, paths, directions, live vehicle count, bunching."
    },
    {
      "method": "GET",
      "path": "/api/v1/arrivals",
      "params": [
        "stop (required)",
        "route"
      ],
      "desc": "Arrival predictions at a stop."
    },
    {
      "method": "GET",
      "path": "/api/v1/alerts",
      "params": [
        "route"
      ],
      "desc": "Live service alerts. Cached 90s. Filter by route with ?route=."
    },
    {
      "method": "GET",
      "path": "/api/v1/bunching",
      "params": [
        "route"
      ],
      "desc": "Detect vehicle bunching (<400m apart on same route)."
    },
    {
      "method": "GET",
      "path": "/api/v1/subway",
      "params": [],
      "desc": "Subway Lines 1-4 live status."
    },
    {
      "method": "GET",
      "path": "/api/v1/stops/search",
      "params": [
        "q (name)",
        "id (stop number)"
      ],
      "desc": "Search stops by name or stop number."
    },
    {
      "method": "GET",
      "path": "/api/v1/stops/nearby",
      "params": [
        "lat",
        "lng",
        "radius (m)",
        "limit"
      ],
      "desc": "Stops within radius metres of a coordinate."
    },
    {
      "method": "GET",
      "path": "/api/v1/trip",
      "params": [
        "from (stop tag)",
        "to (stop tag)"
      ],
      "desc": "Trip planner: find routes or transfers between two stops."
    },
    {
      "method": "GET",
      "path": "/api/v1/messages",
      "params": [
        "route"
      ],
      "desc": "Service messages for a route."
    },
    {
      "method": "GET",
      "path": "/api/v1/health",
      "params": [],
      "desc": "API health, uptime, vehicle count, stop index status."
    },
    {
      "method": "GET",
      "path": "/api/docs",
      "params": [],
      "desc": "This document."
    }
  ],
  "examples": [
    "http://localhost:3000/api/v1/vehicles?since=0",
    "http://localhost:3000/api/v1/vehicles?route=501",
    "http://localhost:3000/api/v1/vehicles/trail?id=4231",
    "http://localhost:3000/api/v1/route?tag=501",
    "http://localhost:3000/api/v1/arrivals?stop=3318&route=501",
    "http://localhost:3000/api/v1/bunching?route=504",
    "http://localhost:3000/api/v1/stops/search?q=spadina",
    "http://localhost:3000/api/v1/stops/nearby?lat=43.6532&lng=-79.3832&radius=300",
    "http://localhost:3000/api/v1/trip?from=3318&to=3007",
    "http://localhost:3000/api/v1/subway",
    "http://localhost:3000/api/v1/alerts?route=501"
  ]
}