$ curl -X POST "/api/game_room.php/create" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"room_name": "My Game Room",
"max_players": 4,
"password": "secret123",
"host_switch": false,
"can_leave_room": true,
"player_data": {
"level": 15,
"class": "warrior",
"inventory": ["sword", "shield"]
}
}'
{
"success": true,
"room_id": "dc3723848639139113ca240958ba0bf8",
"room_name": "My Game Room",
"is_host": true
}
$ curl -X POST "/api/game_room.php/list" \
-H "X-Api-Token: API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"search": "",
"limit": 20
}'
{
"success": true,
"rooms": [
{
"room_id": "dc3723848639139113ca240958ba0bf8",
"room_name": "My Game Room",
"max_players": 4,
"current_players": 1,
"has_password": 1
}
]
}
$ curl -X POST "/api/game_room.php/dc3723848639139113ca240958ba0bf8/join" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"password": "secret123"
}'
{
"success": true,
"room_id": "dc3723848639139113ca240958ba0bf8",
"message": "Successfully joined the room"
}
$ curl -X GET "/api/game_room.php/players" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN"
{
"success": true,
"players": [
{
"player_id": "48",
"player_name": "TestPlayer",
"is_host": 1,
"is_online": 1,
"is_local": true,
"last_heartbeat": "2026-03-09 09:39:34"
},
{
"player_id": "49",
"player_name": "TestPlayer",
"is_host": 0,
"is_online": 1,
"is_local": false,
"last_heartbeat": "2026-03-09 09:44:39"
}
],
"last_updated": "2026-03-09T09:56:21+00:00"
}
$ curl -X POST "/api/game_room.php/leave" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN"
{
"success": true,
"message": "Successfully left the room"
}
$ curl -X POST "/api/game_room.php/actions" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"target_players": "host",
"action_type": "move",
"request_data": {
"x": 10,
"y": 20
}
}'
{
"success": true,
"actions_sent": 1,
"action_ids": ["1c2bbd859e36dc7d7e5e9b4f263c88ce"],
"target_players_ids": [48]
}
$ curl "/api/game_room.php/actions/poll"
{
"success": true,
"actions": [
{
"action_id": "efc5ea74e3a37e41a4f57d948cfb2538",
"action_type": "move",
"response_data": {
"success": true,
"message": "Moved successfully"
},
"status": "completed",
"target_id": 48,
"is_host": true,
"processed_at": "2026-03-13T10:15:30+00:00"
}
]
}
$ curl "/api/game_room.php/actions/pending"
{
"success": true,
"actions": [
{
"action_id": "efc5ea74e3a37e41a4f57d948cfb2538",
"player_id": 49,
"target_id": 48,
"action_type": "move",
"request_data": {
"x": 10,
"y": 20
},
"created_at": "2026-03-09 10:10:10",
"player_name": "TestPlayer",
"is_host": false
}
]
}
$ curl -X POST "/api/game_room.php/actions/1c2bbd859e36dc7d7e5e9b4f263c88ce/complete" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"status": "completed",
"response_data": {
"success": true,
"message": "Moved successfully"
}
}'
{
"success": true,
"message": "Action completed"
}
$ curl -X POST "/api/game_room.php/updates" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"target_players": "all",
"type": "play_animation",
"data": {
"animation": "victory",
"duration": 2.0
}
}'
{
"success": true,
"updates_sent": 1,
"update_ids": ["ddb19c9d8722073762f5db33ff13712a"],
"target_players_ids": [47]
}
$ curl -X POST "/api/game_room.php/updates" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"target_players": "specific",
"target_players_ids": [47],
"type": "spawn_effect",
"data": {
"effect": "explosion",
"position": {
"x": 10,
"y": 20
}
}
}'
{
"success": true,
"updates_sent": 1,
"update_ids": ["377bfa1d4c56c3f72d9c87b0c081e6e8"],
"target_players_ids": [47]
}
$ curl -X POST "/api/game_room.php/updates/poll" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"from_players": "host",
"last_update": null
}'
{
"success": true,
"updates": [
{
"update_id": "a28388775fcf9478c6926cbe44f9d3ed",
"from_player_id": "48",
"type": "play_animation",
"data": {
"animation": "victory",
"duration": 2
},
"created_at": "2026-03-09 10:51:40"
},
{
"update_id": "f26cbcdab3939b968f148edf68a9fe54",
"from_player_id": "48",
"type": "play_animation",
"data": {
"animation": "victory",
"duration": 2
},
"created_at": "2026-03-09 10:53:58"
},
{
"update_id": "374ad8d18f1a1fddf09a856d61787c5c",
"from_player_id": "48",
"type": "play_animation",
"data": {
"animation": "victory",
"duration": 2
},
"created_at": "2026-03-09 10:54:16"
}
],
"last_update": "374ad8d18f1a1fddf09a856d61787c5c"
}
$ curl -X POST "/api/game_room.php/updates/poll" \
-H "X-Api-Token: API_TOKEN" \
-H "X-Game-Player-Token: PLAYER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"from_players": "host",
"last_update": "a28388775fcf9478c6926cbe44f9d3ed"
}'
{
"success": true,
"updates": [
{
"update_id": "f26cbcdab3939b968f148edf68a9fe54",
"from_player_id": "48",
"type": "play_animation",
"data": {
"animation": "victory",
"duration": 2
},
"created_at": "2026-03-09 10:53:58"
}
],
"last_update": "f26cbcdab3939b968f148edf68a9fe54"
}
$ curl "/api/game_room.php/current"
{
"success": true,
"in_room": true,
"room": {
"room_id": "05f157893b1237f7699e548d045904ab",
"room_name": "Game from Matchmaking 636b3f",
"is_host": false,
"is_online": true,
"max_players": 4,
"current_players": 2,
"has_password": false,
"is_active": true,
"player_name": "TestPlayer",
"joined_at": "2026-03-06 17:50:35",
"last_heartbeat": "2026-03-06 18:02:35",
"room_created_at": "2026-03-06 17:50:35",
"room_last_activity": "2026-03-06 18:04:58"
},
"pending_actions": [],
"pending_updates": []
}
$ curl -X POST "/api/censor.php" \
-H "X-Api-Token: API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"text": "message a player wants to display"
}'
{
"success": true,
"clean": true,
"filtered": "message a player wants to display"
}
{
"success": true,
"clean": false,
"filtered": "********"
}
Body field text (string, max 1000 UTF-8 characters). Requires API TOKEN only — no player session. Rate-limited per game + IP. The local SDK TextFilter gives instant offline screening; this endpoint stays authoritative — a missed local flag still fails server-side.
$ curl -X POST "/api/game_players.php/register" \
-H "X-Api-Token: INVALID_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"player_name": "TestPlayer"
}'
{
"success": false,
"error": "Invalid API token",
"message": "Authentication failed"
}