Territorial.io API
Three POST endpoints: /api/gold/send, /api/account/get,
/api/clan/stats/get.
All are called with JSON over HTTPS.
1. /api/gold/send – send Gold
fetch("https://territorial.io/api/gold/send", {
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"body": JSON.stringify({
"account_name": "YOUR_ACCOUNT_NAME",
"password": "YOUR_PASSWORD",
"target_account_name": "TARGET_ACCOUNT_NAME",
"amount": 50
})
})
.then(function (response) { return response.json(); })
.then(function (data) { console.log(data); })
.catch(function (error) { console.error("Error:", error); });
2. /api/account/get – read account info
fetch("https://territorial.io/api/account/get", {
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"body": JSON.stringify({
"account_name": "YOUR_ACCOUNT_NAME",
"password": "YOUR_PASSWORD",
"target_account_name": "TARGET_ACCOUNT_NAME"
})
})
.then(function (response) { return response.json(); })
.then(function (data) { console.log(data); })
.catch(function (error) { console.error("Error:", error); });
3. /api/clan/stats/get – clan time series
fetch("https://territorial.io/api/clan/stats/get", {
"method": "POST",
"headers": {
"Content-Type": "application/json"
},
"body": JSON.stringify({
"account_name": "YOUR_ACCOUNT_NAME",
"password": "YOUR_PASSWORD",
"clan": "CLAN_NAME",
"timeframe": "D1" // "M1", "M5", "H1", "H4", "D1", "W1", "MN"
})
})
.then(function (response) { return response.json(); })
.then(function (data) { console.log(data); })
.catch(function (error) { console.error("Error:", error); });
How to run this
- Create a small local
.htmlfile, paste the code, open it in a browser, press F12 → Console. - Or use it in a Node.js script (Node 18+ or any Node version where you provide a
fetchpolyfill). - There are many other ways to send a POST request, and it’s up to you which method you prefer.
- Replace
YOUR_ACCOUNT_NAME,YOUR_PASSWORDand other placeholders with your real data.