API Reference
Complete API reference for all CraftServerManager endpoints.
Base URL
http://your-server-ip:8080/apiEndpoints Overview
Authentication
User registration, login, and session management.
POST /api/auth/register- Register new userPOST /api/auth/login- Login and get JWT tokenGET /api/auth/me- Get current user infoPOST /api/auth/verify-code- Verify registration code
Whitelist Management
Manage server whitelist entries.
GET /api/whitelist- Get whitelist entriesPOST /api/whitelist/add- Add player to whitelistPOST /api/whitelist/remove- Remove player from whitelistGET /api/whitelist/check- Check whitelist status
Players
View and manage online players.
GET /api/players- List online playersGET /api/player/inventory- Get player inventoryPOST /api/player/inventory/sell- Sell inventory itemsGET /api/player/maps- Get player maps
Economy
Balance management and transaction history.
GET /api/economy/balance- Get player balanceGET /api/economy/history- Get transaction historyGET /api/economy/market-prices- Get market pricesGET /api/economy/symbol- Get currency symbol
Shop
Browse items and make purchases.
GET /api/shop/items- List available itemsPOST /api/shop/purchase- Purchase an itemGET /api/shop/weekly- Get weekly shop dealsGET /api/shop/resources- Get shop resourcesGET /api/shop/resources/available- List available resources
Jobs
Job system integration.
GET /api/jobs- List all jobsGET /api/jobs/details- Get job details for playerPOST /api/jobs/join- Join a jobPOST /api/jobs/leave- Leave a job
Admin 🔒
Administrative functions (admin only).
GET /api/admin/settings- Get server settingsPOST /api/admin/settings- Update settingsGET /api/admin/users- List all usersGET /api/admin/connections- View connection logsPOST /api/admin/discord/test- Test Discord webhookGET /api/admin/messages- Get messagesPOST /api/admin/messages/send- Send message to playerPOST /api/admin/restart- Schedule server restart
Server
Server information and health.
GET /api/health- Health checkGET /api/server/info- Get server informationGET /api/server/stats- Get server statistics
Teleport 🔒
Player teleportation (admin only).
POST /api/teleport- Teleport playerPOST /api/admin/teleport-coordinates- Teleport to coordinatesPOST /api/admin/teleport-player- Teleport to player
Leaderboard
Player rankings and statistics.
GET /api/leaderboard- Get leaderboard
Cache
Cache management (admin only).
GET /api/cache/stats- Get cache statisticsPOST /api/cache/invalidate- Invalidate cache
Request Format
All POST, PUT, and PATCH requests should include:
Content-Type: application/jsonProtected endpoints require:
Authorization: Bearer YOUR_JWT_TOKENResponse Format
Success Response
{
"success": true,
"data": {
// Response data
}
}Error Response
{
"success": false,
"error": "Error message description"
}HTTP Status Codes
| Code | Description |
|---|---|
| 200 | OK - Request succeeded |
| 201 | Created - Resource created |
| 204 | No Content - Request succeeded, no content returned |
| 400 | Bad Request - Invalid request parameters |
| 401 | Unauthorized - Authentication required |
| 403 | Forbidden - Insufficient permissions |
| 404 | Not Found - Resource not found |
| 405 | Method Not Allowed - HTTP method not supported |
| 500 | Internal Server Error - Server error |
Authentication
Most endpoints require JWT authentication. See the Authentication Guide for details.
Pagination
Endpoints that return lists may support pagination:
Query Parameters:
page- Page number (default: 1)limit- Items per page (default: 20, max: 100)
Response:
{
"success": true,
"data": [...],
"pagination": {
"page": 1,
"limit": 20,
"total": 100,
"pages": 5
}
}CORS
CORS is enabled by default:
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type, AuthorizationWebSocket Support
Currently, the API does not support WebSocket connections. All communication is done via HTTP REST endpoints.
Versioning
The API is currently unversioned. Future versions may introduce versioning in the URL path (e.g., /api/v2/...).
Next Steps
Browse the complete API documentation by category: