REST API
The REST API lets other programs (a game server, a website, scripts) do what moderators do in Discord. An action taken through the API goes through exactly the same path as a slash command: it gets a case number, is carried out in Discord, mirrored by the sync rules, posted in mod-logs, and sent to webhooks.
The full, always-current reference is built into the bot:
/api/docs: a readable reference page./api/v1/openapi.yaml: the same in OpenAPI 3.1 format, for Postman, Insomnia or code generators.
The api module must be switched on (it is by default on Coolify).
API keys
Every request needs a key:
Authorization: Bearer rbk_3f9a1c2e7b4d_…
A key is shown once when it's created. The bot stores only a hash of it, so even someone with a copy of the database can't use it. You can create keys in three ways:
| Where | How |
|---|---|
| Discord (server administrators) | /apikey create name:game server scopes:cases:read,cases:write. The reply is visible only to you. |
The API itself (needs a key with the keys scope) |
POST /api/v1/api-keys |
| Command line, for setups without Discord | revengebot -create-api-key "game server" -scopes cases:read,cases:write. On Coolify, run it in the app's Terminal tab: /revengebot -create-api-key …. The key works in this install's network; add -network second to make it for another network the bot already serves. |
/apikey list shows keys and when each was last used. /apikey revoke id:… stops one working immediately.
Scopes
Give each key only what it needs:
| Scope | Allows |
|---|---|
cases:read |
Listing and reading cases |
cases:write |
Taking actions, changing reasons, removing notes, linking and unlinking accounts |
people:read |
Searching people, reading their full record (including the servers they've been in), and member lists |
network:read |
Reading sync rules, servers, blocked emojis, features and the main server |
network:write |
Changing them |
webhooks |
Managing webhooks |
keys |
Managing API keys. This is powerful, so give it sparingly. |
automod:read |
Reading auto-mod rules, hits and settings, and trying messages against the rules |
automod:write |
Changing rules and settings, and releasing the safety brake |
messages:read |
Reading the message log (/api/v1/messages), saved attachments (/api/v1/media/{id}) and the messages on a person's timeline (GET /api/v1/people/{identity}/timeline) |
events:read |
The events feed (GET /api/v1/events) |
stats:read |
Counts over time (GET /api/v1/stats/series) |
messages:write |
Adding messages to timelines and taking them off (POST and DELETE /api/v1/people/{identity}/timeline), and keeping message-log posts (PUT /api/v1/messages/{id}/keep) |
Each key may make 120 requests a minute. Going over returns 429 with a Retry-After header.
Examples
Ban someone for 7 days, carried out in one server and then mirrored:
curl -X POST https://bot.example.com/api/v1/cases \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"type":"ban","target":"discord:123456789012345678","reason":"Cheating in-game","duration":"7d","guild_id":"1234567890"}'
A person's full record:
curl https://bot.example.com/api/v1/people/discord:123456789012345678 -H "Authorization: Bearer $KEY"
Every active ban, newest first:
curl "https://bot.example.com/api/v1/cases?type=ban&status=active" -H "Authorization: Bearer $KEY"
Active bans matching a search. q looks at the person (any name or alias they've used, or their account ID), the case number, the reason and the moderator's name. server and moderator narrow it further:
curl "https://bot.example.com/api/v1/cases?type=ban&status=active&q=raider&server=1234567890" -H "Authorization: Bearer $KEY"
Every case from November 2026 (dates are UTC, and until includes its whole day; exact times like 2026-11-21T18:30:00Z work too):
curl "https://bot.example.com/api/v1/cases?since=2026-11-01&until=2026-11-30" -H "Authorization: Bearer $KEY"
Everyone who left a server (only servers with the member list switched on):
curl "https://bot.example.com/api/v1/members?server=1234567890&status=left" -H "Authorization: Bearer $KEY"
People are identified by account, written kind:value, for example discord:123456789012345678. Game accounts (game:…) will be linked to the same person when the game integration arrives.
Check every server for problems, and see servers waiting to be confirmed (the panel's Network status):
curl https://bot.example.com/api/v1/network/status -H "Authorization: Bearer $KEY"
Stop posting first appearances anywhere except one server, which posts them in its own channel (they're still recorded):
curl -X PUT https://bot.example.com/api/v1/network/posts/firstseen -H "Authorization: Bearer $KEY" \
-H "Content-Type: application/json" \
-d '{"default": "off", "servers": {"1234567890": {"mode": "channel", "channel_id": "2345678901"}}}'
Errors
Every error has the same shape:
{"error": {"code": "already_active", "message": "This person already has an active ban (case #12)"}}
| Status | code |
Meaning |
|---|---|---|
| 400 | invalid |
The request is wrong; message says how. Unknown JSON fields are refused, to catch typos. |
| 401 | unauthorized |
No key, a wrong key, or a revoked key |
| 403 | forbidden |
The key lacks the scope this endpoint needs |
| 403 | not_in_plan |
The feature isn't in the network's plan, or one of its quotas is full, such as creating a second API key on Free |
| 403 | network_suspended |
The bot's operators have suspended the network: its keys can still read (GET), but not change anything |
| 404 | not_found |
No such case, person or server |
| 409 | already_active |
For example, banning someone who is already banned |
| 409 | feature_off |
The feature this endpoint belongs to is switched off (Settings → Features) |
| 429 | rate_limited |
Over 120 requests a minute |
| 500 | internal |
A bug. The details are in the bot's log. |
Auto-mod
With the automod module, /api/v1/automod/rules lists and adds rules, and /api/v1/automod/rules/{id} reads, replaces and deletes one. GET /api/v1/automod/hits lists what was caught (filter by server, person and rule), POST /api/v1/automod/test tries a message against every rule without acting on anyone, GET/PUT /api/v1/automod/settings reads and changes the honeypot action and safety brake, and POST /api/v1/automod/resume releases the brake. A server's honeypot channel is set with the server update endpoint (honeypot_channel_id). Durations are text, such as "1h" or "7d".
{"name": "Scams", "kind": "words", "words": ["free nitro", "airdrop*"],
"steps": [{"count": 1, "delete": true}, {"count": 2, "delete": true, "action": "timeout", "duration": "1h"}]}
The message log
With the messagelog module, GET /api/v1/messages lists edited and deleted messages, and GET /api/v1/media/{id} returns the bot's copy of a file while it lasts (48 hours). A deleted message has deleted_by (the moderator, or system for the bot) or deleted_by_author: true; neither means the bot couldn't read Discord's audit log (who deleted a message). A server's message-log settings are changed with PATCH /api/v1/servers/{id} (network:write):
{"messagelog_channel_id": "2345678901", "messagelog_staff_post": false, "messagelog_keep_others": false, "messagelog_delete_days": 30}
Setting the channel, or changing messagelog_staff_post, locks the channel to match. messagelog_delete_days (0–365; 0 keeps every post) has the bot delete its own posts once they're that old, and unlike the panel it doesn't ask first. PUT /api/v1/messages/{id}/keep with {"keep": true} keeps a message's posts, and POST /api/v1/people/{identity}/timeline with {"messages": ["<message ID>", …]} (up to 100) puts messages on their authors' timelines (both messages:write). See The message log.
Log-post layouts
How each kind of log post looks (log-post layouts) can be read with network:read and changed with network:write:
curl -H "Authorization: Bearer $KEY" https://bot.example.com/api/v1/network/log-posts
curl -X PUT -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{"color": "#D9433B", "description": "{User} · {Reason}", "hide": ["User", "Reason", "Server"], "rename": {"DM to user": "Told"}}' \
https://bot.example.com/api/v1/network/log-posts/case
PUT replaces the kind's whole layout; DELETE (or an empty object) goes back to the bot's own. Each kind lists the details it can show in fields. The kinds are listed in /api/v1/openapi.yaml.
Webhooks
A webhook makes the bot call your system whenever something happens. Add one with POST /api/v1/webhooks:
{"url": "https://game.example.com/hooks/moderation", "events": ["case.created", "case.lifted"]}
An empty events list means every event. The body always has id, seq, event, at and actor, plus:
| Event | When | Body also has |
|---|---|---|
case.created, case.updated, case.lifted, case.expired, case.note_removed |
A case is made, its reason changes, it's lifted, it runs out, or a note leaves Staff notes | case |
member.first_seen |
Someone joins a server of the network for the first time | member, other_servers |
member.rejoined, member.left |
Someone comes back or leaves | member, visit, and linked_sanctions (sanctions in force on their linked accounts) |
member.renamed |
Someone uses a name the bot hasn't seen them use before | rename |
person.linked, person.unlinked |
Staff link or unlink an account | link |
message.edited, message.deleted |
A logged message is edited or deleted | message (its text and file details, not the files) |
automod.hit |
A rule, a honeypot or Discord's AutoMod catches a message (a sanction is also sent as case.created) |
hit |
automod.paused, automod.resumed |
The safety brake pauses auto-mod, or staff resume it | network_id |
server.joined, server.removed |
A server joins the network (created with it, or confirmed by an admin), or leaves it (an admin takes it out, it moves to another network, or the network is deleted) | server, network_id |
The response contains a secret, shown only once.
Each delivery is a POST with a JSON body:
{"id": "default:1287", "seq": 1287, "event": "case.created", "at": "2026-11-21T19:01:52Z", "case": { … }, "actor": { … }}
and these headers:
X-Webhook-ID: default:1287
X-Webhook-Event: case.created
X-Webhook-Signature: sha256=<hex>
The signature is the HMAC-SHA256 of the raw body, keyed with the webhook's secret. Always check it before acting on a request, so nobody else can send you fake bans. In Go:
mac := hmac.New(sha256.New, []byte(secret))
mac.Write(body)
ok := hmac.Equal([]byte(r.Header.Get("X-Webhook-Signature")), []byte("sha256="+hex.EncodeToString(mac.Sum(nil))))
Answer 2xx once you have the event. Deliveries are saved before they're sent, so a restart doesn't lose them. If your system doesn't answer, times out (10 seconds) or answers 5xx or 429, the bot tries again on a growing schedule for about two days (5 s, 30 s, 2 min, 10 min, 30 min, then 1 to 24 hours). Any other 4xx gives up at once. So the same event can arrive more than once: skip an id you've already handled. Retries can also arrive after newer events; seq gives the order. GET /api/v1/webhooks shows each webhook's last status, and GET /api/v1/webhooks/{id}/deliveries its recent deliveries.
The events feed
GET /api/v1/events?after=<seq> returns the same events, in order, for the last 30 days: each has id, seq, type, at and data (the webhook body). Read on from next; missed is true if after is older than what's kept. Use it to catch up after your system was down. The REMP integration spec describes using webhooks and the feed together.
Retrying safely
Send an Idempotency-Key header (any unique string up to 255 characters) with POST /api/v1/cases. Retrying with the same key within 24 hours returns the first answer, with Idempotent-Replayed: true, instead of acting twice. The same key with a different request is refused (422), and one still running gets 409 in_progress.
References to your own records
external_ref holds your system's ID for a case or a person (up to 200 characters, for example remp:8812). Send it with POST /api/v1/cases, set it with PATCH /api/v1/cases/{number} or PUT /api/v1/people/{identity}/external-ref, and look things up with ?external_ref= on GET /api/v1/cases and GET /api/v1/people.
About this install
GET /api/v1/instance (network:read) gives the bot's version, API and schema version, network, mode (standalone), the features switched on, the event types it sends, and whether its servers are healthy. It also gives the bot's name (from its theme), the network's plan, entitlements: every plan-limited feature, with included saying whether the network has it, and limits: the plan's quotas (networks_per_person, servers_per_network, message_days, file_hours, storage_mb, api_keys, webhooks; 0 means no limit).
Stats and metrics
GET /api/v1/stats/series (stats:read) counts what happened over time, the same numbers the dashboard's charts show:
GET /api/v1/stats/series?measure=sanctions&group_by=type&days=30&bucket=day&tz=Europe/London
| Parameter | Values |
|---|---|
measure |
sanctions (bans, softbans, kicks, timeouts, mutes, warnings), cases (every case), active_sanctions (bans, mutes and timeouts in force at the end of each step), automod_hits, members (first appearances, rejoins, departures), first_seen, message_deletions, member_count (people in the servers at the end of each step, each counted once: linked accounts are one person, and in the total someone in several servers counts once) |
group_by |
empty (one total), type, source, server, moderator, rule (auto-mod) or kind (members) — each measure allows the ones that make sense |
days, or from and to |
how far back (default 30 days); from/to take a date or an RFC 3339 time |
bucket |
hour, day (default), week (starting Monday) or month; at most 400 steps |
tz |
an IANA time zone for where days start (default UTC) |
server |
one server ID, or several separated by commas |
The answer has buckets (the start of each step) and series, each with label, values (one per bucket) and total. At most 8 series are returned; the rest are added up as "Other". For active_sanctions and member_count, level is true and total is the number now.
Prometheus /metrics
Set REVENGEBOT_METRICS_TOKEN to a long random string, and /metrics serves Prometheus's text format, for Grafana (through Prometheus, or anything that scrapes it). Scrapers send the token as Authorization: Bearer <token>; without the token set, /metrics is off. The numbers are read from the database, at most every 15 seconds, so they're right after a restart and the same from every copy of the bot:
| Metric | Labels | What |
|---|---|---|
revengebot_cases_total |
network, type, source |
Cases made |
revengebot_active_sanctions |
network, type |
Bans, mutes and timeouts in force |
revengebot_cases_mirror_failed_total |
network |
Cases that failed to mirror somewhere |
revengebot_automod_hits_total |
network, source |
Auto-mod hits kept (180 days, or for good with a case) |
revengebot_member_events_total |
network, type |
First appearances, rejoins and departures |
revengebot_members |
network, server |
Members in each server now |
revengebot_webhook_deliveries |
network, state |
Webhook deliveries pending, delivered or failed (finished ones kept 7 days) |
revengebot_servers |
network |
Servers the bot is in (network="": waiting to be confirmed) |
revengebot_automod_paused |
network |
1 while the safety brake has paused auto-mod |
revengebot_networks |
state |
Networks on the install (state="": active; else suspended or deleting) |
revengebot_people |
network |
People the bot keeps a record of |
revengebot_saved_messages |
network |
Messages the message log keeps a copy of |
revengebot_audit_entries |
network |
Audit log entries |
revengebot_storage_bytes |
network |
Bytes of message-log pictures and videos saved |
revengebot_discord_connected |
1 when connected to Discord | |
revengebot_info |
version |
Always 1 |
A Prometheus scrape job:
scrape_configs:
- job_name: revengebot
scheme: https
authorization: {credentials: "<the token>"}
static_configs: [{targets: ["bot.example.com"]}]
Making the API reachable
The API is served by the bot's built-in web server on port 8080, alongside /healthz. To call it from outside, give the app a domain. On Coolify:
- Create a DNS record, such as
bot.example.com, pointing at the server. - In the app's settings, set the bot service's Domain to
https://bot.example.com:8080. The:8080tells Coolify which port inside the container to route to; visitors use the normal HTTPS port. Coolify handles the certificate. - Redeploy, then open
https://bot.example.com/api/docs.