Authentication and scopes

rbt_ API keys, rbb_ bridge tokens, scopes, common formats, pagination, idempotency and rate-limit headers.

On this page The platform's secrets Sending the key Scopes Bridge tokens Common conventions PaginationWrites and the action queueIdempotency Rate limits and quotas

The platform's secrets

Secret Format Gives access to Where to get it
API key rbt_… The server's REST API, within its scopes Developers page → API keys
Bridge token rbb_… One bridge only (/bridge API), nothing else Developers page → Bridges (shown once)
Webhook secret whsec_… or your own (16 to 128 ASCII characters) Nothing: used to verify delivery signatures Developers page → Webhooks (shown once)

Robert only keeps a SHA-256 fingerprint of keys and tokens, compared in constant time: nobody, including the Robert team, can give them back to you. Lost or compromised? Revoke the key, or regenerate the token or secret: the old one stops working immediately.

Only the server owner and managers can create keys, bridges and webhooks. If a key's owner loses access to the server, the key stops working (no_access).

Sending the key

The whole REST API lives under https://robert-bot.com/api/v1/public-api/guilds/{guild_id}. Send the key in the Authorization header; no cookie, no CSRF token.

curl -H "Authorization: Bearer rbt_YOUR_KEY" \
  "https://robert-bot.com/api/v1/public-api/guilds/987654321098765432/roles"

On every request Robert checks the following, in this order, and stops at the first failure:

# Check Response on failure
1 The header is present and the key is valid 401 api_key_required / bad_api_key
2 The key is not revoked 401 revoked_api_key
3 The account is not suspended 403 banned
4 The key is not restricted to another server 403 key_guild_mismatch
5 The key's owner still has access to the server 403 no_access
6 The server has a Premium plan or higher 402 plan_required
7 The daily quota is not exceeded 429 quota_exceeded
8 The key has the route's scope 403 missing_scope

Scopes

Each key gets, at creation, only the scopes it needs. Give the minimum: a leaderboard widget key only needs members.read.

Scope Gives access to
guild.read Server information, channels, roles, statistics
members.read A member's profile (level, XP, balance, active warnings), leaderboards, linked accounts
members.write Give or remove a role, add or remove XP and currency
messages.write Send and edit messages and embeds
moderation.read Read the sanctions record
moderation.write Warn, timeout, kick, ban
giveaways.read Read giveaways
giveaways.write Start a giveaway
events.read Event stream (long-polling and SSE)
bridges Manage the server's bridges and outgoing webhooks

A key created before scopes existed keeps guild.read, members.read, moderation.read and giveaways.read. Without the right scope, the response is:

{
  "error": "missing_scope",
  "message": "This API key does not have the “messages.write” scope.",
  "details": { "required": "messages.write" }
}

Bridge tokens

A bridge has its own token rbb_…, limited to that bridge. It is the one you paste into the Minecraft plugin or your bridge client configuration. It is sent the same way, to the /bridge API:

curl -H "Authorization: Bearer rbb_YOUR_TOKEN" "https://robert-bot.com/api/v1/bridge"

See Bridges for the full protocol.

Common conventions

  • Format: UTF-8 JSON. A request body is sent with Content-Type: application/json.
  • Discord IDs: always strings ("987654321098765432"), never numbers: they exceed the precision of numbers in many languages.
  • Timestamps: Unix seconds (1791370000).
  • Error message language: from the Accept-Language header (fr or en). Always test the error field, which never changes.
  • Writes through the bot: they go through the bot's action queue (see below).

Pagination

Lists look like {"items": […], "next_cursor": "…"}. Pass ?limit= (100 at most) and, for the next page, ?cursor= with the next_cursor value. When next_cursor is null, you have read everything. A cursor is opaque: do not build one yourself.

curl -s -H "Authorization: Bearer $ROBERT_KEY" "$API/roles?limit=50"
# → { "items": [ … 50 roles … ], "next_cursor": "djE6NTA" }
curl -s -H "Authorization: Bearer $ROBERT_KEY" "$API/roles?limit=50&cursor=djE6NTA"

Writes and the action queue

A write that touches Discord (role, XP, currency, message, sanction) is handed to the bot:

Call Response
without wait 202 {"action_id": "…", "status": "pending"}: the order is queued
with ?wait=true 200 {"action_id": "…", "status": "done", "result": {…}} as soon as the bot is done (10 seconds at most). If the bot is slower: 202 pending
the bot fails 502 action_failed, with details in details.result

To follow a pending action: GET /actions/{action_id} (visible only to the key that created it).

curl -s -H "Authorization: Bearer $ROBERT_KEY" "$API/actions/3f9c2a7e51b04d18a2c4e6f801d3b5a7"
{ "action_id": "3f9c2a7e51b04d18a2c4e6f801d3b5a7", "kind": "send_message", "status": "done",
  "created_at": 1791370000, "done_at": 1791370001, "result": { "message_id": "900000000000000123" } }

Idempotency

Add the Idempotency-Key header (100 visible ASCII characters at most) to writes: the same key with the same request, for 24 hours, returns the first response without redoing anything. Essential to retry safely after a network cut.

Situation Response
Same key, same request The original response
Same key, different request 422 idempotency_key_reused
Same key, first request still running 409 idempotency_in_progress: retry in a moment

Rate limits and quotas

Every response carries three headers:

Header Content
X-RateLimit-Limit The key's daily quota
X-RateLimit-Remaining Requests left today
X-RateLimit-Reset The Unix timestamp of the next reset (midnight UTC)

Beyond that, the API answers 429 with a Retry-After header (in seconds): quota_exceeded for the daily quota, rate_limited for the per-minute limit. Wait the indicated delay then try again. Each plan's quotas are in API quotas by plan.

Cache

A leaderboard or statistics do not need to be reloaded on every visit: keep the response for a few minutes on your side and your quota will last all day. To follow what changes, prefer events or a webhook over a polling loop.