Skip to content

API Keys

Personal API keys let your own scripts and AI tools configure the servers you manage, and work the ticket queue and alt tracking of the servers you moderate, through the Bernard API. A key can do only what you grant it: it is limited to the servers you choose and to the scopes you tick, and it never does more than you could do yourself on that server.

Creating a Key

  1. Sign in to the Bernard dashboard.
  2. Open Account, then Manage API keys.
  3. Give the key a name, pick the servers it may act on, and choose its scopes. The presets are a good start:
    • Read only: reads every setting, but changes nothing.
    • Configure: reads and changes settings, filters, roles, and OmniLogs routing.
    • Configure + enforcement: also changes who Bernard punishes or exempts (see Enforcement Settings).
    • Moderator: reads and works tickets, and reads and changes alt identities (see Moderators).
  4. Pick an expiry date. Keys last 90 days by default and at most one year.
  5. Copy the key. Bernard shows it once and stores only a hash of it, so it can't show it again.

You can pick servers where you are the owner or have Discord's Administrator permission, and servers you moderate (see Moderators). You can have up to 10 active keys.

Warning

Treat a key like a password. Anyone who has it can change your server's settings within its scopes. Keep it in a secret store or an environment variable, never in a URL, chat message, or code repository.

Using a Key

Send the key as a bearer token:

export BERNARD_API_KEY='brn_live_...'

curl --fail-with-body \
  --header "Authorization: Bearer ${BERNARD_API_KEY}" \
  https://api.getbernard.io/api/v1/api-key

GET /api/v1/api-key describes the key itself: its scopes, its expiry, and the servers it may act on, with their names. Start there.

The full reference, with every request and response, is at api.getbernard.io/api/docs. The machine-readable OpenAPI document is at https://api.getbernard.io/api/openapi.json. Each operation a key can use names its scope in x-bernard-scope.

Scopes

Scopes are independent: a write scope does not include the matching read scope.

Scope Lets a key
guild:config:read Read server settings, ticket settings, onboarding state, honeypot status, Premium status, and the server's channels and roles
guild:config:write Change server settings and ticket settings
guild:enforcement:write Make enforcement changes, together with guild:config:write or guild:filters:write
guild:filters:read Read AutoMod filters, categories, immunities, and channel scopes
guild:filters:write Change AutoMod filters, custom filters, patterns, immunities, and channel scopes
guild:roles:read Read role configuration and administrative capabilities
guild:roles:write Change role configuration and administrative capabilities
guild:events:read Read OmniLogs event routing
guild:events:write Change OmniLogs event routing
guild:analytics:read Read server analytics (Premium)
guild:members:read Search your server's members by name (see Discord Data)
guild:tickets:read Read the ticket queue and each ticket's full history, internal notes included
guild:tickets:write Assign tickets, change their status, add internal notes, and reply to the member who opened them
guild:alts:read Read alt identities, their accounts, links, and history (Premium)
guild:alts:write Create and change alt identities: aliases, accounts, confidence, and links (Premium)
guild:alts:admin Merge and delete alt identities (Premium)

A key can't reset a server's configuration, read rapsheets, invites, or deletion history, ban members, or manage billing. Those stay on the dashboard and in Discord.

Premium settings and alt tracking still need Premium. A key can't unlock them.

Enforcement Settings

Enforcement changes are changes that make Bernard punish more members or exempt fewer. A key needs guild:enforcement:write for them, on top of guild:config:write for settings or guild:filters:write for filters:

  • Settings: the honeypot rules and channel, minimum account age gatekeeping, ghost ping punishments, immunity and mention threshold, peer moderation, the silence role, the minimum arena ban, the maximum vote-mute, and the server's immune users and roles.
  • Filters: making a filter or category enforce, resetting a category's status, raising a filter's score, changing an enforcing custom filter's patterns, removing immunities, and changing a category's channel scope.

Without it, a key can still turn filters off, lower scores, add filter immunities, and change every other setting.

Discord Data

Keys read channels, roles, and members from Bernard's stored copy instead of from Discord:

  • New channels and roles can take up to five minutes to show.
  • Member search finds only members Bernard has seen active, meaning they joined, sent a message, used voice, or changed their profile since October 2026.
  • Keys can't list invites, look up members by ID, check which commands a role can see, or turn OmniLogs' separate message-event threads on or off.

Moderators

You don't need to be an administrator to use the ticket and alt scopes. If Bernard is in a server you belong to, the API keys page lists it under Servers you moderate. A key for such a server takes only ticket and alt scopes, and each works only while your roles hold the Bernard capability the matching /tickets or /alt command needs:

Scopes Capability
guild:tickets:read, guild:tickets:write MANAGE_TICKETS
guild:alts:read VIEW_OTHER_RAPSHEET
guild:alts:write EDIT_RAPSHEET_ENTRIES
guild:alts:admin ADMINISTRATOR

The server's owner, its Discord administrators, and roles with Bernard's ADMINISTRATOR capability can use them all. A key acts as you: replies, notes, and alt changes are recorded under your name, and ticket replies sent with a key are marked "Sent with the Bernard API" in the ticket's thread. A reply reaches the member by DM when they aren't in the thread, just as one from the dashboard does.

Warning

Tickets hold members' messages and reports, and alt identities link accounts to people. When an AI tool reads them with your key, that text goes to the tool's provider. Only connect tools you trust with your members' data.

Give an AI tool that reads tickets a key with only ticket and alt scopes, such as the Moderator preset, so instructions written into a ticket can't change your server's settings.

Limits and Errors

Your keys share 120 requests a minute. Past that, the API answers 429 with a Retry-After header giving the seconds to wait.

Errors come back as JSON with a detail field that says what went wrong:

Status Meaning
401 The key is missing, mistyped, revoked, or expired.
403 The key lacks a scope or server, or you no longer have the access that scope needs on that server. detail says which.
404 The server or item doesn't exist, or Bernard isn't in that server.
422 The request didn't validate. detail lists the problems.
429 Your keys are over their shared rate limit, or too many invalid keys came from your IP address.
503 Discord couldn't confirm your access just now. Try again shortly.

Losing Access

While a key is in use, Bernard checks with Discord that you still have the access each scope needs: every minute, or every few minutes for scopes that only read and need owner or administrator. If you lose it, the key stops working for those scopes on that server straight away. Getting the access back makes them work again.

If you leave the server, the key's access to it is removed for good, so create a new key if you rejoin.

Rotating and Revoking Keys

To replace a key without downtime, create a new key, switch your script or tool to it, check it works, then revoke the old one on the API keys page. Revoking takes effect immediately.

Each key shows when it was last used, which helps you spot keys you no longer need.