Skip to content

API Endpoints

Alireza Janaki edited this page Dec 10, 2025 · 2 revisions

API Reference

This document provides a comprehensive reference for the UltimateServer API.

Authentication

Most API endpoints require authentication using JWT tokens. To obtain a token, use the login endpoint:

POST /api/login

Authenticate a user and get a JWT token.

Request Body:

{
  "username": "admin",
  "password": "admin123",
  "rememberMe": true
}

Response:

{
  "success": true,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "dGhpcy1pcy1hLXJlZnJlc2gtdG9rZW4...",
  "user": {
    "username": "admin",
    "role": "admin",
    "email": "admin@example.com"
  }
}

POST /api/register

Register a new user.

Request Body:

{
  "username": "newuser",
  "email": "user@example.com",
  "password": "StrongPassword123!",
  "role": "player"
}

Response:

{
  "success": true,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refreshToken": "dGhpcy1pcy1hLXJlZnJlc2gtdG9rZW4...",
  "user": {
    "username": "newuser",
    "role": "player",
    "email": "user@example.com"
  }
}

POST /api/request-password-reset

Request a password reset link to be sent to an email.

Request Body:

{
  "email": "user@example.com"
}

Response:

{
  "success": true,
  "message": "If an account with that email exists, a password reset link has been sent."
}

POST /api/confirm-password-reset

Confirm a password reset using a token.

Request Body:

{
  "email": "user@example.com",
  "token": "the-reset-token-from-email",
  "newPassword": "NewStrongPassword123!"
}

Response:

{
  "success": true,
  "message": "Password has been reset successfully."
}

System Information

GET /stats

Get basic server statistics (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Response:

{
  "uptime": "04:15:30",
  "users": 2,
  "maxConnections": 100,
  "protocol": 1
}

GET /system

Get detailed system performance data (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Response:

{
  "cpuUsage": 12.3,
  "memoryMB": 1024.5,
  "diskUsedGB": 250.0,
  "diskTotalGB": 500.0,
  "netSentMB": 1024.5,
  "netReceivedMB": 2048.8
}

GET /logs

Get recent server logs (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Response:

[
  "2023-10-27 10:00:00 [Info] Server started successfully",
  "2023-10-27 10:01:00 [Warning] High memory usage detected",
  "2023-10-27 10:02:00 [Error] Failed to connect to database"
]

Plugin Management

GET /api/plugins

Get a list of all loaded plugins (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Response:

{
  "success": true,
  "plugins": [
    {
      "id": "MyAwesomePlugin",
      "name": "My Awesome Plugin",
      "version": "1.0.0",
      "enabled": true
    }
  ]
}

POST /api/plugins/upload

Upload a new plugin file (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>
Content-Type: multipart/form-data

Request Body:

file: <plugin.dll>

Response:

{
  "success": true,
  "message": "Plugin uploaded and reloaded successfully."
}

POST /api/plugins/reload

Triggers a scan and reload of all plugins in the plugins directory (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Response:

{
  "success": true,
  "message": "Plugins reloaded successfully."
}

Marketplace

GET /api/marketplace

Get a list of plugins available from the marketplace (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Response:

{
  "success": true,
  "plugins": [
    {
      "name": "CoolPlugin",
      "description": "A very cool plugin.",
      "downloadLink": "https://example.com/CoolPlugin.dll"
    }
  ]
}

POST /api/marketplace/download

Queue a plugin for download from the marketplace (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Request Body:

{
  "name": "CoolPlugin",
  "downloadLink": "https://example.com/CoolPlugin.dll"
}

Response:

{
  "success": true,
  "message": "Download request for 'CoolPlugin.dll' has been queued and will be processed."
}

Site Management

GET /api/sites

Get a list of all managed sites (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Response:

{
  "MySite": {
    "Name": "MySite",
    "Port": 8080,
    "RootPath": "/path/to/my/site"
  }
}

POST /api/sites

Create a new site (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Request Body:

{
  "name": "NewSite",
  "port": 8081
}

Response:

{
  "success": true,
  "message": "Site created successfully"
}

DELETE /api/sites

Delete an existing site (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Request Body:

{
  "name": "OldSite"
}

Response:

{
  "success": true,
  "message": "Site deleted successfully"
}

Process Management

GET /api/process/list

Get a list of running process names (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Response:

{
  "processesName": [
    "chrome",
    "explorer",
    "UltimateServer"
  ]
}

POST /api/process/kill

Kill a running process by name (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Request Body:

{
  "processName": "notepad"
}

Response:

{
  "success": true,
  "message": "Proccess stop request for 'notepad' has been queued and will be processed."
}

Video Management

GET /videos

List all available video filenames (requires user authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Response:

[
  "example.mp4",
  "another_video.avi"
]

POST /upload-url

Upload a video from a URL (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>

Request Body:

{
  "url": "https://example.com/video.mp4"
}

Response:

{
  "success": true,
  "message": "Video downloaded successfully."
}

GET /videos/{filename}

Stream a video file (requires admin authentication).

Headers:

Authorization: Bearer <your-jwt-token>
Range: bytes=0-1023

Response:

Video file content with appropriate headers:

Content-Type: video/mp4
Content-Length: 10485760
Accept-Ranges: bytes
Content-Range: bytes 0-1023/10485760

Error Responses

All API endpoints may return error responses with appropriate HTTP status codes:

400 Bad Request

{
  "success": false,
  "message": "Invalid input"
}

401 Unauthorized

When authentication is required but not provided or is invalid.

403 Forbidden

When authentication is valid, but the user does not have the required role (e.g., 'admin').

404 Not Found

{
  "success": false,
  "message": "Resource not found"
}

500 Internal Server Error

{
  "success": false,
  "message": "Server error"
}

Clone this wiki locally