Use one of your referral credits
const url = 'https://foxleague.ai/api/referral/credits/1/use';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/referral/credits/1/use \ --header 'Authorization: Bearer <token>'Uses a credit once. A credit that would do nothing is refused and stays yours. A Recover All credit restores the players of your squad that are below full condition to 100, the same cards the Squad page’s paid Recover All covers (your wallet’s players that are not on the market). An XP booster credit starts the shop’s XP booster for its hours, from now. A Common pack credit draws five Common players from the pool like a bought pack and delivers them to your wallet (a few minutes; they appear in your squad when the delivery lands); before it draws, it checks on chain what a bought pack checks: that the players contract delivers to your wallet and that its pack budget window has room. The credit is marked used in the same transaction as the delivery.
Who: a signed-in player with a team, for a credit of their own.
Refusals:
This credit does not exist or is not yours.This credit was already used.No player of your squad needs recovery right now. Your Recover All stays yours: use it when a player is below full condition.: a Recover All credit while no player of your squad that is not on the market is below full condition; nothing is written.An XP booster is already running. Your booster stays yours: use it when the running one ends.: a booster credit while an XP booster runs; nothing is written.No Common players are free in the pool right now. Your pack stays yours: try again later.: fewer than five Commons are free; nothing is written.This wallet cannot receive a Common pack: the players contract delivers packs only to wallets that paid the registration or received their team. Your credit is kept.: the wallet neither paid the registration nor received its team; nothing is written.The Common pack budget for this window is spent. Your pack stays yours: try again once the budget window has room.: the contract’s pack budget window cannot cover a pack; nothing is written.The chain cannot be read right now. Your pack stays yours: try again in a moment.: the registration or the pack budget could not be read on chain; nothing is written.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”The credit id, from your rewards.
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
Recover All: players of your squad restored to full condition. Common pack: players on their way. 0 for an XP booster.
The credit’s kind.
What happened, in the player’s words.
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
{ "success": true, "data": { "kind": "recover_all", "cards_restored": 18, "message": "Recover All used: 18 players back to full condition." }}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