Skip to content

Create your team

POST
/api/register
curl --request POST \
--url https://foxleague.ai/api/register \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "badge_ipfs_uri": "example", "team_name": "example" }'

Creates your team and answers it with its starter squad. Pay the registration fee on chain first, yourself or with POST /api/onboarding/relay. The server then draws an 18 card starter squad, sends it to your wallet and picks a first eleven. On this path the call waits until the chain shows the new cards in your wallet, up to about 30 seconds.

A wallet that already holds at least 18 player cards and has not paid the fee registers without paying: its team plays with the cards it holds and nonces is empty.

Who: a signed-in player without a team.

Refusals:

  • Team name must be 3-15 characters: the trimmed name is too short or too long.
  • Team name can only contain letters, numbers, spaces and hyphens: the name holds another character.
  • Already registered: the wallet already has a team.
  • Registration is currently disabled: registration is closed.
  • That team name is already taken: another team has this name, ignoring case, spaces and hyphens.
  • Unable to verify your on-chain registration status right now. Please retry in a moment; no payment is needed.: the wallet holds enough cards to register without paying, but the fee state could not be read. Try again.
  • This wallet does not have access yet.: the wallet has not been given access to the game yet.
  • The chain cannot be read right now, so your registration payment cannot be checked. Please try again in a moment.: the chain cannot be read right now.
  • Registration fee not paid on-chain. Submit the registerAndPay transaction first, then retry registration.: the fee is not paid yet.
  • Unable to verify on-chain registration payment right now. Please retry in a moment.: the fee state could not be read. Try again.
  • Your starter squad could not be drawn right now. Please try again later.: no starter squad can be drawn right now.

If the registration cannot be saved on our side, the answer is HTTP 500 with an empty body.

Media type application/json

The new team’s name and badge.

object
badge_ipfs_uri

The badge from POST /api/onboarding/generate-badge, ipfs://<cid>. Optional.

string | null
team_name
required

The team name: 3 to 15 characters among letters, numbers, spaces and hyphens. It must differ from every other team ignoring case, spaces and hyphens.

string
Example generated
{
"badge_ipfs_uri": "example",
"team_name": "example"
}

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
nonces
required

NFT nonces of the starter squad. Empty when the team plays with the cards the wallet already held.

Array<integer>
players
required

Cards the team starts with: 18 for a starter squad, else the number of cards the wallet holds.

integer format: int32
team_name
required

The team name.

string
user_id
required

Your user id.

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": {
"nonces": [
2104,
2117,
2121,
2139,
2140,
2156,
2163,
2178,
2181,
2195,
2202,
2214,
2226,
2231,
2249,
2250,
2268,
2273
],
"players": 18,
"team_name": "Fox Rovers",
"user_id": 1842
},
"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

The registration could not be saved on our side. The body is empty.