Get Leaderboard Around User
horizon_get_leaderboard_aroundFetch the leaderboard entries directly above and below a player's position to show local rivals, including the player and each profile.
Instructions
Returns the leaderboard entries directly above and below a player's own position, including the player, each with profile. Use when: a game shows 'you and your rivals' instead of the global top. Not for: the global top list (use horizon_get_leaderboard_top) or the position alone (use horizon_get_user_rank). Requires: a userId from horizon_signup_* or horizon_signin_*; no session token. Side effects: None (read only). Returns: {entries: [{position, username, score, profile}]} in board order. profile is {avatarId, frameId, badges} (IDs from the cosmetics catalog; null or [] when not set, set with horizon_set_profile). Errors: 404 for an unknown leaderboardKey: list valid keys with horizon_list_leaderboards. Needs HORIZON_API_KEY. Every failure returns an error result (isError) with the HTTP status and body: a 401 that horizon_test_connection also returns means HORIZON_API_KEY is wrong, 429 means the account's per-minute rate limit was reached (wait a minute, then retry).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| range | No | How many entries around the player to return, 1 to 50 (default 10) | |
| userId | Yes | Player user ID (UUID) from horizon_signup_* or horizon_signin_* | |
| leaderboardKey | No | Board key from horizon_list_leaderboards (1 to 64 characters: a-z, 0-9, _ and -). Omit to use the API key's default board. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| entries | No |