All authenticated endpoints require a JWT.Documentation Index
Fetch the complete documentation index at: https://docs.sportsxapp.com/llms.txt
Use this file to discover all available pages before exploring further.
STX.Sdk acquires, caches, and refreshes the token for you — in most apps you call LoginAsync once at startup and never touch the token directly. The sections below cover the cases where you need more control.
Simple login
LoginAsync returns an STXUserDataCollection with the following fields:
| Field | Description |
|---|---|
Token | Bearer token attached to every subsequent GraphQL call |
RefreshToken | Used by STXTokenService.RefreshTokenAsync |
UserId, UserUid, SessionId | Identifiers used by WebSocket channel subscriptions |
CurrentLoginAt | Timestamp of the login event |
PromptTncAcceptance | true when the user still needs to accept updated T&Cs |
STXUserStorage and attached to every subsequent GraphQL call. You never need to pass it manually.
Two-factor authentication
If the account has 2FA enabled, the initialLoginAsync call returns partial user data. Authentication is not complete until you confirm the one-time code:
The 2FA flow calls the same
confirm2Fa GraphQL mutation used by other SportsX SDK clients.Keep the session alive
Long-running bots should refresh the JWT before it expires. PasskeepSessionAlive: true and the SDK’s STXSessionBackgroundService handles refresh in the background:
- The service provider must be hosted under
Host.CreateDefaultBuilderso background services actually run. - Credentials stay in memory in
STXUserStorageso the background service can re-login if the refresh token itself expires.
Manual token refresh
If you prefer explicit control over refresh timing — for example in a minimal script that doesn’t run under a full host — wrap your trading calls like this:Accept terms and conditions
IfPromptTncAcceptance is true after login, subsequent authenticated calls will fail until the user accepts the latest terms. Pass checkTermsAndConditions: true to surface the T&Cs text for display:
Logout
There is no server-side logout call. To end the session, clear the stored token:Authentication errors
| Exception | Cause | Recovery |
|---|---|---|
STXWrongCredentialsException | Email or password rejected | Prompt the user for fresh credentials |
STXTokenExpiredException | JWT expired; refresh token still valid | Call STXTokenService.RefreshTokenAsync |
STXSessionExpiredException | Both token and refresh token expired | Call STXLoginService.LoginAsync again |
STXGeoComplyException | Geo-compliance check failed | User is outside a permitted jurisdiction — surface to your UI |