Automate your Discord firewall with the RestoreCord API

Your moderators already live in Discord and your own tools. The firewall API lets those tools add rules, read the activity log and hand out timed bypasses without anyone opening a dashboard.

Short answer

Create a RestoreCord API key with only the SERVER_FIREWALL permission, send it as a Bearer token from server-side code, and call the endpoints under /api/v3/servers/{serverId}/ to manage rules, passwords, bypasses, logs and ban imports.

Why drive the firewall from code

During a raid, every click between "we see the pattern" and "the pattern is blocked" costs you. Teams that run their own moderation bot can wire a staff-only slash command straight to the firewall, so the moderator who spots the problem fixes it in the same window. Others pull the activity log into their own dashboards or alerting.

Create a key that can only touch the firewall

  1. Create a new API key in the RestoreCord dashboard and give it a name that identifies the job, such as mod-bot-firewall.
  2. Grant only SERVER_FIREWALL. It covers rules, passwords, bypasses, logs and ban imports, and nothing else.
  3. Choose the shortest useful expiration and add an IP allowlist if your bot runs on fixed infrastructure.
  4. Copy the full key once and put it in your secret store. Rotate it if it ever shows up in a log, screenshot or repository.

API keys belong in server-side code only. Never ship one inside a browser bundle, a public client or a Discord message.

The endpoints you will use

All paths start from https://restorecord.com/api/v3. Note that serverId is RestoreCord's internal server ID, not your Discord guild ID.

PathWhat it does
/servers/{serverId}/firewall/logsList activity, filtered by user ID or action. Also clears the log.
/servers/{serverId}/firewall/rulesList, create and toggle rules. Single rules can be read, updated or deleted by ID.
/servers/{serverId}/firewall/passwordsManage verification passwords with labels, max uses and expiry.
/servers/{serverId}/bypassList, grant and remove temporary access for a Discord user.
/servers/{serverId}/firewall/import-bansPreview and import your Discord banlist into the blacklist.

Example: an emergency block from a slash command

When a moderator runs your bot's lockout command with an ASN from the log, the bot sends one request:

Block a hosting networkbash
curl -X POST "https://restorecord.com/api/v3/servers/$SERVER_ID/firewall/rules" \
  -H "Authorization: Bearer $RC_KEY_ID.$RC_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Raid lockout (mod command)",
    "targetType": "ASN",
    "operator": "IS",
    "targetValue": "AS64500",
    "actions": [{ "type": "BLOCK" }]
  }'

Exactly one decision goes in actions, and a block can't be paired with GIVE_ROLE. The full field list is in the firewall rules guide.

Example: a timed pass for a travelling moderator

Grant 24 hours of accessbash
curl -X POST "https://restorecord.com/api/v3/servers/$SERVER_ID/bypass" \
  -H "Authorization: Bearer $RC_KEY_ID.$RC_SECRET" \
  -H "Content-Type: application/json" \
  -d '{ "userId": "402917736118", "duration": "24h" }'

Durations are fixed to 15m, 1h, 6h, 24h and 7d, the same windows staff see in the dashboard, so a pass granted by the bot still runs out on its own.

Guardrails worth keeping

The API follows your plan exactly like the dashboard does: server-membership rules need Business or higher, and ban imports need a paid plan plus a bot with the Ban Members permission. Restrict your slash commands to staff roles, log who ran them, and test any new automated rule against a staff account first. Prefer a hands-on approach? Start from the VPN blocking guide or the Shield overview.

From zero to a scripted firewall

  1. Create a scoped key

    In the RestoreCord dashboard, create an API key with only the SERVER_FIREWALL permission, a short expiry and an IP allowlist.

  2. Store it server-side

    Keep the key in your bot or backend's secret store and send it as a Bearer token.

  3. Call the firewall endpoints

    Create rules, read logs and grant bypasses under /api/v3/servers/{serverId}/, then test with a staff account.

Firewall API reference

Before your bot goes live

A short review that keeps automation from becoming a new way in.

Key scoped to SERVER_FIREWALL only

No backup, pull or member permissions on a moderation key.

Expiry and IP allowlist set

A leaked key is worth far less when it only works from your host.

Commands limited to staff roles

Members should never be able to reach a command that edits the firewall.

Every call logged on your side

Pair RestoreCord's activity log with your bot's own record of who did what.

Firewall API questions

Give your mod bot a firewall

Create a scoped key in RestoreCord and turn raid response into a single slash command.