Tribal wars public api?

Dracule Mihawk.

New Member
Reaction score
hello i have a question about tribalwars "api"

i dont manage to understand how twstats makes tools like this

cause noone of the public apis that are here :

offers data about to what tribe belongs each village

i asked my server Comunnity Manager and he tells me that twstats dosnt have any privileged info, so basically my conclusion is that the post is outdated/there are not all api calls information there?


Tribal Wars Team
Community Management
Reaction score
It does contain that information, though.

Village information contains:
$village_id, $name, $x, $y, $player_id, $points, $rank

With $player_id, you can link it to player information, which contains:
$player_id, $name, $tribe_id, $villages, $points, $rank

And then just use tribe_id to get the tribe name:
$tribe_id, $name, $tag, $members, $villages, $points, $all_points, $rank

So basically you can use some INNER JOIN 's, if you're tech savvy and know SQL, to figure it out.


Well-Known Member
Reaction score
The publicly available world data is composed from a set of text files (probably not the best of choices but thats fro another time to discuss).

There are:
- village.txt
- ally.txt
- player.txt
- etc...

With only these 3 you can get the list of players, villages and tribes on a world.

Now you ask how is it possible to list villages belonging to a tribe when neither ally.txt or village.txt does not directly make this connection.

Because entities or connected together like this.

Village -> Player -> Tribe

So you get a Tribe's player's list. Then for each Player you get its village's list, etc (all based on player id, tribe id, village id, etc).

All of this can be done as JawJaw said using JOINs in SQL or 2 separated SQL queries (dont see why not using JOIN's though other then the fact that they are usually hard to grasp for newer programmers).