Skip to main content

Overview

The league settings endpoint fetches comprehensive configuration data for your Yahoo Fantasy Basketball league, including scoring settings, roster positions, stat categories, and league rules.

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.

Response

fantasy_content
object
The root object containing all league settings from Yahoo Fantasy API

Error Responses

error
string
Error message describing what went wrong

Possible Errors

  • 400 Bad Request - No league selected in session
    {"error": "no league chosen"}
    
  • 500 Internal Server Error - Failed to fetch settings from Yahoo API
    {"error": "Error message details"}
    

Example Request

curl -X GET "https://your-domain.com/api/league_settings" \
  -H "Cookie: session=your-session-cookie"

Implementation Details

This endpoint is implemented in main.py:492-500 and performs the following:
  1. Validates that a league is selected in the user’s session
  2. Calls the Yahoo Fantasy API: fantasy/v2/league/{league_key}/settings
  3. Logs successful retrieval or error details
  4. Returns the complete Yahoo API response as JSON
  5. Returns a 500 error with exception details if the Yahoo API call fails

Use Cases

  • Display league rules and configuration to users
  • Determine scoring categories for analysis
  • Extract roster position requirements
  • Identify playoff structure and timing
  • Validate league type (head-to-head, rotisserie, etc.)

Build docs developers (and LLMs) love