API Reference (For Hosters)
The Hub exposes a RESTful API to manage the entire infrastructure programmatically. This allows full integration into existing hosting panels (WHMCS, Pterodactyl, etc.).
1. Authentication
All API requests (except login) require authentication via a Bearer Token.
Header:
Authorization: Bearer <YOUR_TOKEN>
Obtaining a Token
Method A: CLI Generation (Recommended for Backend Integrations) Generate a long-lived (1 year) token that doesn't expire quickly.
# Inside the Hub container
./hub -gen-token hub_admin
Method B: Login Endpoint (For Frontend/Scripts) Exchange credentials for a short-lived (24h) session token.
- Endpoint:
POST /api/login - Payload:
{
"username": "hub_admin",
"password": "your-password"
}
- Response:
{"token": "eyJhbGci..."}
Changing Credentials (CLI)
If you need to reset an administrative password or change a username without access to the UI/API:
# Inside the Hub container
./hub -change-password "old_username:new_password"
Note: This command updates the password for the specified user and can also be used to regain access.
2. Managing Routes (Traffic Rules)
Routes define how traffic entering a Gate is forwarded to a Link.
List Routes
Get all active routing rules.
- GET
/api/routes - Response: Array of Route objects.
Create Route
- POST
/api/routes - Payload (Standard):
{
"domain": "play.myserver.com",
"target_ip": "127.0.0.1",
"target_port": 25565,
"agent_id": 1
}
3. Managing Agents (Links)
Create Agents
Allows the currently authenticated user to change their username and password.
- POST
/api/agents - Payload:
{
"name": "My Dedicated Server 01",
"mode": "push", // "push" oder "redis"
"push_url": "http://10.0.0.5:9000" // Nur nötig für "push" mode
}
- Response:
{
"ID": 5,
"name": "My Dedicated Server 01",
"token": "d7a46d23-...", // <--- DAS IST DAS SECRET
"enabled": true,
...
}
List Agents (token/secret is included in response)
- GET
/api/agents
Rotate Token
- POST
/api/agents/:id/reset-token
4. Managing Gates (Ingress)
List Gates
- GET
/api/gates
5. System & Logs
Get Logs
- GET
/api/logs?limit=100
Get Statistics
- GET
/api/stats
6. User Management
Change Credentials (API)
Allows the currently authenticated user to change their username and password.
- POST
/api/change-credentials - Payload:
{
"new_user": "new_admin_name",
"new_password": "secure-new-password"
}
- Response:
{"success": true}