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 type RetrieveTournamentResult

  • 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 type QueryRecommendedTournamentsResult

  • 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 type SubmitTournamentScoreResult;

  • 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 type SubmitTournamentScoreMatchingResult.

  • 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 type SearchMatchupsByMetadataResult.

  • 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 type JoinTournamentResult

  • 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.

    • 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 missing

  • Unverified - User hasn't completed identity verification (KYC) for real-money tournaments

  • NotAllowed - User account restricted, suspended, or ineligible

  • InsufficientFunds - Not enough balance for paid tournament entry

  • DemographicInformationMissing - 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

circle-info

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:

  1. Additive change - existing tournament joining code continues to work

  2. New error handling - add handling for DemographicInformationMissing error

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

  • DemographicInformationMissing error not being handled.

    • Add the new error case to your tournament joining error handling

Last updated