cordyxValetSign inGet started

Valet docs

Valet speaks ER:LC's API. If your bot works with ER:LC today, it works with Valet after you change the base URL and the key.

Getting started

  1. Sign in at valet.cordyx.xyz/app and add your server with its ER:LC server key.
  2. Make a key for each bot or developer and tick what it may do. Copy it straight away: Valet stores only a hash and can't show it again.
  3. Replace https://api.erlc.gg with https://valet.cordyx.xyz/api and use the valet key. The old relay.cordyx.xyz address keeps working for the API.

To run commands, ER:LC also needs you to authorize Valet on your server once. The dashboard shows the link after you add a server.

Sending the key

Either header works. Use whichever needs fewer changes in your code.

Server-Key: vk_…
Authorization: Bearer vk_…

Valet keys start with vk_ and are 43 characters long. Keys made before the rename start with cxr_ and still work. Don't use them in browser code: anyone who opens the page can read them. Valet sends no CORS headers for that reason.

Endpoints

MethodPathPermission
GET/api/v1/serverserver.read
GET/api/v1/server/playersplayers.read
GET/api/v1/server/staffstaff.read
GET/api/v1/server/queuequeue.read
GET/api/v1/server/vehiclesvehicles.read
GET/api/v1/server/bansbans.read
GET/api/v1/server/joinlogslogs.join
GET/api/v1/server/killlogslogs.kill
GET/api/v1/server/commandlogslogs.command
GET/api/v1/server/modcallslogs.modcalls
POST/api/v1/server/commandthe command's group
GET/api/v2/serverserver.read, plus one per field
POST/api/v2/server/commandthe command's group

Anything else answers 404 with code 9007.

v2 fields

On GET /api/v2/server, each field you set to true needs its own permission. A field Valet doesn't know is refused, not ignored.

FieldPermission
Playersplayers.read
Staffstaff.read
Queuequeue.read
Vehiclesvehicles.read
JoinLogslogs.join
KillLogslogs.kill
CommandLogslogs.command
ModCallslogs.modcalls
EmergencyCallscalls.emergency

Commands

Valet reads the first word of the command and checks it against the key. Every command is its own permission. A command not listed here is refused for all keys. :bring and :to aren't listed because ER:LC can't run them remotely: they need someone in game to run them.

CommandSetDoes
:hMessagesHint banner for everyone
:mMessagesMessage to everyone
:pmMessagesPrivate message a player
:logMessagesWrite to the command log
:kickModerationKick a player
:banModerationBan a player
:unbanModerationLift a ban
:killModerationKill a player
:jailModerationJail a player
:unjailModerationRelease from jail
:wantedModerationMark as wanted
:unwantedModerationClear wanted
:healPlayersHeal a player
:refreshPlayersRefresh a player
:respawnPlayersRespawn a player
:loadPlayersReload a player
:tpPlayersTeleport one player to another
:prtyServerPriority timer
:ptServerPeacetime
:weatherServerSet the weather
:timeServerSet the time
:startfireServerStart a fire
:stopfireServerPut out fires
:modStaffMake a moderator
:unmodStaffRemove a moderator
:adminStaffMake an admin
:unadminStaffRemove an admin
:helperStaffMake a helper
:unhelperStaffRemove a helper

Limits

Errors

Errors use ER:LC's shape, {"code": …, "message": "…"}. Codes from ER:LC pass through unchanged. Valet's own are in the 9000s.

CodeMeaning
9001No valet key was sent.
9002That valet key doesn't exist or was revoked.
9003This key isn't allowed to do that.
9004That command isn't one Valet knows, so it's refused.
9005This key can't be used from this IP address.
9006ER:LC refused this server's key. The owner needs to add a new one on the dashboard.
9007Valet doesn't proxy that endpoint.
9008This key has expired.

Examples

Python

import os, requests

r = requests.get(
    "https://valet.cordyx.xyz/api/v2/server",
    params={"Players": "true", "Queue": "true"},
    headers={"Server-Key": os.environ["VALET_KEY"]},
)
print(r.json()["Players"])

curl

curl -X POST https://valet.cordyx.xyz/api/v1/server/command \
  -H "Authorization: Bearer $VALET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command": ":h Server restart in 10 minutes"}'