{"openapi":"3.1.0","info":{"title":"IMTF API","description":"Is My Train Fucked? - NYC Subway Status API","version":"1.0.0","contact":{"name":"Chris Becker","url":"https://github.com/Cbeck527/imtf-api"}},"servers":[{"url":"https://api.ismytrainfucked.com","description":"Production server"},{"url":"http://localhost:8787","description":"Local development server"}],"tags":[{"name":"Alerts","description":"Subway status and alerts endpoints"},{"name":"System","description":"System and health check endpoints"}],"components":{"schemas":{"HealthResponse":{"type":"object","properties":{"status":{"type":"string","enum":["ok"],"example":"ok","description":"Health status"},"timestamp":{"type":"string","example":"2025-01-06T12:00:00Z","description":"Current server time in ISO 8601 format"},"service":{"type":"string","enum":["imtf-api"],"example":"imtf-api","description":"Service name"}},"required":["status","timestamp","service"]},"Alert":{"type":"object","properties":{"type":{"type":"string","example":"Delays","description":"Type of service alert"},"header":{"type":"string","example":"Delays on the 4, 5, 6 lines","description":"Brief description of the alert"},"description":{"type":"string","example":"Due to signal problems at 14 St-Union Sq","description":"Detailed description of the alert"}},"required":["type","header","description"]},"SubwayLine":{"type":"object","properties":{"id":{"type":"string","example":"4","description":"Line identifier (e.g., 1, 2, 3, A, C, E)"},"name":{"type":"string","example":"4","description":"Display name of the line"},"status":{"type":"string","example":"Good Service","description":"Current service status","enum":["Good Service","Delays","Service Change"]},"alerts":{"type":"array","items":{"$ref":"#/components/schemas/Alert"},"description":"Active alerts for this line"}},"required":["id","name","status","alerts"]},"TrunkLine":{"type":"object","properties":{"id":{"type":"string","example":"456","description":"Trunk line identifier"},"name":{"type":"string","example":"IRT Lexington Avenue Line","description":"Official name of the trunk line"},"lines":{"type":"array","items":{"$ref":"#/components/schemas/SubwayLine"},"description":"Individual lines in this trunk"},"status":{"type":"string","example":"Good Service","description":"Overall status of the trunk line","enum":["Good Service","Delays","Service Change"]}},"required":["id","name","lines","status"]},"SubwayStatusResponse":{"type":"object","properties":{"trunkLines":{"type":"array","items":{"$ref":"#/components/schemas/TrunkLine"},"description":"All trunk lines in the subway system"},"fetchedAt":{"type":"string","example":"2025-01-06T12:00:00Z","description":"ISO 8601 timestamp of when data was fetched"},"cacheExpires":{"type":"string","example":"2025-01-06T12:01:00Z","description":"ISO 8601 timestamp of when cache expires"}},"required":["trunkLines","fetchedAt","cacheExpires"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"string","example":"Failed to fetch subway status","description":"Error message"},"details":{"type":"string","example":"MTA API error: 503","description":"Additional error details"}},"required":["error"]}},"parameters":{}},"paths":{"/health":{"get":{"summary":"Health check","description":"Returns the health status of the API","tags":["System"],"responses":{"200":{"description":"API is healthy","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/v1/alerts":{"get":{"summary":"Get subway status","description":"Returns current status of all NYC subway trunk lines with any active alerts","tags":["Alerts"],"responses":{"200":{"description":"Successful response with subway status","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubwayStatusResponse"}}}},"500":{"description":"Server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}