$ curl -X POST "/api/game_players.php/register" \
-H "X-Api-Token: API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"player_name": "TestPlayer",
"birth_year": 2000,
"player_data": {
"level": 1,
"score": 0,
"inventory": ["sword", "shield"]
}
}'
birth_year is optional — pass it whenever the game knows the player's age; a value that could mean under 13 rejects the registration (COPPA).
{
"success": true,
"player_id": "3",
"private_key": "PLAYER_TOKEN",
"player_name": "TestPlayer",
"game_id": 2
}
$ curl -X PUT "/api/game_players.php/login" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json"
{
"success": true,
"player": {
"id": 3,
"game_id": 2,
"player_name": "TestPlayer",
"player_data": {
"level": 1,
"score": 0,
"inventory": ["sword", "shield"]
},
"is_online": true,
"last_login": null,
"last_heartbeat": null,
"last_logout": null,
"created_at": "2026-03-13 09:39:06",
"updated_at": "2026-03-13 09:39:06"
}
}
$ curl -X POST "/api/game_players.php/heartbeat" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json"
{
"success": true,
"message": "Heartbeat updated",
"last_heartbeat": "2026-03-13 09:46:13"
}
$ curl -X POST "/api/game_players.php/logout" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json"
{
"success": true,
"message": "Player logged out successfully",
"last_logout": "2026-03-13 09:46:37"
}
$ curl -X PUT "/api/game_players.php/rename" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"new_name": "NewPlayerName"
}'
{
"success": true,
"message": "Player name updated successfully",
"new_name": "NewPlayerName",
"player_id": 3
}
$ curl -X POST "/api/game_players.php/rotate" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN"
{
"success": true,
"private_key": "NEW_PLAYER_TOKEN",
"player_id": 3
}
$ curl -X GET "/api/game_players.php/list" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Api-Private-Token: PRIVATE_TOKEN"
{
"success": true,
"count": 3,
"players": [
{
"id": 1,
"player_name": "TestPlayer",
"is_online": true,
"last_login": null,
"last_logout": null,
"last_heartbeat": null,
"created_at": "2026-03-13 09:37:47"
},
{
"id": 3,
"player_name": "TestPlayer",
"is_online": true,
"last_login": "2026-03-13 09:40:35",
"last_logout": null,
"last_heartbeat": null,
"created_at": "2026-03-13 09:39:06"
},
{
"id": 2,
"player_name": "TestPlayer",
"is_online": true,
"last_login": null,
"last_logout": null,
"last_heartbeat": null,
"created_at": "2026-03-13 09:38:01"
}
]
}
$ curl -X GET "/api/game_data.php/player/get" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN"
{
"success": true,
"type": "player",
"player_id": 7,
"player_name": "TestPlayer",
"data": {
"level": 1,
"score": 0,
"inventory": ["sword", "shield"]
}
}
$ curl -X PUT "/api/game_data.php/player/update" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"level": 2,
"score": 100,
"inventory": ["sword", "shield", "potion"],
"last_played": "2025-01-13T12:30:00Z"
}'
{
"success": true,
"message": "Player data updated successfully",
"updated_at": "2026-01-13 14:27:10"
}
$ curl -X POST "/api/matchmaking.php/heartbeat" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN"
{
"success": true,
"status": "ok"
}
$ curl -X POST "/api/game_room.php/heartbeat" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN"
{
"success": true,
"status": "ok"
}