DEV Community

Draginox
Draginox

Posted on

5 Free APIs Every Minecraft Developer Should Know About

Whether you're building a Discord bot, a server status page, or a Minecraft plugin companion app, you need APIs. Here are 5 free APIs that every Minecraft developer should have in their toolkit — all with code examples.

1. Minecraft ServerHub API — Server Status & Monitoring

What it does: Query any Java or Bedrock Minecraft server for real-time status data including player count, MOTD, version, latency, and server icon.

Why it's useful: The most common thing Minecraft developers need is server status data. This API provides it for any server without authentication.

Base URL: https://minecraft-serverhub.com/api

Example — Check server status:

async function checkServer(address) {
  const res = await fetch("https://minecraft-serverhub.com/api/server/" + address);
  const data = await res.json();
  console.log("Online:", data.online);
  console.log("Players:", data.players.online + "/" + data.players.max);
  console.log("Version:", data.version);
  console.log("MOTD:", data.motd.clean);
  return data;
}

checkServer("play.hypixel.net");
Enter fullscreen mode Exit fullscreen mode

Example — Generate a status badge:

// Returns an SVG image URL you can embed anywhere
const badgeUrl = "https://minecraft-serverhub.com/api/badge/play.hypixel.net?style=flat&players=true";
Enter fullscreen mode Exit fullscreen mode

Bonus features:

Rate limit: Generous, no API key needed.

2. Mojang API — Player Profiles & UUIDs

What it does: Look up Minecraft player profiles, convert usernames to UUIDs, and fetch player skin data.

Why it's useful: Almost every Minecraft tool needs to resolve player names to UUIDs or display player skins/heads.

Example — Username to UUID:

async function getUUID(username) {
  const res = await fetch("https://api.mojang.com/users/profiles/minecraft/" + username);
  if (!res.ok) return null;
  const data = await res.json();
  return data.id; // UUID without dashes
}

// Returns something like "069a79f444e94726a5befca90e38aaf5"
getUUID("Notch").then(console.log);
Enter fullscreen mode Exit fullscreen mode

Example — Get skin texture URL:

async function getSkinUrl(uuid) {
  const res = await fetch("https://sessionserver.mojang.com/session/minecraft/profile/" + uuid);
  const data = await res.json();
  const props = JSON.parse(atob(data.properties[0].value));
  return props.textures.SKIN.url;
}
Enter fullscreen mode Exit fullscreen mode

Rate limit: 600 requests per 10 minutes.

3. Crafatar — Player Avatars & Renders

What it does: Generates player head renders, full body renders, and skin images from UUIDs. No API key needed.

Why it's useful: Displaying player avatars in your Discord bot, website, or dashboard. Perfect companion to the Minecraft ServerHub player data.

Example — Player head image:

<!-- 64x64 player head -->
<img src="https://crafatar.com/avatars/069a79f444e94726a5befca90e38aaf5?size=64" alt="Notch" />

<!-- Full body render -->
<img src="https://crafatar.com/renders/body/069a79f444e94726a5befca90e38aaf5?scale=4" alt="Notch" />
Enter fullscreen mode Exit fullscreen mode

Example — In JavaScript:

function getPlayerHead(uuid, size) {
  return "https://crafatar.com/avatars/" + uuid + "?size=" + (size || 64) + "&overlay";
}
Enter fullscreen mode Exit fullscreen mode

Rate limit: Reasonable, cached responses.

4. MCStatus.io — Backup Status Checker

What it does: Another server status API with slightly different data formatting. Good as a fallback.

Why it's useful: Having a backup API ensures your bot or app stays functional even if one service has downtime. Use alongside the Minecraft ServerHub API for redundancy.

Example:

async function checkServerBackup(address) {
  const res = await fetch("https://api.mcstatus.io/v2/status/java/" + address);
  const data = await res.json();
  return {
    online: data.online,
    players: data.players ? data.players.online : 0,
  };
}
Enter fullscreen mode Exit fullscreen mode

Tip: For production apps, query Minecraft ServerHub first and fall back to MCStatus.io if needed:

async function getStatus(address) {
  try {
    const res = await fetch("https://minecraft-serverhub.com/api/server/" + address);
    if (res.ok) return await res.json();
  } catch (e) {}

  // Fallback
  const res = await fetch("https://api.mcstatus.io/v2/status/java/" + address);
  return await res.json();
}
Enter fullscreen mode Exit fullscreen mode

5. CraftHead — Fast Head Renders via Cloudflare Workers

What it does: Ultra-fast player head renders served through Cloudflare's edge network.

Why it's useful: When you need the fastest possible player avatars for high-traffic applications.

Example:

<img src="https://crafthead.net/avatar/069a79f444e94726a5befca90e38aaf5/64" alt="Player head" />
Enter fullscreen mode Exit fullscreen mode

Putting It All Together

Here's a real-world example that combines multiple APIs to build a server status widget:

async function buildServerWidget(address) {
  // Get server status from Minecraft ServerHub
  const serverRes = await fetch("https://minecraft-serverhub.com/api/server/" + address);
  const server = await serverRes.json();

  if (!server.online) {
    return { status: "offline", badge: "https://minecraft-serverhub.com/api/badge/" + address };
  }

  // Get player heads for online players (if player list available)
  const playerHeads = [];
  if (server.players.list) {
    for (const player of server.players.list.slice(0, 5)) {
      playerHeads.push({
        name: player.name,
        head: "https://crafatar.com/avatars/" + player.id + "?size=32&overlay",
      });
    }
  }

  return {
    status: "online",
    players: server.players.online + "/" + server.players.max,
    version: server.version,
    motd: server.motd.clean,
    badge: "https://minecraft-serverhub.com/api/badge/" + address + "?style=flat",
    playerHeads: playerHeads,
  };
}
Enter fullscreen mode Exit fullscreen mode

Comparison Table

API Auth Required Rate Limit Best For
Minecraft ServerHub No Generous Server status, badges, monitoring
Mojang API No 600/10min Player UUIDs, profiles
Crafatar No Reasonable Player avatars
MCStatus.io No Moderate Backup status checks
CraftHead No High Fast avatar renders

Which API Should You Use?

Resources


Server status data powered by Minecraft ServerHub — free tools and APIs for the Minecraft developer community.

Top comments (0)