Fantasy Sports

Place bets

https:/{your_server}/bets

Is called whenever a user tries to participate one or more tournaments. To cancel the participations respond with a JSON object with an error property and HTTP status 402 Payment Required.

This happens whether the tournaments are free or not. To fulfill the participations, deduct the appropriate amount of money from the user's wallet and respond with an OK.

This callback will be called with:


    
{ headers: { authorization: 'Bearer customer {user_token}' }, body: { bets: [{ user: { // Data about the user creating the fantasy team client: String, // Name of white label, most likely yours uid: String, // Unique ID of user name: String // Username ip: String // Ip of the user }, pool: { // Data about betting pool (tournament) client: String, // Name of white label, most likely yours game: String, // Type of game being played. Should be "fantasy" or "micro" uid: Integer, // Id of tournament, unique within game scope currency: String // Base currency of the pool overdraw: String <Decimal> // Guaranteed prize pool amount / Freeroll prize category: String // Tournament type (admin_created, hidden, user_created, draft_and_go) amount: Number // Tournament buy in, in base currency }, bet: { // Data about the bet being made (fantasy team) uid: Integer, // Id of the fantasy team, unique within game scope uuid: String // base_amount: Number // Buy-in in tournament's base currency amount: String <Decimal>, // Buy-in rake: String <Decimal>, // Rake. User must afford buy-in + rake currency: String // Currency of the bet(the users currency) ticket: String <optional> // Ticket token (see appendix later) } }] } }

Ticket tokens

If the user has a tournament ticket, they can spend it to register a fantasy team for free in tournaments fitting the ticket constraints.

Tickets can be for a single tournament, or work for a specific amount of buy-in within a specific season.

Tickets are JWT-encoded and should be decoded using your secret key.

When decoded, a valid tickets looks like so:


    
{ ticket: Integer // Id of the ticket being used cost: Number // cost of ticket in tournament's base currency }

You should ensure that the ticket can be decoded using your key, and that the ticket id is not one that has been used before.

If you do not wish to support tickets in your system, you can throw an error upon seeing the ticket field, or simply ignore it.

Refund bet

https:/{your_server}/bets/cancel

Is called when a single team has been unregistered from a tournament. Your endpoint should refund all specified participants in full (buy-in + rake) and respond with an OK.

This callback will be called with:


    
{ headers: { authorization: 'Bearer customer {admin_token}' }, body: { pools: [{ pool: { // Data about betting pool (tournament) client: String, // Name of white label, not necessarily yours status: String, // Status of the tournament, probably 'waiting' game: String, // Type of game being played. Should be "fantasy" uid: Integer, // Id of tournament, unique within game scope }, bets: [{ user: { // Data about the user owning the fantasy team client: String, // Name of white label, only yours uid: String, // Unique ID of user name: String // Username }, bet: { // Data about the bet being made (fantasy team) uid: Integer, // Id of the fantasy team, unique within game scope amount: String <Decimal>, // Buy-in rake: String <Decimal>, // Rake } }] }] } }

Valid tournament statuses are:

Refund Tournament

Same as refund bet, but contains all bets in the tournament pool.

Settle bets

https:/{your_server}/winners Is called when a tournament ends, and prize distribution is requested.

A list of all participants in the tournament will be given, whether they won anything or not. If the endpoint responds with an error message, the tournament will fail to close, and might try again later.

Your endpoint should distribute the given winnings to the listed teams and respond with an OK.


    
{ headers: { authorization: 'Bearer customer {admin_token}' }, body: { pools: [{ pool: { // Data about betting pool (tournament) client: String, // Name of white label, not necessarily yours game: String, // Type of game being played. Should be "fantasy" uid: Integer, // Id of tournament, unique within game scope overdraw: String <Decimal>, // Total payout under your label }, bets: [{ // You will only receive data for your own users user: { // Data about the user owning the fantasy team client: String, // Name of white label, always yours uid: String, // Unique ID of user name: String // Username }, bet: { // Data about the bet being made (fantasy team) uid: Integer, // Id of the fantasy team, unique within game scope amount: String <Decimal>, // Buy-in rake: String <Decimal>, // Rake payout: String <Decimal>, // How much the team won. Can be 0. ticket: String <optional> // Ticket token (see appendix earlier) } }] }] } }