Skip to content

Server Info

Server hostname, uptime, kernel, CPU and memory metrics.

All endpoints below are mounted under /api. Authentication: Authorization: Bearer <token> unless noted as public.

Endpoint count: 4

Endpoints

Method Path Handler Guards
GET /api/server/activitylog getActivityLog RequirePermission(db, "administrative_operations")
GET /api/server/info getServerInfo RequirePermission(db, "administrative_operations")
POST /api/server/service/:name/:action serviceAction RequirePermission(db, "administrative_operations")
GET /api/server/services getServices RequirePermission(db, "administrative_operations")

Source

Handlers for this section live in api/routes/handlers_*.go in the StarkOne source. None of the endpoints on this page read a request body; they respond with the standard envelope:

{ "data": { ... } }

On error:

{ "error": { "code": "string", "message": "string" } }

Reference

GET /api/server/activitylog

Returns the 100 most recent entries from the activitylog table, ordered newest first.

Guards: RequirePermission(db, "administrative_operations")

Response - 200 OK

{
  "data": {
    "log": [
      {
        "id": 42,
        "action": "service.restart",
        "user_id": 1,
        "ip": "203.0.113.10",
        "comment": "restarted nginx",
        "created_at": "2026-06-17T12:00:00Z"
      }
    ]
  }
}

user_id may be null. When no rows exist, log is an empty array ([]).

Errors

Status Code Meaning
500 server_error Database query against activitylog failed.

Example

curl -X GET https://panel.example.com:2087/api/server/activitylog \
  -H "Authorization: Bearer $TOKEN"

GET /api/server/info

Returns collected system information (hostname, uptime, load, CPU, memory, disk, OS/kernel, server IPs, web server / DB / PHP versions).

Guards: RequirePermission(db, "administrative_operations")

Response - 200 OK

{
  "data": {
    "hostname": "host.example.com",
    "uptime": 864000,
    "load_avg": [0.15, 0.20, 0.18],
    "cpu_usage": 4.2,
    "memory": { "total": 8589934592, "used": 3221225472, "free": 5368709120, "used_percent": 37.5 },
    "disk": [
      { "path": "/", "total": 107374182400, "used": 42949672960, "free": 64424509440, "used_percent": 40.0 }
    ],
    "os": "linux",
    "kernel": "5.15.0-101-generic",
    "cpu_cores": 4,
    "server_ipv4": "203.0.113.10",
    "server_ipv6": "",
    "web_server": "nginx 1.24.0",
    "db_version": "10.11.6-MariaDB",
    "php_versions": "8.1, 8.2, 8.3"
  }
}

load_avg is a three-element array (1/5/15-minute). server_ipv6 is an empty string when none is detected; web_server is "-" when neither nginx nor Apache is found.

Errors

Status Code Meaning
500 server_error Collecting system info failed.

Example

curl -X GET https://panel.example.com:2087/api/server/info \
  -H "Authorization: Bearer $TOKEN"

POST /api/server/service/:name/:action

Runs a systemd action (start, stop, restart, enable, disable, or reload) on the named service via systemctl.

Guards: RequirePermission(db, "administrative_operations")

Path parameters

Name Type Description
name string Systemd service name (without the .service suffix), e.g. nginx.
action string Action to perform; one of start, stop, restart, enable, disable, reload.

Response - 200 OK

{ "data": { "success": true } }

Errors

Status Code Meaning
400 action_failed Unknown action, or the underlying systemctl <action> <name> command failed (message contains command output).

Side effects

  • Executes systemctl <action> <name>, changing the running/enabled state of the service on the host.

Example

curl -X POST https://panel.example.com:2087/api/server/service/nginx/restart \
  -H "Authorization: Bearer $TOKEN"

GET /api/server/services

Lists loaded systemd services (filtered to exclude system/internal units), enriched with active/enabled state, reload capability, description, PID, and memory usage.

Guards: RequirePermission(db, "administrative_operations")

Response - 200 OK

{
  "data": {
    "services": [
      {
        "name": "nginx",
        "active": true,
        "enabled": true,
        "can_reload": true,
        "description": "A high performance web server",
        "pid": 1234,
        "memory_mb": 25.4,
        "memory_rss": 18.2
      }
    ]
  }
}

If systemctl list-units fails, the handler falls back to a known-services list rather than erroring.

Side effects

  • Read-only, but spawns systemctl (and cat /proc/<pid>/status) subprocesses to gather per-service details.

Example

curl -X GET https://panel.example.com:2087/api/server/services \
  -H "Authorization: Bearer $TOKEN"