
Developer API
Free REST API for Minecraft server status, badges, and embeddable widgets.
Overview
The ServerHub API provides free access to Minecraft server data. Use it to build Discord bots, website widgets, monitoring tools, or anything else you can imagine.
Status API
Ping any server
Badge API
Dynamic SVG/PNG badges
Widgets
Embeddable live widgets
Base URL
All API endpoints use the base URL: https://minecraft-serverhub.com
Server Status API
/api/ping?host={host}&port={port}&platform={platform}Ping a Minecraft server to check its online status, player count, version, and MOTD.
| Parameter | Type | Required | Description |
|---|---|---|---|
host | string | Required | Server hostname or IP address (e.g., play.hypixel.net) |
port | number | Optional | Server port. Defaults to 25565 (Java) or 19132 (Bedrock) |
platform | string | Optional | "java" or "bedrock". Defaults to "java" |
Response
{
"online": true,
"players": { "online": 42, "max": 100 },
"version": "1.21.4",
"motd": "Welcome to my server!",
"favicon": "data:image/png;base64,...",
"ping": 45,
"error": null
}Code Examples
const response = await fetch(
'https://minecraft-serverhub.com/api/ping?host=play.hypixel.net'
);
const data = await response.json();
if (data.online) {
console.log(`Server is online with ${data.players.online} players`);
} else {
console.log('Server is offline');
}import requests
response = requests.get(
'https://minecraft-serverhub.com/api/ping',
params={'host': 'play.hypixel.net', 'platform': 'java'}
)
data = response.json()
if data['online']:
print(f"Online: {data['players']['online']}/{data['players']['max']}")
else:
print("Server is offline")curl "https://minecraft-serverhub.com/api/ping?host=play.hypixel.net&platform=java"Badge API
Dynamic badges that show your server's live status. Perfect for README files, forum signatures, and websites.
/api/badges/{slug}/svg?style={style}Returns a dynamic SVG badge showing server name, player count, and online status.
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Required | Server slug from the server's ServerHub URL |
style | string | Optional | "flat" (default), "flat-square", or "for-the-badge" |
/api/badges/{slug}/png?style={style}Same as SVG but returns a PNG image. Useful for platforms that don't support SVG.
Badge Styles
flatflat-squarefor-the-badgeEmbed Code
<!-- Replace 'your-server' with your server's slug -->
<a href="https://minecraft-serverhub.com/servers/your-server">
<img src="https://minecraft-serverhub.com/api/badges/your-server/svg"
alt="Server Status" />
</a>[](https://minecraft-serverhub.com/servers/your-server)[url=https://minecraft-serverhub.com/servers/your-server]
[img]https://minecraft-serverhub.com/api/badges/your-server/png[/img]
[/url]Embeddable Widgets
Embed a live server status widget on your website. The widget updates automatically every 60 seconds and shows your server's real-time status, player count, and more.
/api/widgets/{slug}?theme={theme}&size={size}Returns a complete HTML page for use in an iframe. Shows live server status with auto-refresh.
| Parameter | Type | Required | Description |
|---|---|---|---|
slug | string | Required | Server slug from your ServerHub URL |
theme | string | Optional | "dark" (default), "light", or "transparent" |
size | string | Optional | "compact" (~40px), "standard" (~80px, default), or "full" (~120px) |
Embed Code
<!-- Replace 'your-server' with your server's slug -->
<iframe
src="https://minecraft-serverhub.com/api/widgets/your-server?theme=dark&size=standard"
width="300"
height="90"
frameborder="0"
style="border: none; border-radius: 8px;"
></iframe><iframe
src="https://minecraft-serverhub.com/api/widgets/your-server?theme=dark&size=compact"
width="280"
height="50"
frameborder="0"
style="border: none;"
></iframe>Theme Options
Pro Tip
The widget automatically updates every 60 seconds. The "View on ServerHub" link at the bottom helps players find your full server page with reviews, vote links, and more details.
Rate Limits & Best Practices
| Endpoint | Rate Limit | Cache TTL |
|---|---|---|
| /api/ping | 60 req/min | None (live) |
| /api/badges/*/svg | 120 req/min | 5 minutes (Redis) |
| /api/badges/*/png | 120 req/min | 5 minutes (Redis) |
| /api/widgets/* | 60 req/min | 5 minutes |
Best Practices
- Cache responses for at least 60 seconds in your application to minimize API calls.
- Handle errors gracefully. Servers may go offline or timeout. Always check the
onlinefield. - Use the correct platform. Java and Bedrock use different protocols. Sending a Java ping to a Bedrock server will fail.
- Set a User-Agent header in your requests so we can identify your application if there are issues.
Frequently Asked Questions
Is the API free to use?
What are the rate limits?
Can I use the API in my Discord bot?
Do badges count as backlinks?
<a> tag that links back to the server's page on ServerHub. This is a natural attribution link.