Game Data API

Game Data

GET
/api/game_data.php/game/get
Get game data (requires API TOKEN)
PUT
/api/game_data.php/game/update
Update game data (requires API TOKEN, PRIVATE TOKEN)
GET
/api/game_data.php/player/get
Get player data (requires API TOKEN, PLAYER TOKEN)
PUT
/api/game_data.php/player/update
Update player data (requires API TOKEN, PLAYER TOKEN)
GET /api/game_data.php/game/get
Request:
$ curl -X GET "/api/game_data.php/game/get" \
  -H "X-Api-Token: API_TOKEN"
Response:
{
  "success": true,
  "type": "game",
  "game_id": 4,
  "data": {
    "text": "hello world",
    "game_settings": {
      "difficulty": "hard",
      "max_players": 10
    },
    "last_updated": "2025-01-13T12:00:00Z"
  }
}
PUT /api/game_data.php/game/update
Request:
$ curl -X PUT "/api/game_data.php/game/update" \
  -H "X-Api-Token: API_TOKEN" \
  -H "X-Api-Private-Token: PRIVATE_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "game_settings": {
      "difficulty": "hard",
      "max_players": 10
    },
    "last_updated": "2025-01-13T12:00:00Z"
  }'
Response:
{
  "success": true,
  "message": "Game data updated successfully",
  "updated_at": "2026-01-13 14:24:23"
}

Scopes and access

The two scopes behave differently by design. Game scope is world-readable with the API token — intended for live configuration (name and room rules, version policy, client config) that every client reads at startup. Writes need the private token, so treat them as deploys. Player scope is per-user JSON — progression, loadouts, stats — readable and writable with that player's token, or by admin calls carrying the token pair.

Player-scope fields are also what leaderboards sort on, so keep ranked values numeric and identically named across platforms. Payloads are stored verbatim — validate shape and size client-side before writing.