Skip to content

oxrpy

A Python wrapper for the Oxford Response private server API. Use it to read what's happening on your server and run commands on it from your own bot, website or tool.

pip install oxrpy

If you're writing async code, like a discord.py bot, install the async extra instead:

pip install "oxrpy[async]"

You'll need Python 3.10 or newer.

Upgrading from 1.x? Oxford is switching off the old endpoints (/v1/server/players, /v1/server/vehicles and so on) on 1 January 2027. Version 2 uses the new API, so it'll keep working after that. The data comes back in a different format, though, so check the changelog before you upgrade.

Getting started

You'll need your server's API key. The server owner can find it in Server Management > External > API Key, and the server needs the API package.

import os
from oxrpy import OxfordAPI

api = OxfordAPI(os.environ["OXFD_SERVER_KEY"])

# Grab a few sections in one request
data = api.get_server_data("Players", "Vehicles", "Robberies")
print(data["Server"]["Name"], "online:", data.online)

for player in data["Players"] or []:   # None if the server's offline
    print(player["Username"], player["Team"], player["Location"])

# Or just ask for one thing
players = api.get_players()
staff = api.get_staff()

# Run a command
result = api.run_command("announce Server restart in 5 minutes")
if result["Status"] == "Failed":
    print(result["Code"], result["Message"])

Keep your key private. Anyone who has it can run commands on your server, change its settings and ban people. Keep it on your own machine or bot, and never put it in website code that people can see.