Skip to content

Train one attribute of a card

POST
/api/training/train
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: attribute is 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 below min_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.
Media type application/json

The card and attribute to train.

object
attribute
required

speed, accuracy, defense, power, control, vision or stamina.

string
player_nonce
required

The NFT nonce of your card.

integer format: int64
Example generated
{
"attribute": "example",
"player_nonce": 1
}

Success or a refusal: read success (the refusals are in the description).

Media type application/json
object
code

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.

string | null
data

The answer. Present when success is true.

object
any_increased
required

true when the attribute gained a point.

boolean
attribute
required

The trained attribute.

string
condition_after
required

The card’s condition after the session.

integer format: int32
slots_max
required

Sessions allowed today: the free ones plus the most you may add from bought slots.

integer format: int64
slots_used
required

Sessions used today, including this one.

integer format: int64
stats
required

An object keyed by the trained attribute, holding before and after (its value) and increased (true when it gained a point).

xp_gained
required

XP this session earned.

integer format: int32
error

Why the request was refused, in plain words. Present when success is false.

string | null
success
required

true when the request did what it asked. false is a refusal: read error.

boolean
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.

Media type text/plain
string
Example
Session expired or invalid