Skip to main content

noxaeapi-sdk

Typed Python SDK for NoxAeApi, a REST + WebSocket API plugin/mod for Minecraft servers — ships for both Fabric and Bukkit/Spigot/PaperMC. The REST surface is identical across platforms, so this SDK works against either without any platform-specific configuration.

Zero required runtime dependencies — uses only the Python standard library (urllib) for HTTP. The realtime socket needs one optional extra.

📖 Docs: noxapi.noxlydev.xyz

Install

pip install noxaeapi-sdk

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

Usage

from noxaeapi_sdk import NoxAeApiClient

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

players = client.players.list()
balance = client.economy.get_balance(players[0]["uuid"])
client.server.broadcast("Hello from the SDK!")

# Multi-currency (ExcellentEconomy), leaderboards, and network aggregator:
coins = client.economy.get_currency_balance("coins", players[0]["uuid"])
top = client.leaderboards.get_top("mcmmo-power", limit=10)
network = client.network.status_all()

From environment variables

# 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.
client = NoxAeApiClient.from_env()

Realtime (console tail / events)

Requires the ws extra (pip install "noxaeapi-sdk[ws]").

ws = client.connect(route="console")
ws.on("console", lambda line: print(line))
ws.on("close", lambda _: print("disconnected"))

The socket runs on a background thread and auto-reconnects with exponential backoff on unexpected disconnects.

Error handling

All non-2xx responses raise a subclass of NoxAeApiError:

  • NoxAeApiUnauthorizedError — 401, missing/invalid API key
  • NoxAeApiForbiddenError — 403, key valid but not permitted for this endpoint
  • NoxAeApiNotFoundError — 404
  • NoxAeApiRateLimitError — 429 (SDK auto-retries these by default; raised only once retries are exhausted)
  • NoxAeApiServerError — 5xx (also auto-retried by default)
  • NoxAeApiNetworkError — request never completed (timeout, DNS, connection refused)
from noxaeapi_sdk import NoxAeApiForbiddenError

try:
    client.server.restart()
except NoxAeApiForbiddenError:
    print("This API key isn't allowed to restart the server.")

Request encoding

The server is a Javalin app, and most endpoints read their body with ctx.formParam(...) — i.e. application/x-www-form-urlencoded — rather than JSON. The SDK follows the same split:

  • Form-urlencoded: everything in economy (including the economy.get_currency_balance/.pay_currency/etc ExcellentEconomy methods), players, server (except luckperms/noxauth), worlds, plugins, placeholders, and network.broadcast.
  • JSON: client.luckperms.* and client.noxauth.check_password only — these are read server-side with ctx.bodyAsClass(...).
  • N/A (GET only): client.leaderboards.* and most of client.network.* are read-only.

If you're extending the SDK, check which encoding the corresponding Javalin handler uses before wiring up a new method, and pass form=True to http.request(...) if it's form-urlencoded (this is also the more common case). Getting this wrong won't raise a type error — the request just silently sends the wrong content type and the server won't see the field.

Optional modules

Some modules only work depending on the target server's setup:

  • client.luckperms.* — requires the LuckPerms mod to be loaded on the server
  • client.noxauth.* — requires noxauth.enabled: true in the server's noxaeapi-config.yml
  • client.economy.get_currency_balance()/.pay_currency()/.debit_currency()/.set_currency_balance()/.get_currency_top()/.list_currencies() — requires ExcellentEconomy (raises a 424 error if it isn't installed)
  • client.network.* — requires network.enabled: true with at least one backend server configured in the server's config

Calling these against a server without the corresponding feature enabled will fail (typically 404).

NoxAeApi-Velocity network hub

If your network runs the NoxAeApi-Velocity proxy plugin, use NoxAeApiNetworkHubClient instead of (or alongside) NoxAeApiClient — point it at the hub's own REST port, not a backend server's port. Backend servers push register/heartbeat updates to the hub over WebSocket, so hub calls answer from its in-memory registry rather than fanning out live requests the way client.network.* above does — and the response shapes differ accordingly (e.g. players() is one flat proxy-wide list, not a per-backend breakdown, and there's no hub equivalent of network/health — see each node's health field in status_all()/status_by_id() instead).

from noxaeapi_sdk import NoxAeApiNetworkHubClient

hub = NoxAeApiNetworkHubClient(base_url="http://localhost:9090", api_key="your-hub-key")  # the hub's api-port, not a backend's port

status = hub.network.status_all()
players = hub.network.players()
found = hub.network.find_player(players["players"][0]["uuid"]) if players["players"] else None
hub.network.broadcast("Hello from the hub!")

# Reach a specific backend's own REST routes through the hub:
hub.network.forward("survival", "POST", "server/exec", body={"command": "say hi"}, form=True)

Or from environment variables (NOXAEAPI_HUB_BASE_URL / NOXAEAPI_HUB_KEY, kept separate from NoxAeApiClient.from_env()'s NOXAEAPI_* vars so a process can hold both clients at once):

hub = NoxAeApiNetworkHubClient.from_env()

Configuration

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": "..."},
)

License

MIT

Metadata

Release files for noxaeapi-sdk 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for noxaeapi-sdk 0.4.1
File Size Uploaded Provenance
noxaeapi_sdk-0.4.1.tar.gz 21.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for noxaeapi-sdk 0.4.1
File Interpreter ABI Platform
noxaeapi_sdk-0.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 54.0 kB

Release files / noxaeapi_sdk-0.4.1.tar.gz

Download URL noxaeapi_sdk-0.4.1.tar.gz
Size 21.8 kB
Tags Source
SHA-256 checksum
How to use checksums
980eb1082c0e5882592e666f87b4172056099fb228a2c3b5a1cdec10d4916937
BLAKE2b-256 checksum
How to use checksums
ba0666aa92deea43a0e89a0bdecb69f4d8d580786eec9a43ea438579af432ee2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Release files / noxaeapi_sdk-0.4.1-py3-none-any.whl

Download URL noxaeapi_sdk-0.4.1-py3-none-any.whl
Size 32.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
78b9adce3bb5a4efe85fbba940ed241a7506aabe6ccafde80344d903f82f350f
BLAKE2b-256 checksum
How to use checksums
9bba877732ae4423b380a70b0c85cf77aa5836372b2780817bab2682784dab0f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.13

Security for noxaeapi-sdk 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page