Overview

The Star Defenders Monitoring API provides real-time information about community game servers, including player counts, ping, uptime, and connection status.

All endpoints return JSON and are publicly accessible. No API key is required.

Get All Servers

Endpoint:

/api/v1/servers

Example Response:

{
  "success": true,
  "count": 2,
  "servers": [
    {
      "id": 1,
      "url": "https://example-server.com",
      "host": "example-server.com",
      "status": "online",
      "description": "Main EU server",
      "location": "Germany",
      "hosted_by": "Community Host",
      "admins": "Admin1, Admin2",
      "players_on_server": 12,
      "players_online": 34,
      "ping_ms": 48,
      "uptime_percent": 99.92,
      "last_online": "2026-05-19T10:00:00Z",
      "last_offline": null
    }
  ]
}

Get Global Stats

Endpoint:

/api/v1/stats

Example Response:

{
  "success": true,
  "stats": {
    "total_servers": 10,
    "online_servers": 7,
    "total_players": 142,
    "avg_ping": 63.5
  }
}

Server History

Get historical uptime and player data for a specific server.

Endpoint:

/api/v1/history/:id

Example:

/api/v1/history/1
{
  "success": true,
  "count": 3,
  "history": [
    {
      "id": 1,
      "server_id": 1,
      "timestamp": "2026-05-19T10:00:00Z",
      "players_on_server": 10,
      "players_online": 25,
      "ping_ms": 50,
      "status": "online"
    }
  ]
}

Rediscover Servers

Forces the API to scan and detect new servers. Useful if a new server was added.

Endpoint:

/api/v1/rediscover
GET https://api.stardefenders.io/api/v1/rediscover
{
  "success": true
}

JavaScript Example (Frontend)

fetch("https://api.stardefenders.io/api/v1/servers")
  .then(res => res.json())
  .then(data => {
      console.log("Servers:", data.servers);

      data.servers.forEach(server => {
          console.log(
              server.host,
              server.status,
              server.players_online
          );
      });
  })
  .catch(err => console.error(err));

Node.js Example (Backend)

const axios = require("axios");

async function getServers() {
    try {
        const res = await axios.get(
            "https://api.stardefenders.io/api/v1/servers"
        );

        console.log(res.data.servers);

    } catch (err) {
        console.error("API error:", err.message);
    }
}

getServers();

Important Notes

• Data updates every ~60 seconds
• Do not poll faster than 1 request per minute
• Rate limit: 120 requests/minute
• WebSocket support may be added later