REST API v1 · Developers

Errors and error codes

Errors always come back as JSON with a stable machine-readable error code and a human-readable message. Branch on error and the HTTP status — messages are for people and may change.

Developer docs
On this page

Error format

Every error response has the same shape: { "error": CODE, "message": "…" }. Some codes add fields that help you react — for example issues (what was invalid), required (the missing scope), balance, feature or retryAfter.

Response · 400
HTTP/1.1 400 Bad Request

{
  "error": "INVALID_REQUEST",
  "message": "Invalid body",
  "issues": [{ "path": "body.amount", "message": "Number must be greater than or equal to 1" }]
}
Response · 409
HTTP/1.1 409 Conflict

{ "error": "INSUFFICIENT_FUNDS", "message": "The member does not have enough to remove this amount", "balance": 40 }

In issues, each path starts with the part of the request it refers to: params., query., body. or header..

All error codes

Each endpoint in the API reference lists the codes it can return. The full list:

Error codes
HTTPCodeDescription
400INVALID_REQUESTInvalid IDs, query parameters, headers or body; issues lists what’s wrong
400INVALID_JSONThe body isn’t valid JSON
401UNAUTHORIZEDThe Authorization header is missing or malformed
401INVALID_API_KEYThe key doesn’t exist
401API_KEY_REVOKEDThe key was revoked in the console
401API_KEY_EXPIREDThe key has expired
402PLAN_LIMITThe server’s plan doesn’t cover this: a limit is reached or a flag is missing
403BROWSER_REQUESTS_NOT_ALLOWEDThe request came from a browser (it has an Origin header)
403GUILD_MISMATCHThe key belongs to another server
403INSUFFICIENT_SCOPEThe key lacks the scope; required names it
403GUILD_BLOCKEDThe server is blocked from BotGG
403SELF_DECISIONThe API key’s creator can’t decide their own application or appeal
403MODERATOR_NOT_MEMBERThe API key’s creator is no longer on the server (moderation acts in their name)
403MODERATOR_MISSING_PERMISSIONThe API key’s creator lacks the Discord permission for this action; required names it
403HIERARCHYThe target can’t be moderated; reason says why (the key’s creator, a bot, the owner, or a role not below the creator’s or the bot’s)
404NOT_FOUNDUnknown endpoint
404TICKET_NOT_FOUNDNo ticket with this number on the server
404TRANSCRIPT_NOT_FOUNDThe ticket has no saved transcript (still open, transcripts off, or deleted)
404APPLICATION_NOT_FOUNDNo application (or form) with this number or ID on the server
404APPEAL_NOT_FOUNDNo ban appeal with this number on the server
404CASE_NOT_FOUNDNo moderation case with this number on the server
404MODERATION_ACTION_NOT_FOUNDNo moderation action with this ID was made with this API key
404BOT_NOT_IN_GUILDBotGG isn’t on this server
404MEMBER_NOT_FOUNDThe user isn’t a member of the server
404XP_CHANGE_NOT_FOUNDNo XP change with this ID was made with this API key
404SHOP_STORE_NOT_FOUNDNo store with this ID on the server
404SHOP_ITEM_NOT_FOUNDNo Shop item with this ID on the server
404SHOP_PURCHASE_NOT_FOUNDNo purchase with this ID on the server
404GIVEAWAY_NOT_FOUNDNo giveaway with this ID on the server
404FLOW_NOT_FOUNDNo flow with this ID on the server
404FLOW_EXECUTION_NOT_FOUNDNo flow run with this ID on the server
409FEATURE_DISABLEDThe feature this endpoint uses is turned off on the server; feature names it
409BANK_DISABLEDThe Bank is turned off on this server
409INSUFFICIENT_FUNDSNot enough balance to remove; balance is the current one
409SHOP_ITEM_UNAVAILABLEThe item can’t be bought or granted right now; reason says why (disabled, store closed, out of stock, limit, price changed, roles, level, role already owned)
409SHOP_ALREADY_REFUNDEDThe purchase was already refunded
409SHOP_ITEM_USEDThe item was already used; refund it with force: true
409ROLE_NOT_GRANTABLEThe bot can’t give the item’s role (missing, above the bot, too powerful, or Discord refused); nothing was charged
409GIVEAWAY_BAD_STATEThe giveaway’s status doesn’t allow this; status is the current one
409FLOW_NOT_RUNNABLEOnly flows that start with a Manual or Webhook trigger can be run; triggerType is the flow’s trigger
409FLOW_DISABLEDThe flow is turned off
409TICKET_CLOSEDThe ticket is already closed
409ALREADY_DECIDEDThe application or appeal was already decided; status is the decision
409NOT_BANNEDThe user isn’t banned from the server
409BOT_MISSING_PERMISSIONSThe bot lacks the Discord permission for this action; missing lists it
413PAYLOAD_TOO_LARGEThe request body is too large
415UNSUPPORTED_MEDIA_TYPEThe body isn’t sent as application/json
422IDEMPOTENCY_KEY_REUSEDThe idempotency key was already used for a different request
422BOT_ACCOUNTBots can’t hold balances
422BALANCE_LIMITThe change would break the server’s balance limits
429RATE_LIMITEDToo many requests; wait Retry-After seconds (also in the retryAfter field)
500INTERNALSomething went wrong on our side
503SERVICE_UNAVAILABLEDiscord couldn’t be reached, or BotGG has temporarily paused the feature; retry later

Which errors to retry

  • 429 RATE_LIMITED and 503 SERVICE_UNAVAILABLE: wait the number of seconds in Retry-After (also in retryAfter), then retry.
  • 500 INTERNAL and network errors: retry with backoff. For writes, send an Idempotency-Key so a retry never applies a change twice.
  • Other 4xx errors won’t succeed by retrying the same request: fix the request, the key or the server settings first.

Ready to level up your server?

Add BotGG for free, then switch features on in the web console.