{"openapi":"3.1.0","info":{"title":"Hockey Line Leagues Agent API","version":"1.0.0","description":"Run a rink's hockey leagues programmatically: leagues, seasons, teams, rosters, round-robin schedules, scores, and standings. Same tools are available over MCP at /api/mcp."},"servers":[{"url":"https://hockeylineapp.com"}],"components":{"securitySchemes":{"apiKey":{"type":"http","scheme":"bearer","description":"Org API key (rk_...) from the dashboard's Settings → API keys."}}},"paths":{"/api/v1/me":{"get":{"operationId":"whoAmI","summary":"The organization and role this API key is scoped to","security":[{"apiKey":[]}],"responses":{"200":{"description":"Org, key role, and subscription state."}}}},"/api/v1/tools/get_org_overview":{"post":{"operationId":"get_org_overview","summary":"List the org's existing leagues, seasons, and teams so you can reference real IDs. Call this before creating things that depend on existing entities.","description":"List the org's existing leagues, seasons, and teams so you can reference real IDs. Call this before creating things that depend on existing entities. Minimum key role: scorekeeper.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{},"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/create_league":{"post":{"operationId":"create_league","summary":"Create a new league within the organization.","description":"Create a new league within the organization. (Write operation: needs an active subscription.) Minimum key role: admin.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"description":"e.g. \"Adult Beer League\" or \"Youth Travel Hockey\""},"sport":{"type":"string","description":"Defaults to \"hockey\"."}},"required":["name"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/create_season":{"post":{"operationId":"create_season","summary":"Create a season within a league. Teams join with the league's evergreen join code, which always points at the current season. Set carryOverTeams to bring all of the league's returning teams (with divisions, app links and rosters) into the new season.","description":"Create a season within a league. Teams join with the league's evergreen join code, which always points at the current season. Set carryOverTeams to bring all of the league's returning teams (with divisions, app links and rosters) into the new season. (Write operation: needs an active subscription.) Minimum key role: admin.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"leagueId":{"type":"string"},"name":{"type":"string","description":"e.g. \"Winter 2026\""},"startDate":{"type":"string","description":"ISO date"},"endDate":{"type":"string","description":"ISO date"},"carryOverTeams":{"type":"boolean","description":"Bring all returning teams from previous seasons into this one."}},"required":["leagueId","name"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/add_teams":{"post":{"operationId":"add_teams","summary":"Add one or more teams to a season.","description":"Add one or more teams to a season. (Write operation: needs an active subscription.) Minimum key role: admin.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"seasonId":{"type":"string"},"teamNames":{"type":"array","items":{"type":"string"},"minItems":1},"division":{"type":"string"}},"required":["seasonId","teamNames"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/update_team":{"post":{"operationId":"update_team","summary":"Rename a team or change its division or color (hex, e.g. \"#1d4ed8\"). Name and color changes carry to the team's persistent identity across seasons.","description":"Rename a team or change its division or color (hex, e.g. \"#1d4ed8\"). Name and color changes carry to the team's persistent identity across seasons. (Write operation: needs an active subscription.) Minimum key role: admin.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"leagueTeamId":{"type":"string"},"teamName":{"type":"string","minLength":1,"maxLength":120},"division":{"anyOf":[{"type":"string","maxLength":60},{"type":"null"}]},"color":{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"}},"required":["leagueTeamId"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/add_players":{"post":{"operationId":"add_players","summary":"Add players to a team's roster.","description":"Add players to a team's roster. (Write operation: needs an active subscription.) Minimum key role: admin.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"leagueTeamId":{"type":"string"},"players":{"type":"array","items":{"type":"object","properties":{"firstName":{"type":"string"},"lastName":{"type":"string"},"jerseyNumber":{"type":"number"},"position":{"type":"string","description":"One of C, LW, RW, LD, RD, G"}},"required":["firstName","lastName"],"additionalProperties":false},"minItems":1}},"required":["leagueTeamId","players"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/set_season_status":{"post":{"operationId":"set_season_status","summary":"Change a season's status: \"setup\" (pre-launch), \"active\" (in play, visible publicly), or \"completed\" (season over).","description":"Change a season's status: \"setup\" (pre-launch), \"active\" (in play, visible publicly), or \"completed\" (season over). (Write operation: needs an active subscription.) Minimum key role: admin.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"seasonId":{"type":"string"},"status":{"type":"string","enum":["setup","active","completed"]}},"required":["seasonId","status"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/generate_round_robin":{"post":{"operationId":"generate_round_robin","summary":"Generate a round-robin schedule for a season. Games are placed on game nights (every intervalDays) in the rink's local timezone, filling the night's time slots (gameTimes) without any team playing twice in one night. Teams only play opponents in their own division. Set replaceExisting to regenerate (deletes the season's scheduled-but-unplayed games first).","description":"Generate a round-robin schedule for a season. Games are placed on game nights (every intervalDays) in the rink's local timezone, filling the night's time slots (gameTimes) without any team playing twice in one night. Teams only play opponents in their own division. Set replaceExisting to regenerate (deletes the season's scheduled-but-unplayed games first). (Write operation: needs an active subscription.) Minimum key role: admin.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"seasonId":{"type":"string"},"startDate":{"type":"string","description":"First game night as a local date, e.g. \"2026-07-01\""},"gameTimes":{"type":"array","items":{"type":"string","pattern":"^\\d{1,2}:\\d{2}$"},"description":"Time slots per game night in 24h local time, e.g. [\"20:00\",\"21:15\",\"22:30\"]. Default one game per night at 20:00."},"intervalDays":{"type":"number","description":"Days between game nights. Default 7 (weekly)."},"doubleRoundRobin":{"type":"boolean","description":"If true, each pair plays twice (home & away)."},"location":{"type":"string"},"replaceExisting":{"type":"boolean","description":"Delete the season's scheduled (unplayed) games before generating."}},"required":["seasonId","startDate"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/get_standings":{"post":{"operationId":"get_standings","summary":"Current standings for a season (per division): W/L/T/OTL, goals for/against, points, streak. Computed from finalized games using the season's configured point values.","description":"Current standings for a season (per division): W/L/T/OTL, goals for/against, points, streak. Computed from finalized games using the season's configured point values. Minimum key role: scorekeeper.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"seasonId":{"type":"string"}},"required":["seasonId"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/get_schedule":{"post":{"operationId":"get_schedule","summary":"A season's schedule and results: every game with date (UTC ISO — the rink's local timezone is in get_org_overview), teams, location, status, and score.","description":"A season's schedule and results: every game with date (UTC ISO — the rink's local timezone is in get_org_overview), teams, location, status, and score. Minimum key role: scorekeeper.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"seasonId":{"type":"string"},"teamId":{"type":"string","description":"Only this team's games."},"status":{"type":"string","enum":["scheduled","in_progress","final","postponed","cancelled"]}},"required":["seasonId"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/get_game":{"post":{"operationId":"get_game","summary":"Full detail for one game: score, goals with scorers/assists, penalties, period shots, goalie stats.","description":"Full detail for one game: score, goals with scorers/assists, penalties, period shots, goalie stats. Minimum key role: scorekeeper.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"gameId":{"type":"string"}},"required":["gameId"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/get_roster":{"post":{"operationId":"get_roster","summary":"A team's roster: players with jersey numbers, positions, type, and eligibility.","description":"A team's roster: players with jersey numbers, positions, type, and eligibility. Minimum key role: scorekeeper.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"leagueTeamId":{"type":"string"}},"required":["leagueTeamId"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/schedule_game":{"post":{"operationId":"schedule_game","summary":"Schedule a single game between two teams in a season. Date/time is ISO 8601 (UTC or with offset).","description":"Schedule a single game between two teams in a season. Date/time is ISO 8601 (UTC or with offset). (Write operation: needs an active subscription.) Minimum key role: admin.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"seasonId":{"type":"string"},"homeTeamId":{"type":"string"},"awayTeamId":{"type":"string"},"gameDate":{"type":"string","format":"date-time"},"location":{"type":"string","maxLength":200}},"required":["seasonId","homeTeamId","awayTeamId","gameDate"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/update_game":{"post":{"operationId":"update_game","summary":"Reschedule a game, change its location, or mark it postponed/cancelled.","description":"Reschedule a game, change its location, or mark it postponed/cancelled. (Write operation: needs an active subscription.) Minimum key role: admin.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"gameId":{"type":"string"},"gameDate":{"type":"string","format":"date-time"},"location":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}]},"status":{"type":"string","enum":["scheduled","postponed","cancelled"]}},"required":["gameId"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/record_score":{"post":{"operationId":"record_score","summary":"Record a game's final score and mark it final. Set isOvertime/isShootout when the game went past regulation (drives W vs OTL in standings). Updates standings, playoff series, and suspension served-counts.","description":"Record a game's final score and mark it final. Set isOvertime/isShootout when the game went past regulation (drives W vs OTL in standings). Updates standings, playoff series, and suspension served-counts. (Write operation: needs an active subscription.) Minimum key role: scorekeeper.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"gameId":{"type":"string"},"homeScore":{"type":"integer","minimum":0,"maximum":99},"awayScore":{"type":"integer","minimum":0,"maximum":99},"isOvertime":{"type":"boolean"},"isShootout":{"type":"boolean"}},"required":["gameId","homeScore","awayScore"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/update_player":{"post":{"operationId":"update_player","summary":"Update a rostered player's jersey number, position, name, or eligibility.","description":"Update a rostered player's jersey number, position, name, or eligibility. (Write operation: needs an active subscription.) Minimum key role: admin.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"leaguePlayerId":{"type":"string"},"firstName":{"type":"string","minLength":1},"lastName":{"type":"string","minLength":1},"jerseyNumber":{"anyOf":[{"type":"integer","minimum":0,"maximum":99},{"type":"null"}]},"position":{"anyOf":[{"type":"string","enum":["C","LW","RW","LD","RD","G"]},{"type":"null"}]},"isEligible":{"type":"boolean"}},"required":["leaguePlayerId"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}},"/api/v1/tools/remove_player":{"post":{"operationId":"remove_player","summary":"Remove a player from a team's roster. Their goals come off the board (scores adjust); assists on others' goals are kept without attribution.","description":"Remove a player from a team's roster. Their goals come off the board (scores adjust); assists on others' goals are kept without attribution. (Write operation: needs an active subscription.) Minimum key role: admin.","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"leaguePlayerId":{"type":"string"}},"required":["leaguePlayerId"],"additionalProperties":false,"$schema":"http://json-schema.org/draft-07/schema#"}}}},"responses":{"200":{"description":"Tool result. Mutations return { ok: true, ... } or { ok: false, error }."},"400":{"description":"Input failed schema validation."},"401":{"description":"Missing or invalid API key."},"402":{"description":"Write operation without an active subscription."},"403":{"description":"Key role not allowed for this tool."}}}}}}