API Reference

Complete technical reference for every class, method, and model in StakeAPI.


🎰 Ready to experience Stake.com?

Create your account and start using StakeAPI with real data today.

Sign Up on Stake.com β†’

Modules

Module What it does
StakeAPI Client Main async client β€” casino, sports, user, and betting methods
AuthManager Token storage, expiry tracking, cURL credential extraction
Data Models Pydantic models: User, Game, SportEvent, Bet, Transaction, Statistics
Endpoints & GraphQL URL constants and pre-built GraphQL query strings
Exceptions Full exception hierarchy with examples and fix guidance
Utilities safe_decimal, format_currency, validate_bet_amount, and more

Quick Navigation

By task

I want to… Go to…
Make my first API call Getting Started β†’ Quick Start
Authenticate with Stake.com Getting Started β†’ Authentication
Get my account balance Client β†’ get_user_balance()
Browse casino games Client β†’ get_casino_games()
Place a bet Client β†’ Betting Methods
Write a raw GraphQL query Endpoints β†’ GraphQL Queries
Handle errors properly Exceptions
Validate / format amounts Utilities

By class

  • StakeAPI β€” get_user_balance(), get_casino_games(), get_sports_events(), dice_roll(), crash_bet(), place_sport_bet(), get_bet_history(), get_user_profile(), _graphql_request()
  • AuthManager β€” set_access_token(), is_token_expired(), extract_access_token_from_curl(), get_cookies()
  • User β€” id, username, verified, country, currency
  • Game β€” name, category, provider, rtp, min_bet, max_bet
  • SportEvent β€” home_team, away_team, odds, live, start_time
  • Bet β€” amount, potential_payout, status, placed_at
  • Transaction β€” type, amount, currency, status
  • Statistics β€” total_bets, win_rate, biggest_win

All Methods at a Glance

StakeAPI β€” Casino

Method Returns Description
get_casino_games(category=None) List[Game] List available games, optionally filtered
get_game_details(game_id) Game Full details for a single game

StakeAPI β€” Sports

Method Returns Description
get_sports_events(sport=None) List[SportEvent] Live and upcoming events

StakeAPI β€” User

Method Returns Description
get_user_profile() User Profile: username, country, verified
get_user_balance() Dict Available and vault balances by currency

StakeAPI β€” Betting

Method Returns Description
dice_roll(...), casino_bet(...), crash_bet(...), place_sport_bet(...), … dict Place a bet (needs allow_betting=True)
get_bet_history(limit=50) List[Bet] Recent bet history

StakeAPI β€” Low-level

Method Returns Description
_graphql_request(query, variables, operation_name) Dict Raw GraphQL call
_request(method, endpoint, params, data) Dict Raw HTTP call
close() β€” Close the HTTP session

AuthManager

Method Returns Description
get_auth_headers() Dict[str, str] Headers with access token
get_cookies() Dict[str, str] Session cookie dict
set_access_token(token, expires_in) β€” Store/update the token
set_session_cookie(cookie) β€” Store/update the session cookie
is_token_expired() bool True if token is stale
clear_tokens() β€” Wipe all stored credentials
extract_access_token_from_curl(cmd) (static) Optional[str] Parse token from cURL
extract_session_from_curl(cmd) (static) Optional[str] Parse session from cURL

Utilities

Function Returns Description
validate_api_key(key) bool Format check
safe_decimal(value) Optional[Decimal] Safe type conversion
parse_datetime(s) Optional[datetime] ISO 8601 parsing
format_currency(amount, currency) str Display string
calculate_win_rate(wins, total) float Win %
validate_bet_amount(amount, min, max) bool Range check
sanitize_game_name(name) str Safe string

πŸ’¬ Join the StakeAPI Community on Discord

Get help, share your projects, discuss strategies, and stay up to date with the latest StakeAPI news.

Join Our Discord Server β†’

✏️ Built with ChipaEditor

ChipaEditor is the ultimate code editor built for speed, simplicity, and power. Try it free today.

Try ChipaEditor Free β†’

All API methods require a valid Stake.com account and a cf_clearance cookie. New to Stake? Sign up here.


Table of contents