Delete your open tournament
const url = 'https://foxleague.ai/api/tournaments/1/delete';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/delete \ --header 'Authorization: Bearer <token>'Permanently deletes a tournament you created while its status is open, whatever the number of seats taken. Every paid entry is refunded on chain and the tournament is closed there first. When entry fees are still settling on chain, the tournament is set to cancelled instead and the answer reads deleted: false; call again later to finish the delete. A delete still running on chain after 20 seconds answers deleted: false with still_processing: true and finishes in the background. Refusals on this route answer with an HTTP error status and the envelope success: false with error.
Who: a signed-in player, the creator.
Refusals:
- 403
Not registered: the wallet has no player account. - 404
Tournament not found: no tournament has this id. - 400
A completed tournament cannot be deleted - 400
This has already started, so it can't be deleted while its match is running. Wait for it to finish.: the tournament is under way. - 403
Only the organizer or an admin can delete this tournament: you did not create it. - 400
You can only delete a tournament while it is still open (before its registration deadline): the tournament is notopen. - 400
This tournament has a prize from FoxLeague, so it is cancelled, not deleted: cancel it at Admin > Tournaments. The prize goes back to its depositor once the contract reads it cancelled.: a League + Knockout tournament with a prize; nothing changed. - 503
Chain is temporarily unavailable. Please retry shortly.: paid tournament while the chain cannot be reached; nothing changed.
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
Delete put off: true.
true when the tournament is deleted. false when it was set to cancelled because entry fees are still settling on chain; call the route again later. Also false while the delete is still running (still_processing).
Finished delete: matches that were linked to the tournament; they stay in match history. 0 for a tournament that never started.
Delete put off: a sentence saying the tournament is cancelled and the delete can be run again once the remaining entry fees have settled.
Delete put off: entry fees the contract still holds for the tournament, as <n> atomic in the token’s smallest unit; unknown (pool read failed) when it cannot be read.
Delete put off: escrow_not_drained.
Finished delete: always an empty list.
Delete put off: refunds that did not go through.
Hashes of the entry refunds sent on chain; empty for a free tournament. Absent while the delete is still running (still_processing).
Delete put off: cancelled, the tournament’s new status.
true when the delete was still running on chain as the answer left: a paid tournament refunds every entry first, which can take longer than the 20 seconds the answer waits. The delete goes on in the background; read the tournament again in a minute to see the result. Absent otherwise.
Finished delete: the id of the deleted tournament.
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": { "deleted": true, "matches_deleted": 0, "refund_failed_addrs": [], "refund_txs": [ "f57fd14c1604d115cea325a65e19cbae530282bd36cb9d21f6be6abf0d7c1c1e" ], "tournament_id": 419 }, "success": true}Refused: the tournament has completed, has started, is no longer open or has a prize from FoxLeague. error says which.
The answer of a request that returns no data. POST /api/tournaments/{id}/delete answers its refusals with it: success is false and error says why.
object
A machine-readable reason next to error, set only where the caller must act differently.
Always null on success: the route returns no data.
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 generated
{ "code": "example", "data": "example", "error": "example", "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 invalidRefused: the wallet has no player account or you did not create this tournament. error says which.
The answer of a request that returns no data. POST /api/tournaments/{id}/delete answers its refusals with it: success is false and error says why.
object
A machine-readable reason next to error, set only where the caller must act differently.
Always null on success: the route returns no data.
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 generated
{ "code": "example", "data": "example", "error": "example", "success": true}No tournament has this id.
The answer of a request that returns no data. POST /api/tournaments/{id}/delete answers its refusals with it: success is false and error says why.
object
A machine-readable reason next to error, set only where the caller must act differently.
Always null on success: the route returns no data.
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 generated
{ "code": "example", "data": "example", "error": "example", "success": true}A failure on our side. The body is the usual JSON refusal.
The answer of a request that returns no data. POST /api/tournaments/{id}/delete answers its refusals with it: success is false and error says why.
object
A machine-readable reason next to error, set only where the caller must act differently.
Always null on success: the route returns no data.
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 generated
{ "code": "example", "data": "example", "error": "example", "success": true}The chain cannot be reached for a paid tournament; nothing changed. The body is the usual JSON refusal.
The answer of a request that returns no data. POST /api/tournaments/{id}/delete answers its refusals with it: success is false and error says why.
object
A machine-readable reason next to error, set only where the caller must act differently.
Always null on success: the route returns no data.
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 generated
{ "code": "example", "data": "example", "error": "example", "success": true}