{"openapi":"3.0.3","info":{"title":"ERstat Public API","version":"1.0.0","description":"Live Canadian emergency-room closures, reopenings and service disruptions as JSON, plus per-province coverage. Free for non-commercial use with attribution (a visible link to erstat.ca). Every request needs a free API key, created in your ERstat account. Commercial use, historical data and bulk export require a licence: see https://erstat.ca/licensing. A keyless embeddable widget is available at https://erstat.ca/embed.","termsOfService":"https://erstat.ca/licensing","contact":{"name":"ERstat","url":"https://erstat.ca/developers"}},"externalDocs":{"description":"Developer guide","url":"https://erstat.ca/developers"},"servers":[{"url":"https://erstat.ca"}],"security":[{"ApiKeyHeader":[]},{"ApiKeyQuery":[]}],"paths":{"/api/v1/closures":{"get":{"summary":"Current ER closures and disruptions","description":"All Canadian emergency rooms currently closed or under a service disruption. Cached at the edge for ~60 seconds.","operationId":"listClosures","parameters":[{"name":"province","in":"query","required":false,"description":"Two-letter province/territory code (e.g. ON, NS, AB).","schema":{"type":"string","pattern":"^[A-Za-z]{2}$"}}],"responses":{"200":{"description":"Current closures","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClosuresResponse"}}}},"401":{"description":"Missing or invalid API key. Create a free key at https://erstat.ca/account."},"429":{"description":"Rate limit exceeded (free tier)."}}}},"/api/v1/coverage":{"get":{"summary":"Per-province ER coverage","description":"How many ERs each province has and how many publish a live wait time. Cached for ~5 minutes.","operationId":"getCoverage","responses":{"200":{"description":"Coverage by province","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoverageResponse"}}}},"401":{"description":"Missing or invalid API key. Create a free key at https://erstat.ca/account."},"429":{"description":"Rate limit exceeded (free tier)."}}}},"/api/v1/history":{"get":{"summary":"Historical and bulk data (commercial licence)","description":"Historical wait-time and closure data. Requires a commercial API key; response schema and terms are provided with the licence. See https://erstat.ca/licensing.","operationId":"getHistory","responses":{"403":{"description":"A commercial licence is required. See https://erstat.ca/licensing."}}}}},"components":{"securitySchemes":{"ApiKeyHeader":{"type":"apiKey","in":"header","name":"X-API-Key"},"ApiKeyQuery":{"type":"apiKey","in":"query","name":"key"}},"schemas":{"Closure":{"type":"object","properties":{"id":{"type":"string","example":"ns_rosewayhospital"},"name":{"type":"string","example":"Roseway Hospital"},"city":{"type":"string","example":"Shelburne"},"province":{"type":"string","example":"NS"},"status":{"type":"string","enum":["closed","disruption"]},"message":{"type":"string","nullable":true,"example":"ER closed until 8:00 a.m. due to physician unavailability."},"updated_at":{"type":"string","format":"date-time","nullable":true},"expected_reopen":{"type":"string","format":"date-time","nullable":true}}},"ClosuresResponse":{"type":"object","properties":{"version":{"type":"string","example":"v1"},"generated_at":{"type":"string","format":"date-time"},"attribution":{"type":"string"},"count":{"type":"integer"},"closures":{"type":"array","items":{"$ref":"#/components/schemas/Closure"}}}},"ProvinceCoverage":{"type":"object","properties":{"province":{"type":"string","example":"ON"},"ers":{"type":"integer","description":"Total ERs tracked"},"reporting_live":{"type":"integer","description":"ERs publishing a live wait time"},"pct":{"type":"integer","description":"reporting_live as a percentage of ers"}}},"CoverageResponse":{"type":"object","properties":{"version":{"type":"string","example":"v1"},"generated_at":{"type":"string","format":"date-time"},"attribution":{"type":"string"},"national":{"type":"object","properties":{"ers":{"type":"integer"},"reporting_live":{"type":"integer"}}},"provinces":{"type":"array","items":{"$ref":"#/components/schemas/ProvinceCoverage"}}}}}}}