Skip to content

Use Takaro data in your own app

You can read your community’s data from Takaro and show it anywhere: a website, a launcher, a Discord bot or a status board. This guide covers the common reads and, more importantly, how to do it without leaking your key.

You need an API key first. See API and Settings and account. The examples read it from TAKARO_API_KEY.

Pick one of these:

  1. Call Takaro from your own small backend (recommended). Your website or launcher calls your server, and your server calls Takaro with the key. The key never leaves your server.
  2. Use a domain key with a read-only role. Create a role that only has READ_PLAYERS, then create a domain key with only that role. Add a scope of READ_PLAYERS and an IP allowlist of your server’s address. If it leaks, it can read player data from that address and nothing else.

Even with option 2, only call Takaro from a server you control. For a public page, have your backend fetch the data every minute or so and serve a cached copy.

Player data is per game server. You identify a server by its Takaro UUID, not by its IP address and port. List your servers:

Terminal window
curl -X POST https://api.takaro.io/gameserver/search \
-H "Authorization: Bearer $TAKARO_API_KEY" \
-H "Content-Type: application/json" \
-d '{}'

Each result has an id and a name. You can also copy the ID from the URL when you open the server in the dashboard.

POST /gameserver/player/search returns one record per player on a server. It needs the READ_PLAYERS permission. Each record includes currency, playtimeSeconds, online, lastSeen, ping and the player’s position.

Terminal window
curl -X POST https://api.takaro.io/gameserver/player/search \
-H "Authorization: Bearer $TAKARO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filters": { "gameServerId": ["<game-server-id>"], "online": [true] },
"extend": ["player"],
"limit": 100
}'

extend: ["player"] adds the player’s name and platform IDs to each record. Without it you only get IDs.

The same request answers both. Drop the online filter to include players who are offline, and read currency and playtimeSeconds (in seconds) from each record:

Terminal window
curl -X POST https://api.takaro.io/gameserver/player/search \
-H "Authorization: Bearer $TAKARO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filters": { "gameServerId": ["<game-server-id>"] },
"extend": ["player"],
"limit": 100
}'

Sort by currency, highest first. Use "playtimeSeconds" for a playtime board.

Terminal window
curl -X POST https://api.takaro.io/gameserver/player/search \
-H "Authorization: Bearer $TAKARO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filters": { "gameServerId": ["<game-server-id>"] },
"extend": ["player"],
"sortBy": "currency",
"sortDirection": "desc",
"limit": 10
}'
Terminal window
curl https://api.takaro.io/gameserver/<game-server-id>/player/<player-id> \
-H "Authorization: Bearer $TAKARO_API_KEY"

<player-id> is the player’s Takaro ID, which you can get from the search above.

For more than 100 players, page through results with page and limit. See Querying data.

  • API explains keys, scope and errors.
  • The API reference lists every operation, with the permission each one needs.