Private servers

Server API

Run commands and read players and logs for your own private server from a Discord bot or a website.

Get a key

  1. Buy the Server API pack for your private server (Settings → Upgrade Packs).
  2. Open the private server settings, scroll to Server API Pack and press Generate key.
  3. Copy the key straight away. It is shown once, only a fingerprint of it is stored, and regenerating it switches the old key off immediately.

Keep the key private, like a password. Anyone who has it can run commands on your server.

Using the API

Base URL: https://westbrookcounty.co.uk/api/v1
Send your key in a header called server-key. Responses are JSON.

RequestWhat it does
GET /serverName, owner, co-owners, player count, join code and team balance.
GET /server/playersEveryone in the server with their team and permission.
GET /server/logsRecent joins, leaves, team changes and API commands. Add ?type=join,command, ?limit=50 or ?before=ID.
GET /server/joinlogsJoins and leaves only.
GET /server/commandlogsCommands sent through the API and what happened.
GET /server/teamlogsTeam changes only.
POST /server/commandSend a command. Body: {"command": ":h Hello everyone"}
curl https://westbrookcounty.co.uk/api/v1/server/players \
  -H "server-key: YOUR_KEY"

curl -X POST https://westbrookcounty.co.uk/api/v1/server/command \
  -H "server-key: YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command": ":h Welcome to the server!"}'

A successful command replies {"message":"Success"}. That means it was sent; the game runs it within a few seconds and records the result in /server/commandlogs.

Commands

CommandEffect
:h <message>Show a message to everyone (also :m, :message, :announce). Filtered by Roblox.
:pm <player> <message>Private message to one player.
:kick <player> [reason]Remove a player. The owner and co-owners can't be kicked.
:heal <player>Restore a player's health.
:time <cycle|dawn|day|dusk|night>Set the time of day.
:weather <clear|cloudy|rain|storm|fog|dynamic>Set the weather.
:peacetime <off|normal|strict>Peacetime mode.
:priority <0-3>How many priorities may run at once (0 turns them off).
:set <setting> <value>peacetime, priorityMax, priorityCooldown, wantedDecay, civilianWeapons, timeOfDay, weather, streetLamps, fuelMultiplier, damageMultiplier, nameTags.
:helpLists these in the command log.

Player names can be a username, a display name, the start of either, or a user id.

Good to know

  • The server has to be running. If it hasn't reported for about 15 minutes the API answers 422 (offline).
  • Player and log data comes from the server's last report: about every 15 seconds while you are using the API, otherwise every minute or so.
  • Limits: 20 requests per 10 seconds and 10 commands per minute per key. Too many gives 429 with a Retry-After header.
  • Errors look like {"code": 2002, "message": "Invalid server-key."}.
  • Never put the key in a website's front-end code. Call the API from a bot or a back-end only.