TarTrack Web API

← dashboard · home

Basics

JSON over HTTP under /api/v1. Errors are {"error": "code", "message": "text"} with a 4xx/5xx status.

Players are recognised by their device signature (a hash of the device's id, made by the game): signing in with it gives a session token, sent as Authorization: Bearer <token>. To a game server they identify with a play session id, which is tied to that device and so to the account.

Game servers register with the shared secret in X-Server-Key, then use their own token as Authorization: Bearer <server token>.

Game servers (/server-api/)

CallWhoWhat
POST /server-api/v1/sign-upX-Server-Key"Hello, I want to sign up" (on start): {name, port, version, kind: host|standalone, modes[], max_players, address?} (address defaults to where the request came from) → {server_id, token, heartbeat_secs}
POST /server-api/v1/heartbeatserver tokenStill alive: {players, modes?}, about every 30 s. Silent for 90 s = off the list.
POST /server-api/v1/sign-offserver token"I'm turning off" (on shutdown): off the list right away. Signing up again brings it back.
POST /server-api/v1/matches/startserver tokenA game started, or its players changed: {match, mode, map, port, players: [{name, hero, bot, team, session}]}. It is in the players' history right away (unfinished) and the game can take a player back to it. {match, abandoned: true} calls it off
POST /server-api/v1/matchesserver tokenA finished game: {mode, map, winner_team?, started_at?, players: [{session?, name, hero, bot, team, place, gems, goals, laps}]}. session is the play session the player joined with; their account gets trophies, coins and quest progress → {match_id, results}

Players

CallWhoWhat
GET /api/v1/servers?version=0.2.0anyoneServers online (the game asks this for its server list) (same major.minor as version) → {servers: [{name, address, port, kind, modes, players, max_players, version, last_seen}]}
POST /api/v1/sessions/deviceanyoneSign in by the device's recognition id {device, vlastnosti: {version, hash}, name?, os?}: the account this device belongs to, or a new guest account the first time → {token, account, new}. The game values must be the live ones (version and SHA-256 of the file, line endings ignored), else 409 vlastnosti_outdated. A token sent in Authorization is kept if it is this account's
POST /api/v1/me/play-sessionplayerA play session {device, vlastnosti} (live game values needed, as for signing in) → {session, expires_at}: what the game gives a game server to say who it is. Tied to the device (and its account), can't sign in, runs out after 12 h
GET /api/v1/vlastnostianyoneThe live game values → {version, hash, content} (content: the vlastnosti.json text)
GET /api/v1/meplayerYour account: name, coins, gems, trophies, heroes, Jlude link, activity
PATCH /api/v1/meplayerRename {name} (1-16 characters)
POST /api/v1/me/activityplayerWhat you're doing {status: menu|searching|in_game|offline, mode?, server?}
POST /api/v1/me/jludeplayerLink to Jlude {jlude_token}
POST /api/v1/sessions/jludeanyoneSign in on a new device with a linked Jlude account {jlude_token, device?} → {token, account}
POST /api/v1/me/logoutplayerThis token stops working
GET /api/v1/heroesanyoneHeroes and their prices
POST /api/v1/me/heroes/:id/unlockplayerBuy a hero with coins
GET /api/v1/me/questsplayerYour open quests (always 3) with progress
POST /api/v1/me/quests/:id/claimplayerTake a finished quest's reward; a new quest replaces it
GET /api/v1/me/matches?limit=20playerYour match history, newest first; each game has status running / finished / unfinished, and a running one its address and port
GET /api/v1/players/:id/matches?limit=20anyoneAnother player's match history (without addresses)
GET /api/v1/me/recent-playersplayerPeople you played with lately (accounts only, online first) with their trophies, favourite hero and activity: the squad list
GET /api/v1/players/:idanyoneSomeone's public profile (no coins/gems)
GET /api/v1/statsanyoneRight now: players online (and how many are in a game, looking for one, in the menu), servers online, players on servers
GET /api/v1/leaderboardanyoneTop players by trophies
GET /api/v1/matches/recentanyoneLatest games on all servers