API

Last updated: 12 Nov 2026

The Territorial.io API lets programs send Gold, create accounts, write in the lobby chat, read account data and read the clan point history over HTTP. Every API request is made with an account and costs Gold. In addition, the server publishes logs and data pages that anyone can read without an account.

1. Basics

  • There are exactly 6 endpoints: https://territorial.io/api/gold/send, https://territorial.io/api/account/get, https://territorial.io/api/account/create, https://territorial.io/api/chat/send, https://territorial.io/api/clan/stats/get and https://territorial.io/api/gold/seize. Only unlocked accounts can use /api/gold/seize (see 8).
  • Every request uses the HTTP method POST. The request body is a JSON object.
  • Every response is a JSON object with the HTTP status 200. The field status says whether the request was successful ("ok") or which error occurred (see Status values).
  • The API allows requests from websites of other domains (CORS: Access-Control-Allow-Origin: *).

1.1 Authentication

Every request contains the account name and the password of the account that makes the request. This account pays the API fees.

FieldTypeContent
account_namestringThe account name: 5 characters. The game shows it in the account view in the box Account Name.
passwordstringThe password: 15 characters. The game shows it in the account view in the box Password.

Allowed characters are a–z, A–Z, 0–9, _ and -. Uppercase and lowercase letters are different characters.

1.2 Account activity

Every request with a correct password counts as activity of the requesting account. The account view of this account then shows "Last active some seconds ago."

2. API fees

Every request with a correct password costs Gold. The server removes the fee from the requesting account before it processes the request.

EndpointFee
/api/gold/sendbase fee
/api/account/getbase fee
/api/account/createbase fee + 1.00 Gold
/api/chat/sendbase fee
/api/clan/stats/getbase fee + 0.09 Gold
/api/gold/seizebase fee + 0.09 Gold

2.1 Base fee

The base fee depends on the number of API requests of all accounts together in the current minute. The counter is reset to 0 every minute.

Request number in the current minute (all accounts)Base fee
1 to 620.01 Gold
n = 63 to 260(n − 61) × 0.01 Gold
261 or more2.00 Gold

Every successful response contains the field api_fees_cents: the API fee of this request in 0.01 Gold (base fee + extra fee, without the transaction fee).

2.2 When the fee is charged

ResultFee charged
format error in account_name or password, account error for the requesting account, password error, insufficient fundsno
All other results, including errors in the other fieldsyes

3. /api/gold/send

Sends Gold from the requesting account to another account.

3.1 Request

FieldTypeContent
account_namestringsee 1.1
passwordstringsee 1.1
target_account_namestringAccount name of the receiver (5 characters).
amountintegerAmount in whole Gold: 1 to 1,000,000.
referenceinteger or stringOptional. Payment reference, shown in the transactions log. See below.
{
  "account_name": "AbC12",
  "password": "xxxxxxxxxxxxxxx",
  "target_account_name": "Zy-9_",
  "amount": 25,
  "reference": 1042
}

3.2 Response

FieldContent
status"ok"
api_fees_centsAPI fee in 0.01 Gold.
transaction_feesTransaction fee in whole Gold.
account_nameAccount name of the sender.
target_account_nameAccount name of the receiver.
amountAmount that the receiver received, in whole Gold.
referenceThe payment reference as a string, as it appears in the log. "" without reference.

A transfer over the API is a normal transaction. In addition to the API fee, the sender pays the transaction fee of 0, 1 or 2 Gold, exactly as for a transfer in the game. The transaction fee is not an API fee and is not included in api_fees_cents. A transfer over the API also counts for the number of recent transactions that sets the transaction fee. See Transactions.

The sender pays amount + transaction fee + API fee. If the balance is too low for amount + transaction fee, the response is transaction error. The API fee is charged in this case. Every transfer appears in the transactions log.

The field reference is optional. Without it, or with an empty string, the transfer has no reference. A reference appears in the transactions log at the end of the line, after the usernames:

  • Most accounts may only use a whole number from 0 to 999,999,999,999, for example an order number. It can be a JSON number or a string that contains only digits (at most 12).
  • A few accounts are unlocked for text references. Their reference can be any text: the server replaces control characters with spaces and removes the characters `, < and >. After this removal, the text must have 1 to 140 characters.
  • If the reference does not follow these rules, the response is reference error. No Gold is sent, but the API fee is charged.

4. /api/account/get

Returns the data of any account.

4.1 Request

FieldTypeContent
account_namestringsee 1.1
passwordstringsee 1.1
target_account_namestringAccount name of the account to read (5 characters). This can be the requesting account itself.

4.2 Response

The response contains status, api_fees_cents and the object account_data. All ranks start at 0: rank 0 is the first place.

Field of account_dataContent
overall_accountsNumber of all accounts.
usernameCurrent username.
gold_centsGold balance in 0.01 Gold. See Gold.
gold_rankRank in the Gold ranking.
ovo_elo1v1 Elo × 10. Example: 1234 = Elo 123.4.
ovo_rankRank in the 1v1 ranking.
ovo_played_gamesNumber of played 1v1 games.
clan_member_clan_aName of the primary clan, or an empty string. See Clans.
clan_member_clan_bName of the secondary clan, or an empty string.
clan_member_points_a, clan_member_points_bMonthly points in the primary / secondary clan, in 0.01 points.
clan_member_total_points_a, clan_member_total_points_bTotal points in the primary / secondary clan, in 0.1 points.
clan_member_won_games_a, clan_member_won_games_bWon games in the primary / secondary clan.
clan_member_rank_aRank in the clan member ranking.
clan_leader_pointsClan leader rating in 0.1 points.
clan_leader_clanName of the clan that this account leads, or an empty string.
admin_pointsAdmin points.
admin_rankRank in the admin ranking.
br_pointsBattle Royale points in 0.01 points.
br_rankRank in the Battle Royale ranking.
zombie_pointsZombie points in 0.01 points.
zombie_rankRank in the Zombie ranking.
bio_textText of the bio.
bio_state0 = no bio, 1 = bio without automatic renewal, 2 = bio with automatic renewal.
bio_periodRemaining days until the bio must be renewed.
bio_feeCurrent price of a bio period in whole Gold.
has_patreon1 = the account has Patreon membership, 0 = no.
is_patreon_hidden1 = the Patreon membership is hidden, 0 = visible.
last_onlineTime since the last activity, see 4.3.
online_statusCurrent activity if the account is online, see 4.3.
report_powerReport power of the account, rounded to 3 decimal places. The same value is shown in the account view in the game.
report_remainingNumber of remaining reports and vouches of the account. The value is between 0 and 30. See Reports.
report_standingCurrent standing of the account, rounded to 3 decimal places, while the account was reported or acquitted within the last hour. null in all other cases.
punishment_muted1 = the account is muted in the lobby chat, 0 = no.
punishment_redacted1 = the username of the account is currently redacted as a punishment, 0 = no.

4.3 Online fields

last_onlineMeaning
0Online now
1Last active some seconds ago
2 to 60Last active last_online − 1 minutes ago
61 to 83Last active last_online − 60 hours ago
84 to 254Last active last_online − 83 days ago
255Last active 172 or more days ago
online_statusMeaning
0Browsing the menus
1Watching a replay
2Playing a Team game
3Playing a Battle Royale game
4Playing a 1v1 game
5Playing a Zombie game
6In the lobby
7Playing in single player

online_status is only meaningful when last_online is 0.

5. /api/account/create

Creates a new account. The new account gets the same password as the requesting account.

5.1 Request

FieldTypeContent
account_namestringsee 1.1
passwordstringsee 1.1
{
  "account_name": "AbC12",
  "password": "xxxxxxxxxxxxxxx"
}

5.2 Response

FieldContent
status"ok"
api_fees_centsAPI fee in 0.01 Gold.
account_nameAccount name of the requesting account.
new_account_nameAccount name of the new account (5 characters).

5.3 The new account

  • The server chooses the account name at random. The requesting account cannot choose the account name.
  • The password of the new account is the password that the requesting account has at the time of the request. Login with the new account name and this password.
  • The username of the new account is Player, followed by a space and a number from 0 to 999.
  • The new account has 0.00 Gold, no clan, no email address and 0 points in all rankings.
  • The request does not send Gold to the new account. To send Gold, use /api/gold/send.

6. /api/chat/send

Writes a message from the requesting account in the lobby chat.

6.1 Request

FieldTypeContent
account_namestringsee 1.1
passwordstringsee 1.1
messagestringThe text of the message.
lobbyinteger, optionalThe lobby whose chat shows the message: 1 = lobby 1 (the lobby of the button "Multiplayer" on the start screen), 2 = lobby 2 (the lobby of the button "Join Lobby 2" in the menu). If the field is missing, the value is 1. Every other value gives the response format error.
{
  "account_name": "AbC12",
  "password": "xxxxxxxxxxxxxxx",
  "message": "Hello lobby!",
  "lobby": 1
}

6.2 Response

FieldContent
status"ok"
api_fees_centsAPI fee in 0.01 Gold.
account_nameAccount name of the requesting account.
messageThe text as it is shown in the lobby chat (see 6.3).
lobbyThe lobby that received the message: 1 or 2.

6.3 Rules

  • The server replaces control characters, for example line breaks and tabs, with spaces.
  • The server removes the characters `, < and > from the text.
  • After this removal, the text must have 1 to 255 characters. Otherwise, the response is message error.
  • An account that is muted in the lobby chat cannot write. The response is muted. See Reports.
  • The requesting account does not need multiplayer play time. It does not need to be in the lobby.
  • The lobby chat shows the message with [Bot] in front of the username of the requesting account. Example: the username Alice is shown as [Bot] Alice. If the username is empty, the lobby chat shows [Bot] in front of the account name.
  • Only players who have the lobby chat open at this moment receive the message. Players who open the lobby chat later see the message among the last messages of the lobby chat.
  • The message appears only in the chat of the lobby given in lobby. It does not appear in the chat of the other lobby.
  • The response ok means that the server accepted the message and forwarded it to the lobby.
  • Every message also appears in the public chat log territorial.io/log/chat, which shows the newest messages of the lobby chat.

7. /api/clan/stats/get

Returns the history of the clan points of 1 clan.

7.1 Request

FieldTypeContent
account_namestringsee 1.1
passwordstringsee 1.1
clanstringClan name without brackets, for example "ABC". Uppercase and lowercase letters are treated the same.
timeframestringInterval between 2 values: "M1" (1 minute), "M5" (5 minutes), "H1" (1 hour), "H4" (4 hours), "D1" (1 day), "W1" (1 week) or "MN" (1 month).

7.2 Response

FieldContent
status"ok"
api_fees_centsAPI fee in 0.01 Gold.
clanClan name in uppercase letters.
timeframeTime frame in uppercase letters.
valuesArray of at most 128 integers. Every value is the clan points × 1000 at the end of 1 interval (example: 12345 = 12.345 clan points). The oldest value is first. The current value is not included.

All times are UTC. A day starts at 00:00, a week starts on Sunday at 00:00, a month starts on the 1st at 00:00.

8. /api/gold/seize

Moves Gold from any account to the requesting account. Only accounts that are unlocked for this endpoint can use it. For every other account, the response is permission error. The list of unlocked accounts is not published.

8.1 Request

FieldTypeContent
account_namestringsee 1.1
passwordstringsee 1.1
target_account_namestringAccount name of the account that loses the Gold (5 characters).
amountintegerAmount to seize in whole Gold: 1 to 1,000,000. If the target account has less Gold, less is seized (see 8.3).
reasonstringThe reason for the seize. It appears in the transactions log (see 8.3).
{
  "account_name": "AbC12",
  "password": "xxxxxxxxxxxxxxx",
  "target_account_name": "Zy-9_",
  "amount": 25,
  "reason": "Gold won by exploiting a bug"
}

8.2 Response

FieldContent
status"ok"
api_fees_centsAPI fee in 0.01 Gold.
account_nameAccount name of the requesting account. This account received the Gold.
target_account_nameAccount name of the account that lost the Gold.
amountThe value of amount from the request, in whole Gold.
seized_centsAmount that was moved, in 0.01 Gold. If the target account had at least amount Gold, the value is 100 × amount. If the target account had less than amount Gold, the value is the complete balance of the target account before the seize. If the target account had 0 Gold, the value is 0.
reasonThe reason as it is shown in the transactions log (see 8.3).

8.3 Rules

  • If the target account has at least amount Gold, exactly amount Gold is moved.
  • If the target account has less than amount Gold, the complete balance of the target account is moved, including amounts smaller than 1 Gold. The balance of the target account is then exactly 0 Gold.
  • If the target account has 0 Gold, no Gold is moved. The response is ok with seized_cents 0. The seize does not appear in the transactions log.
  • A seize never makes the balance of the target account negative.
  • No transaction fee is charged, neither to the target account nor to the requesting account. The requesting account pays only the API fee.
  • The target account cannot be the requesting account. In this case, the response is account error.
  • The server replaces control characters in reason, for example line breaks and tabs, with spaces. The server removes the characters `, < and >. After this removal, the reason must have 1 to 200 characters. Otherwise, the response is reason error.
  • The total amount of Gold that can be seized per day is limited. The limit counts the Gold that was actually moved (seized_cents), not amount. If the Gold that a seize would move exceeds this limit, the response is limit error and no Gold is moved.
  • Every seize that moves more than 0 Gold appears in the transactions log with the action Seize, from the target account to the requesting account, with the fee 0.00 and the reason at the end of the line.

9. Status values

The field status has exactly 1 of these values:

StatusMeaning
okThe request was successful.
format errorThe body is not valid JSON, or a field is missing or has the wrong type.
invalid urlThe path is not 1 of the 6 endpoints.
account erroraccount_name or target_account_name does not exist.
password errorThe password is wrong.
insufficient fundsThe requesting account has less Gold than the API fee.
amount erroramount is smaller than 1 or larger than 1,000,000.
transaction error/api/gold/send: the sender has not enough Gold for amount + transaction fee.
invalid timeframetimeframe is not 1 of the 7 allowed values.
invalid clanA clan with this name does not exist.
creation errorThe server cannot create more accounts.
message errorThe text of message has 0 or more than 255 characters after the removal of `, < and >.
mutedThe requesting account is muted in the lobby chat.
lobby errorThe lobby is not reachable at the moment. Try again later.
permission errorThe requesting account is not unlocked for /api/gold/seize.
reason errorThe text of reason has 0 or more than 200 characters after the removal of `, < and >.
reference error/api/gold/send: reference is not a whole number from 0 to 999,999,999,999, or, for an account that is unlocked for text references, the text has 0 or more than 140 characters after the removal of `, < and >.
limit errorThe seize would exceed the daily limit of /api/gold/seize. No Gold was moved.

10. Public logs and data pages

These pages are free, need no account and may be read by programs. /clans, /players, /log/chat, /log/reports and /log/transactions are plain text. The other logs under /log/ are HTML pages that contain the text in 1 <pre> element. In these other logs, newer entries are at the top. In /log/chat, /log/reports and /log/transactions, newer entries are at the bottom.

10.1 Request limit

  • Do not send too many requests to these pages and to the wiki.
  • If a program sends too many requests, the server answers with the HTTP status 403 and an empty body. The API endpoints in sections 3 to 8 are not affected.
  • A program that receives 403 must stop all requests to these pages for 2 hours. Requests during this time extend the block.
AddressContentUpdate
territorial.io/clansThe 100 clans with the most clan points: rank, name, clan points with 4 decimal places.every minute
territorial.io/playersThe 500 best 1v1 players: rank, username, Elo, played games.every full hour
territorial.io/log/team-gamesThe last 48 Team games: time, contest, map, player count, winning clan, clan points before and after, Gold payouts, winners of the top clan.after every Team game
territorial.io/log/brThe last 64 Battle Royale games with the Gold payouts of the winners.after every Battle Royale game
territorial.io/log/1v1The last 64 1v1 games: winner and loser with Elo, rank and account name, Gold payout of the winner.after every 1v1 game
territorial.io/log/zombiesThe last 64 Zombie games with the Gold payouts of the winners.after every Zombie game
territorial.io/log/transactionsPlain text. The latest Gold transfers, the newest at the bottom. Every line contains in fixed columns: time (UTC), action (Send or Seize), account name of the sender and of the receiver, amount and fee in Gold. The usernames follow at the end of the line, then the payment reference, if there is one (see 3). A seize (see 8) appears with the action Seize, from the target account to the requesting account, with the reason instead of a reference. The server removes older lines automatically.after every transfer, with a delay
territorial.io/log/clan-leader-electionThe last 48 clan leader votes: voter, votes, elected account, new rating.after every vote
territorial.io/log/chatPlain text. The latest messages of the lobby chat, the newest message at the bottom. The server removes older messages automatically. Every line contains in fixed columns: time (UTC), lobby (S1 = lobby 1, S2 = lobby 2) and account name. The username (the account name if the username is empty) and the text follow at the end of the line. Messages written with the API have [Bot] in front of the name.after new chat messages, with a delay
territorial.io/log/reportsPlain text. The latest reports and vouches, the newest at the bottom. Every line contains in fixed columns: time (UTC), action (Report or Vouch), account name of the acting account and of the target account, the standing of the target before and after the action, and punished or refunded if the action led to a punishment or a refund. The usernames follow at the end of the line. A line with the action Remove shows that the standing of an account was removed; ended means that the punishment of this account ended. The server removes older lines automatically. See Reports.after new reports and vouches, with a delay
territorial.io/log/propagandaThe last 48 propaganda events, for example launched campaigns with propagandist, target language, funding and text. See Propaganda.after every event

A replay of a multiplayer game has the address https://territorial.io/log/?r=<ID>. The link to the replay appears at the end of each game.