Overview
The draft keepers endpoint provides comprehensive keeper player data for your Yahoo Fantasy Basketball league. It fetches keeper designations for the current season and, when available, automatically retrieves keeper data from the previous season for comparison.Authentication
Requires an active user session with a selected league.Request
This endpoint does not accept any query parameters. It automatically uses the league selected in the user’s session and attempts to fetch previous season data when available.Response
The endpoint returns a structured JSON object containing keeper information organized by team.Array of all teams in the league with metadata
Object mapping team keys to arrays of keeper players
Array of keeper players without an associated team (rare edge case)
Comprehensive metadata about the league and keeper data
Previous season keeper data (only included if previous season exists)
Example Success Response
Error Responses
Error message describing what went wrong
Possible Errors
-
401 Unauthorized - User not authenticated
-
400 Bad Request - No league selected
-
502 Bad Gateway or other status - Yahoo API error
-
500 Internal Server Error - Unexpected error
Example Request
Implementation Details
This endpoint is implemented inmain.py:502-695 and performs a sophisticated multi-step process:
Data Fetching
- Fetches current season keeper players:
fantasy/v2/league/{league_key}/players;status=K;out=ownership - Fetches current season team data:
fantasy/v2/league/{league_key}/teams - Optionally fetches league settings for additional context
- Attempts to identify and fetch previous season data automatically
Previous Season Discovery
The endpoint intelligently discovers previous season league keys through:- Checking
renewedfield in league payload - Checking
renewfield as fallback - Normalizing league key formats (handles both
game.l.leagueandgame_leagueformats)
NBA Player ID Enrichment
For each keeper player, the endpoint:- Calls
_lookup_nba_player_id()to match Yahoo player names to NBA API player IDs - Uses sophisticated name normalization to handle name variations
- Caches lookups for performance
- Returns
nullif no match is found
User Team Identification
The endpoint identifies the current user’s teams using multiple signals:- Session team name matching (case-insensitive)
- Manager GUID matching across seasons
- Team ID matching across seasons
is_current_loginflag from Yahoo API
- Team names change between seasons
- Multiple teams are owned by the same user
- Manager accounts are shared
Data Organization
Keepers are organized by team key for efficient lookup:- Players sorted alphabetically by full name within each team
- Orphaned players (missing
owner_team_key) tracked separately - Metadata includes counts for quick overview
Use Cases
- Display keeper selections in draft preparation tools
- Compare current vs. previous season keeper decisions
- Build keeper value analysis and trends
- Show which players are unavailable in upcoming drafts
- Identify keeper patterns across the league
- Help users make keeper selection decisions
Notes
- Previous season data is best-effort; not all leagues expose prior season links
- NBA ID matching is fuzzy and may not find all players (especially rookies)
- The
fallback_to_previousflag suggests when to display previous season data - Empty keeper lists may indicate pre-draft timing or leagues without keeper rules
- Manager GUID matching works across seasons for consistent user identification
Related Endpoints
- League Settings - May contain keeper-related league rules
- Season Averages - Can be used to evaluate keeper player performance