Skip to content

API Reference

Complete API reference for all CraftServerManager endpoints.

Base URL

http://your-server-ip:8080/api

Endpoints Overview

Authentication

User registration, login, and session management.

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login and get JWT token
  • GET /api/auth/me - Get current user info
  • POST /api/auth/verify-code - Verify registration code

View Authentication API →

Whitelist Management

Manage server whitelist entries.

  • GET /api/whitelist - Get whitelist entries
  • POST /api/whitelist/add - Add player to whitelist
  • POST /api/whitelist/remove - Remove player from whitelist
  • GET /api/whitelist/check - Check whitelist status

View Whitelist API →

Players

View and manage online players.

  • GET /api/players - List online players
  • GET /api/player/inventory - Get player inventory
  • POST /api/player/inventory/sell - Sell inventory items
  • GET /api/player/maps - Get player maps

View Players API →

Economy

Balance management and transaction history.

  • GET /api/economy/balance - Get player balance
  • GET /api/economy/history - Get transaction history
  • GET /api/economy/market-prices - Get market prices
  • GET /api/economy/symbol - Get currency symbol

View Economy API →

Shop

Browse items and make purchases.

  • GET /api/shop/items - List available items
  • POST /api/shop/purchase - Purchase an item
  • GET /api/shop/weekly - Get weekly shop deals
  • GET /api/shop/resources - Get shop resources
  • GET /api/shop/resources/available - List available resources

View Shop API →

Jobs

Job system integration.

  • GET /api/jobs - List all jobs
  • GET /api/jobs/details - Get job details for player
  • POST /api/jobs/join - Join a job
  • POST /api/jobs/leave - Leave a job

View Jobs API →

Admin 🔒

Administrative functions (admin only).

  • GET /api/admin/settings - Get server settings
  • POST /api/admin/settings - Update settings
  • GET /api/admin/users - List all users
  • GET /api/admin/connections - View connection logs
  • POST /api/admin/discord/test - Test Discord webhook
  • GET /api/admin/messages - Get messages
  • POST /api/admin/messages/send - Send message to player
  • POST /api/admin/restart - Schedule server restart

View Admin API →

Server

Server information and health.

  • GET /api/health - Health check
  • GET /api/server/info - Get server information
  • GET /api/server/stats - Get server statistics

View Server API →

Teleport 🔒

Player teleportation (admin only).

  • POST /api/teleport - Teleport player
  • POST /api/admin/teleport-coordinates - Teleport to coordinates
  • POST /api/admin/teleport-player - Teleport to player

View Teleport API →

Leaderboard

Player rankings and statistics.

  • GET /api/leaderboard - Get leaderboard

View Leaderboard API →

Cache

Cache management (admin only).

  • GET /api/cache/stats - Get cache statistics
  • POST /api/cache/invalidate - Invalidate cache

Request Format

All POST, PUT, and PATCH requests should include:

http
Content-Type: application/json

Protected endpoints require:

http
Authorization: Bearer YOUR_JWT_TOKEN

Response Format

Success Response

json
{
  "success": true,
  "data": {
    // Response data
  }
}

Error Response

json
{
  "success": false,
  "error": "Error message description"
}

HTTP Status Codes

CodeDescription
200OK - Request succeeded
201Created - Resource created
204No Content - Request succeeded, no content returned
400Bad Request - Invalid request parameters
401Unauthorized - Authentication required
403Forbidden - Insufficient permissions
404Not Found - Resource not found
405Method Not Allowed - HTTP method not supported
500Internal 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:

json
{
  "success": true,
  "data": [...],
  "pagination": {
    "page": 1,
    "limit": 20,
    "total": 100,
    "pages": 5
  }
}

CORS

CORS is enabled by default:

http
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
Access-Control-Allow-Headers: Content-Type, Authorization

WebSocket 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:

Released under the MIT License.