Tournament API
The Pool Tournament feature allows end users to join pre-created tournaments and earn rewards based on their ranking at the end of the matchup.
The outcome and payout structure of each pool must be provided to Lucra using these API endpoints
Methods
retrieveTournament
Retrieve a tournament with a given ID.
Parameters:
tournamentId: ID associated with the tournament.onResult: Callback with a result of typeRetrieveTournamentResult
Example usage:
LucraClient().retrieveTournament(tournamentId = "tournamentId") { result ->
when (result) {
is RetrieveTournamentResult.Failure -> {
// Handle failure scenario
}
RetrieveTournamentResult.Success -> {
// Handle success scenario
}
}
}queryRecommendedTournaments
Retrieve a list of recommended tournaments.
Parameters:
limit: The max number tournaments that will be returned.offset: The starting index of the query.includeCompletedTournaments: Should completed tournaments be included in the query.onResult: Callback with a result of typeQueryRecommendedTournamentsResult
Example usage:
submitUserScore
Submit a tournament score for a user.
Parameters:
score: The score for the given attempt.tournamentId: The unique ID of the tournament.isFinal: If this is the user's final attempt.metadata: The metadata to include with the payload.onResult: Callback with a result of typeSubmitTournamentScoreResult;
Example usage:
Errors:
Throws an error if:
The user is not in a valid state to submit a score.
Request is has invalid data
Location services fail to provide coordinates.
A general network or API error occurs.
submitUserScoreByMetadata
Submit a tournament score by matching metadata criteria instead of a tournament ID.
Parameters:
score: The score for the given attempt.metadata: The metadata to include with the payload.matchupMetadata: Optional metadata to match against existing matchups.gameId: Optional game identifier.locationId: Optional location identifier.matchupId: Optional Lucra matchup identifier.isFinal: If this is the user's final attempt.onResult: Callback with a result of typeSubmitTournamentScoreMatchingResult.
Example usage:
Errors:
Throws an error if:
The user is not in a valid state to submit a score.
Request is has invalid data
Location services fail to provide coordinates.
A general network or API error occurs.
searchMatchupsByMetadata
Search for matchups by metadata and return Lucra matchup IDs.
Parameters:
gameId: Optional game identifier.locationId: Optional location identifier.matchupId: Optional Lucra matchup identifier.matchupMetadata: Optional metadata map to match against.onResult: Callback with a result of typeSearchMatchupsByMetadataResult.
Example usage:
Errors:
Throws an error if:
Location services fail to provide coordinates.
A general network or API error occurs.
joinTournament
Join a tournament with a given ID.
Parameters:
tournamentId: ID associated with the tournament.onResult: Callback with a result of typeJoinTournamentResult
Example usage:
Errors:
Throws an error if:
The user is not in a valid state to join.
Location services fail to provide coordinates.
Compliance validation fails.
If free buy in tournament, user demographic info is missing
Insufficient funds prevent the user from joining.
A general network or API error occurs.
Generic Errors:
All the Failure responses above are subtypes of FailedTournamentCall. This serves as a general way to parse errors coming from the tournament headless calls.
User State Errors (account-related issues)
NotInitialized- User session not properly set up or account data missingUnverified- User hasn't completed identity verification (KYC) for real-money tournamentsNotAllowed- User account restricted, suspended, or ineligibleInsufficientFunds- Not enough balance for paid tournament entryDemographicInformationMissing- Missing email/zip code for free tournaments
Location Errors
LocationError- Geographic restrictions (banned states, location services disabled, GeoComply failures)
API Errors
APIError- Network issues, server errors, invalid responses, rate limits
FailedTournamentCall
These errors occur during tournament operations (retrieve, join, query, submit score) and help determine the appropriate user-facing message and recovery action.
Example usage:
Headless join with handling for missing demographic info.
Launching Demographic Form Independently
This feature was introduced in SDK version 5.0.0 and enhances the free buy-in tournament joining experience by ensuring users provide minimum necessary demographic information for compliance and improved user experience.
3. Manual Demographic Data Validation
Migration Guide
For Existing Integrators
If you're updating from an older SDK version:
Additive change - existing tournament joining code continues to work
New error handling - add handling for
DemographicInformationMissingerror
Example Migration
Before:
After:
Troubleshooting
Common Issues
Demographic form not launching for free tournaments.
Ensure user authentication is complete before attempting to join tournaments
Form not auto-filling previously entered data
The form should auto-fill based on saved user data. If not working, check user authentication state
DemographicInformationMissingerror not being handled.Add the new error case to your tournament joining error handling
Last updated
