Manual admin sync behavior
Admin sync endpoints expose controlled trigger behavior:/api/admin/teams/syncsupports canonical team provisioning semantics/api/admin/leagues/synctriggers leagues data refresh logic
Webhook-triggered sync behavior
/api/webhooks/leagues-syncis triggered by theleaguesrepository workflow.- Requests require valid webhook secret headers.
- Successful runs update backend league/team data consumed by clients.
API response shapes consumed by clients
/api/teamsreturns enriched team payloads (counts, ranking context, league linkage, never-nullsport).GET /api/teams?slug=returns a single team. Archived-team slug checks are case-insensitive.GET /api/teams/{id}is public and resolves id first, then slug. The payload matches a list entry plusteamRecord,foundedDate, andviewerCanPostAsTeam. Archived or unknown teams return404. A missing id returns400.- Starred HQ teams (
/api/me/starred-teams) are bookmarks, not follows. The cap is 50 clubs.PUTis idempotent and returns409 STARRED_TEAMS_LIMITfor a new id past the cap.POSTmerges a client snapshot and reportsskippedplusrejectedinstead of failing the batch. GET /api/teams/searchfilters byq(max 64),sport,league,cursor,limit(1–50), andsort(rank|name|fans).GET /api/config/sportsgroups leagues byLeague.sport. There is no second hardcoded catalog.GET /api/user/teamsreturns{ joinedTeamIds, followedTeamIds }.POST/DELETE /api/teams/{id}/joinmutates leaderboard membership only and is idempotent.TeamFollowis unchanged.GET /api/teams/{id}/rosteris public and returns activePlayerrows for the lineup builder. Each player may includephotoandavailability; both are omitted when empty or available./api/leaguesreturns league metadata and color/logo payloads.GET /api/teams/{id}/head-to-head?opponentId=is public and returns{ record, meetings }for the five most recent decided meetings from the team’s perspective. MissingopponentIdoropponentIdequal to{id}returns400.GET /api/teams/{id}/achievementsis public and returns the team’s badges.GET /api/leagues/{leagueId}/standingsreturns{ rows, tiebreakRules, tables }.rowsis one team each (division, else conference, else league).tableslists every remaining scope. Prefer unique vendor rank inside a table; otherwise points, wins, then goal difference.tiebreakRulesnames that fallback only.- Client apps should tolerate propagation delay immediately after sync events.
Troubleshooting checklist
- Verify source repo workflow completed successfully.
- Confirm webhook auth configuration.
- Re-run admin sync routes for remediation if needed.
- Validate refreshed payloads from
/api/teamsand/api/leagues.
