PyPI Package

Python SDK (noxaeapi-sdk)

Official typed Python client library for the NoxAeApi REST + WebSocket platform. Built entirely on standard library urllib with zero required runtime dependencies.

PyPInoxaeapi-sdkv0.4.1Python 3.8+Zero Runtime DependenciesWebSocket Extra [ws]

Zero Dependencies

Built entirely on standard library urllib. Fast, lightweight, and isolated from dependency conflicts.

13 Core Modules

Complete coverage for players, economy, server, worlds, plugins, LuckPerms, NoxAuth, skills, and Velocity.

Automatic Retries

Built-in exponential backoff with configurable RetryOptions for resilient networking.

Type Hints (PEP 561)

Ships with py.typed marker and full dataclass typing for mypy and IDE autocompletion.

Installation

Install the official package from PyPI via pip or your preferred environment manager (poetry, uv, pipenv):

Terminal
pip install noxaeapi-sdk

# with realtime console/event socket support:
pip install "noxaeapi-sdk[ws]"

Basic Usage

Instantiate the NoxAeApiClient with your server base URL and API key:

main.pyPython
from noxaeapi_sdk import NoxAeApiClient

client = NoxAeApiClient(base_url="http://localhost:8080", api_key="your-api-key")

# Access any of the 12 core modules
players = client.players.list()
balance = client.economy.get_balance(players[0]["uuid"])
client.server.broadcast("Hello from the Python SDK!")

Loading from Environment

Initialize the client automatically from process environment variables without hardcoding secrets:

env_example.pyPython
from noxaeapi_sdk import NoxAeApiClient

# Reads NOXAEAPI_BASE_URL and NOXAEAPI_KEY from os.environ.
# If you keep those in a .env file, load it yourself first (e.g. with
# python-dotenv) — the SDK never reads .env files or os.environ implicitly
# outside this method.

# 1. Standard environment variable loading
client = NoxAeApiClient.from_env()

# 2. Or override individual fields while still falling back to env vars
client = NoxAeApiClient.from_env(timeout=15.0)

Environment Convention

NoxAeApiClient.from_env() reads NOXAEAPI_BASE_URL and NOXAEAPI_KEY from os.environ. If you use a .env file, load it using python-dotenv beforehand.

Realtime WebSocket Streams

Stream live Minecraft server console logs and game events over WebSocket connections:

realtime.pyPython
from noxaeapi_sdk import NoxAeApiClient

client = NoxAeApiClient.from_env()

# 1. Connect to live console output stream (authenticates via ?key= query parameter)
console_socket = client.connect(route="console")

console_socket.on("open", lambda _: print("Connected to console stream"))
console_socket.on("console", lambda line: print("[Minecraft Console]", line))
console_socket.on("error", lambda err: print("WebSocket error:", err))
console_socket.on("close", lambda _: print("Console connection closed"))

# 2. Connect to live game events (joins, quits, deaths, kicks, bans, chat)
events_socket = client.connect(route="events")

def on_event(evt):
    print("Live Event:", evt.get("event"), "Player:", (evt.get("player") or {}).get("name"))

events_socket.on("event", on_event)

# Sockets run on a background thread and include automatic reconnect
# with exponential backoff.

WebSocket Extra Required

WebSocket streaming requires the [ws] extra: pip install "noxaeapi-sdk[ws]". Connections run in background threads and feature automatic exponential reconnect.

Error Handling & Exceptions

All non-2xx HTTP responses raise typed exception classes inheriting from NoxAeApiError:

errors.pyPython
from noxaeapi_sdk import (
    NoxAeApiForbiddenError,
    NoxAeApiNotFoundError,
    NoxAeApiRateLimitError,
)

try:
    client.server.restart()
except NoxAeApiForbiddenError:
    print("This API key isn't allowed to restart the server.")
except NoxAeApiNotFoundError:
    print("The requested resource was not found.")
except NoxAeApiRateLimitError:
    print("Rate limit hit, consider lowering request frequency.")
Exception Hierarchy
NoxAeApiUnauthorizedError401 — API key is missing or rejected
NoxAeApiForbiddenError403 — API key is valid but lacks permissions for this endpoint
NoxAeApiNotFoundError404 — Target player, world, or resource does not exist
NoxAeApiRateLimitError429 — Rate limit exceeded (auto-retried when retry is enabled)
NoxAeApiServerError5xx — Minecraft server internal error (auto-retried)
NoxAeApiNetworkErrorConnection refused, DNS failure, or socket timeout

Client Configuration

Customize timeouts, retry strategies with exponential backoff, and custom request headers:

config_example.pyPython
from noxaeapi_sdk import NoxAeApiClient, RetryOptions

client = NoxAeApiClient(
    base_url="https://mc.example.com",
    api_key="...",
    timeout=10.0,               # per-request timeout in seconds, default 10
    retry=RetryOptions(
        attempts=3,              # total attempts including the first, default 3
        base_delay_ms=300,
        max_delay_ms=5000,
    ),
    # retry=False,               # disable retries entirely
    headers={"X-Extra": "..."},
)

Modules Catalog (13)

Browse all 13 sub-modules available under the NoxAeApiClient instance:

MethodReturn TypeDescriptionREST Spec
list()
List[OnlinePlayer]Get an array of all currently online players with locations, health, and metadata.Endpoint
list_all()
List[OfflinePlayer]Get every player the server has ever seen (online + offline).Endpoint
get(uuid)
OnlinePlayer | OfflinePlayerGet in-depth attributes and real-time state for a specific player by UUID.Endpoint
get_inventory(player_uuid, world_uuid)
List[InventoryItem]Inspect a player's inventory slots in a specific world.Endpoint
kick(uuid, reason=None)ADMIN
NoneDisconnect an online player with an optional reason.Endpoint
ban(uuid, reason=None, expiry=None)ADMIN
NoneBan a player UUID with optional reason and ISO-8601 expiry. Omit expiry for permanent ban.Endpoint
unban(uuid)ADMIN
NoneRemove a player ban entry by UUID.Endpoint
teleport(uuid, location)
NoneTeleport a player to {"x", "y", "z", "world"} coordinates.Endpoint
set_gamemode(uuid, gamemode)ADMIN
NoneUpdate the active gamemode ("survival" | "creative" | "adventure" | "spectator").Endpoint
get_stats(uuid)
PlayerStatsFetch gameplay statistics (kills, deaths, playtime, blocks placed/broken).Endpoint
resolve(player)
PlayerProfileResolve a player UUID or username to a complete PlayerProfile dataclass.Endpoint
get_player_profile(player)
PlayerProfileFetch detailed profile attributes for a player by UUID or username.Endpoint
get_player_profiles(players)
List[PlayerProfile]Batch resolve multiple player UUIDs or usernames in a single API call.Endpoint
Usage Example
examples/players_example.pyPython
# Teleport player and perform moderation actions
player = client.players.get("069a79f4-44e9-4726-a5be-fca90e38aaf5")

# Teleport to spawn coordinates
client.players.teleport(player["uuid"], {
    "x": 100.5,
    "y": 64.0,
    "z": -250.0,
    "world": "world",
})

# Set gamemode or unban player
client.players.set_gamemode(player["uuid"], "survival")
# client.players.unban(player["uuid"])

See Also & Integrations