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
- Sign in at valet.cordyx.xyz/app and add your server with its ER:LC server key.
- 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.
- Replace
https://api.erlc.ggwithhttps://valet.cordyx.xyz/apiand use the valet key. The oldrelay.cordyx.xyzaddress 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
| Method | Path | Permission |
|---|---|---|
| GET | /api/v1/server | server.read |
| GET | /api/v1/server/players | players.read |
| GET | /api/v1/server/staff | staff.read |
| GET | /api/v1/server/queue | queue.read |
| GET | /api/v1/server/vehicles | vehicles.read |
| GET | /api/v1/server/bans | bans.read |
| GET | /api/v1/server/joinlogs | logs.join |
| GET | /api/v1/server/killlogs | logs.kill |
| GET | /api/v1/server/commandlogs | logs.command |
| GET | /api/v1/server/modcalls | logs.modcalls |
| POST | /api/v1/server/command | the command's group |
| GET | /api/v2/server | server.read, plus one per field |
| POST | /api/v2/server/command | the 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.
| Field | Permission |
|---|---|
| Players | players.read |
| Staff | staff.read |
| Queue | queue.read |
| Vehicles | vehicles.read |
| JoinLogs | logs.join |
| KillLogs | logs.kill |
| CommandLogs | logs.command |
| ModCalls | logs.modcalls |
| EmergencyCalls | calls.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.
| Command | Set | Does |
|---|---|---|
| :h | Messages | Hint banner for everyone |
| :m | Messages | Message to everyone |
| :pm | Messages | Private message a player |
| :log | Messages | Write to the command log |
| :kick | Moderation | Kick a player |
| :ban | Moderation | Ban a player |
| :unban | Moderation | Lift a ban |
| :kill | Moderation | Kill a player |
| :jail | Moderation | Jail a player |
| :unjail | Moderation | Release from jail |
| :wanted | Moderation | Mark as wanted |
| :unwanted | Moderation | Clear wanted |
| :heal | Players | Heal a player |
| :refresh | Players | Refresh a player |
| :respawn | Players | Respawn a player |
| :load | Players | Reload a player |
| :tp | Players | Teleport one player to another |
| :prty | Server | Priority timer |
| :pt | Server | Peacetime |
| :weather | Server | Set the weather |
| :time | Server | Set the time |
| :startfire | Server | Start a fire |
| :stopfire | Server | Put out fires |
| :mod | Staff | Make a moderator |
| :unmod | Staff | Remove a moderator |
| :admin | Staff | Make an admin |
| :unadmin | Staff | Remove an admin |
| :helper | Staff | Make a helper |
| :unhelper | Staff | Remove a helper |
Limits
- Commands: one every 5 seconds per server, shared by all of that server's keys. That's ER:LC's own limit; Valet answers
429withretry_afterinstead of passing the request on. - Reads: identical requests within 5 seconds get the same answer. The
X-Valet-Cacheheader sayshit,sharedormiss. - 120 requests a minute per key.
- Activity logs are kept for 30 days.
Errors
Errors use ER:LC's shape, {"code": …, "message": "…"}. Codes from ER:LC pass through unchanged. Valet's own are in the 9000s.
| Code | Meaning |
|---|---|
| 9001 | No valet key was sent. |
| 9002 | That valet key doesn't exist or was revoked. |
| 9003 | This key isn't allowed to do that. |
| 9004 | That command isn't one Valet knows, so it's refused. |
| 9005 | This key can't be used from this IP address. |
| 9006 | ER:LC refused this server's key. The owner needs to add a new one on the dashboard. |
| 9007 | Valet doesn't proxy that endpoint. |
| 9008 | This 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"}'