Back to Blog
Server AdministrationJanuary 29, 2026

How to Display Your Hytale Server's Player Count on Your Website

Learn how to display your Hytale server's live player count on your website using the Hyvote API. Includes JavaScript and PHP examples.

How to Display Your Hytale Server's Player Count on Your Website

If you've listed your server on Hyvote, you can use our API to display your live player count directly on your website. It's a quick way to show visitors that your server is active and worth checking out.

This guide covers how to generate your API key and fetch your server data using JavaScript or PHP.

Generate Your API Key

Head to your Hyvote profile settings and generate an API key. Keep this key private, as it's tied to your account and server data.

API Endpoints

You have two options depending on what you need:

Endpoint Returns
/api/v1/servers/[id]/status?key=YOUR_API_KEY Full server status (JSON object)
/api/v1/servers/[id]/players?key=YOUR_API_KEY Online player count (integer)

Replace [id] with your server ID and YOUR_API_KEY with the key you generated.

Full Status Response

The /status endpoint returns a JSON object with your server's complete information:

{
  "id": 129,
  "name": "My New Server",
  "hostname": "play.example.com",
  "port": 5520,
  "rank": 70,
  "votes": 1,
  "online": false,
  "players": {
    "online": 0,
    "max": 0
  },
  "version": null,
  "motd": null,
  "lastUpdated": "2026-01-28 21:16:02"
}

This is useful if you want to display more than just the player count, such as your server's rank, vote count, or online status.

JavaScript Example

Here's a simple way to fetch and display your player count:

async function getPlayerCount() {
  const serverId = 129;
  const apiKey = 'YOUR_API_KEY';
  
  try {
    const response = await fetch(
      `https://hyvote.org/api/v1/servers/${serverId}/players?key=${apiKey}`
    );
    const playerCount = await response.text();
    
    document.getElementById('player-count').textContent = playerCount;
  } catch (error) {
    console.error('Failed to fetch player count:', error);
  }
}

getPlayerCount();

Add this to your page along with an element to display the count:

<p>Players online: <span id="player-count">Loading...</span></p>

PHP Example

If you're working with PHP, you can fetch the data server-side:

<?php
$serverId = 129;
$apiKey = 'YOUR_API_KEY';

$url = "https://hyvote.org/api/v1/servers/{$serverId}/players?key={$apiKey}";
$playerCount = file_get_contents($url);

if ($playerCount !== false) {
    echo "Players online: " . htmlspecialchars($playerCount);
} else {
    echo "Unable to fetch player count";
}
?>

For the full status data, use json_decode() to parse the response:

<?php
$serverId = 129;
$apiKey = 'YOUR_API_KEY';

$url = "https://hyvote.org/api/v1/servers/{$serverId}/status?key={$apiKey}";
$response = file_get_contents($url);

if ($response !== false) {
    $server = json_decode($response);
    echo $server->name . ": " . $server->players->online . "/" . $server->players->max . " players";
}
?>

Tips

  • Keep your API key out of client-side code if possible. For JavaScript implementations, consider creating a simple proxy endpoint on your server.
  • Cache the response for a few minutes to reduce API calls if you have high traffic.
  • The online boolean in the full response tells you whether the server is currently reachable.

Still Stuck?

Join our Discord and ask for help!

Join Discord Server

Written by Hyvote Team

Related Posts