Train one attribute of a card
const url = 'https://foxleague.ai/api/training/train';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"attribute":"example","player_nonce":1}'};
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/training/train \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "attribute": "example", "player_nonce": 1 }'Runs one training session on one attribute of your card and answers the result. The session earns XP from the card’s condition (more condition, more XP, doubled by an active XP booster by default) and costs condition, more for older cards. When the attribute’s XP reaches training_defaults.xp_threshold_per_level from /api/config, the attribute gains one point, up to the card’s rarity cap.
Each day you get a number of free sessions; after them, each session uses a training slot bought in the shop. The day starts at 14:00 UTC by default.
Who: a signed-in player, for a card the wallet holds.
Rate limit: One request per 500 milliseconds per wallet by default. Per day, 5 free sessions plus up to 10 sessions from bought slots by default.
Refusals:
Training too fast. Wait a moment: your previous training request was under 500 milliseconds ago.Invalid attribute. Choose: speed, accuracy, defense, power, control, vision, stamina:attributeis not one of the seven.Not registered: the wallet has no account.Player not found: no card has this nonce.You don't own this player: the card belongs to another wallet.Player needs to rest. At least <min> condition is required to train. Condition recovers naturally over time.: the card’s condition is belowmin_field_condition.Training temporarily unavailable. Please retry.: today’s sessions could not be counted. Try again.Daily training cap reached (<used>/<max> for today). <banked> banked slots available. Try tomorrow.: you used every free and paid session allowed today.Daily training limit reached (<used>/<free>). Buy slots in the shop or try again tomorrow.: the free sessions are used and you have no training slot.The training could not be saved. Nothing was applied. Please try again in a moment.: the session could not be saved. No slot was used.
Authorizations
Section titled “Authorizations ”Request Body required
Section titled “Request Body required ”The card and attribute to train.
object
speed, accuracy, defense, power, control, vision or stamina.
The NFT nonce of your card.
Example generated
{ "attribute": "example", "player_nonce": 1}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
true when the attribute gained a point.
The trained attribute.
The card’s condition after the session.
Sessions allowed today: the free ones plus the most you may add from bought slots.
Sessions used today, including this one.
An object keyed by the trained attribute, holding before and after (its value) and increased (true when it gained a point).
XP this session earned.
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": { "any_increased": true, "attribute": "speed", "condition_after": 81, "slots_max": 15, "slots_used": 3, "stats": { "speed": { "after": 62, "before": 61, "increased": true } }, "xp_gained": 17 }, "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