Leave a tournament before its deadline
const url = 'https://foxleague.ai/api/tournaments/1/leave';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://foxleague.ai/api/tournaments/1/leave \ --header 'Authorization: Bearer <token>'Removes your seat from an open tournament before its registration deadline. For a paid seat the entry fee is refunded on chain first and the answer carries the refund transaction hash. Leaving never cancels the tournament, even when it becomes empty. The creator may leave too. In a League + Knockout tournament an accepted team may leave until its third invitation wave starts; leaving closes the invitation and its seat goes to the next wave.
Who: a signed-in player.
Refusals:
Not registered: the wallet has no player account.Tournament not found: no tournament has this id.Cannot leave: tournament is no longer openCannot leave: registration deadline has passedCannot leave: the seats of this tournament are locked since <time>, when its last invitation wave started.: a League + Knockout tournament from its third invitation wave on.Chain is temporarily unavailable. Please retry shortly.: paid seat while the chain cannot be reached; your seat is kept.Your leave could not be confirmed on chain yet. Press Leave again in a moment to finish: a refund already sent is never sent twice.: your seat is kept until the refund is confirmed.Refunds are unavailable right now: your seat and entry fee are untouched. Please retry shortly.You are not in this tournament: you hold no seat.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The tournament id.
Responses
Section titled “ Responses ”Success or a refusal: read success (the refusals are in the description).
object
A machine-readable reason next to error, set only where the caller must act differently. tx_pending: the payment was not refused but could not be verified yet; keep the transaction hash and confirm again with the same hash, never pay twice.
The answer. Present when success is true.
object
You have left the tournament. after a leave, Challenge cancelled. after a cancel.
Hash of the on-chain refund of your entry fee. null for a free seat, when no entry was found on chain and after a cancel.
Why the request was refused, in plain words. Present when success is false.
true when the request did what it asked. false is a refusal: read error.
Example
{ "data": { "message": "You have left the tournament.", "refund_tx_hash": "e210471948d33296c87009e8a7f770d9106fd287db7f1adbc60926f6967e7893" }, "success": true}No valid session. The body is plain text: Missing Authorization header, Invalid Authorization format, Invalid session token or Session expired or invalid. Sign in again.
Example
Session expired or invalid