NeoHLSW
TF2 Server Watch
Servers Online 0 / 0
Total Players Online 0
Total Capacity 0
Active Maps 0

NeoHLSW Public API & Data Feed

Embed live server status, maps, player counts, and full rosters directly into your own websites, forums, or community portals. All public endpoints support CORS (Access-Control-Allow-Origin: *) and real-time Server-Sent Events (SSE) push streams.

Base URL: http://localhost:8080
Format: JSON / UTF-8
CORS: Enabled (*)
GET /api/servers
Public (No Auth)

Returns the complete list of all active servers, including their live online status, current map, player counts, max slots, ping, tags, 1-click connect URL (steam://connect/...), and real-time player rosters.

Example JSON Response
{
  "success": true,
  "servers": [
    {
      "id": "1",
      "name": "Athabasca | Yammy's Testing Server",
      "ip": "athabascafortress.ca",
      "query_port": 27015,
      "rcon_port": 27015,
      "is_online": true,
      "map": "ctf_2fort",
      "player_count": 8,
      "max_players": 24,
      "bot_count": 0,
      "ping_ms": 14,
      "game_desc": "Team Fortress",
      "tags": "alltalk,ctf,dmgspread",
      "connect_url": "steam://connect/athabascafortress.ca:27015",
      "last_polled_at": "2026-08-16T20:00:00Z",
      "players": [
        {
          "index": 1,
          "name": "SoldierMain",
          "score": 45,
          "duration": 1250000000000,
          "duration_str": "20:50"
        }
      ]
    }
  ]
}
GET /api/servers/{server_id}
Public (No Auth)

Returns live status and active player roster for a specific server by ID.

Example Request
GET /api/servers/1
GET /api/servers/{server_id}/rules
Public (No Auth)

Queries the live Source engine cvars/rules on the game server via A2S_RULES.

Example JSON Response
{
  "success": true,
  "rules": [
    { "name": "mp_timelimit", "value": "30" },
    { "name": "sv_alltalk", "value": "1" },
    { "name": "sv_gravity", "value": "800" }
  ]
}
GET /api/events
Server-Sent Events (SSE)

Real-time HTTP stream emitting server_update events whenever a server changes map, players join or disconnect, or latency changes. Perfect for live website widgets.

Example JavaScript Integration
// Connect to live SSE feed from another website
const eventSource = new EventSource('http://localhost:8080/api/events');

eventSource.addEventListener('server_update', (event) => {
  const server = JSON.parse(event.data);
  console.log(`Server Update: ${server.name} | ${server.player_count}/${server.max_players} on ${server.map}`);
  // Update your DOM / React state live!
});
GET /api/auth/me
Session Info

Returns the current user session, authenticated status, SteamID, persona name, avatar, and admin role.

Embedding Examples

Here is how to fetch and render the live server list with plain JavaScript and HTML:

HTML / JavaScript Embed Widget
<div id="tf2-servers-widget"></div>

<script>
async function loadTF2Servers() {
  const container = document.getElementById('tf2-servers-widget');
  try {
    const res = await fetch('http://localhost:8080/api/servers');
    const data = await res.json();
    
    container.innerHTML = data.servers.map(s => `
      <div class="server-box" style="border: 1px solid #333; padding: 12px; margin-bottom: 8px; border-radius: 8px;">
        <h4>\${s.name}</h4>
        <p>Map: <strong>\${s.map}</strong> | Players: <strong>\${s.player_count}/\${s.max_players}</strong> (\${s.ping_ms}ms)</p>
        <a href="\${s.connect_url}" style="color: #f59e0b; font-weight: bold;">▶ Connect to Server</a>
      </div>
    `).join('');
  } catch (err) {
    container.innerText = 'Failed to load servers';
  }
}

loadTF2Servers();
</script>