## get_private_leaderboard()


Retrieve a private leaderboard for a given year.


Usage

``` python
get_private_leaderboard(
    year, board_id, session=None, view_key=None, fmt=OutputFormat.MODEL
)
```


Use a session cookie with access to the board or the board's read-only view key. The default output is a structured leaderboard model.


## Parameters


`year: int`  
The event year.

`board_id: int`  
The numeric ID of the private leaderboard.

`session: str | None = None`  
A session token. If omitted and no view key is provided, the value of `AOC_SESSION` is used.

`view_key: str | None = None`  
The read-only "share code" for the leaderboard. When present, a session token is optional.

`fmt: OutputFormat = OutputFormat.MODEL`  
[MODEL](OutputFormat.md#elf.OutputFormat.MODEL) returns a Leaderboard, [TABLE](OutputFormat.md#elf.OutputFormat.TABLE) returns a Rich table, [JSON](OutputFormat.md#elf.OutputFormat.JSON) preserves the Advent of Code payload, and [CSV](OutputFormat.md#elf.OutputFormat.CSV) produces one summary row per member.


## Returns


`Leaderboard | str | Table`  
A structured leaderboard model, CSV or JSON string, or formatted table, depending on `fmt`.


## Raises


`MissingSessionTokenError`  
If no session token is available and no view key is provided.

`LeaderboardFetchError`  
If fetching, decoding, validating, or reading the cache fails.

`ValueError`  
If the year predates Advent of Code, the board ID is nonpositive, or the output format is unsupported.


## Notes

Responses are cached for 15 minutes per event, board, and credential. When a view key is provided, it determines the cache scope.
