Cheat sheet

Discord bot API cheat sheet

REST base: https://discord.com/api/v10 with header Authorization: Bot <TOKEN>. Real-time events arrive over the Gateway WebSocket, or as signed HTTP requests if you use an interactions endpoint URL.

Privileged intents

  • GUILD_MEMBERS (1 << 1)
  • GUILD_PRESENCES (1 << 8)
  • MESSAGE_CONTENT (1 << 15) needed to read message text outside mentions and DMs
  • Enable them in the Developer Portal; verified bots in 100 or more servers need approval.

Permissions and intents calculator

Interaction responses

  • 1 PONG (HTTP endpoint ping)
  • 4 CHANNEL_MESSAGE_WITH_SOURCE
  • 5 DEFERRED_CHANNEL_MESSAGE_WITH_SOURCE (thinking...)
  • 6 DEFERRED_UPDATE_MESSAGE, 7 UPDATE_MESSAGE (components)
  • 8 AUTOCOMPLETE_RESULT, 9 MODAL
  • Respond within 3 seconds; follow up with the token for 15 minutes. Flag 64 makes a reply ephemeral.

Commands

  • PUT /applications/{app_id}/commands global (bulk overwrite)
  • PUT /applications/{app_id}/guilds/{guild_id}/commands instant, for testing
  • Option types: 3 STRING, 4 INTEGER, 5 BOOLEAN, 6 USER, 7 CHANNEL, 8 ROLE, 9 MENTIONABLE, 10 NUMBER, 11 ATTACHMENT

Slash command builder

Mentions and markdown

  • <@USER_ID>, <@&ROLE_ID>, <#CHANNEL_ID>
  • <t:UNIX:R> timestamps; styles t T d D f F R
  • **bold** *italic* __underline__ ~~strike~~ ||spoiler|| `code`, ```lang blocks
  • Use allowed_mentions to stop a bot from pinging @everyone by accident.

Rate limit headers

  • X-RateLimit-Limit, X-RateLimit-Remaining
  • X-RateLimit-Reset-After (seconds), X-RateLimit-Bucket
  • X-RateLimit-Global, X-RateLimit-Scope on 429
  • Global limit 50 requests per second; 10,000 invalid requests per 10 minutes leads to a temporary IP ban.

Common errors

  • 50001 Missing Access bot cannot see the channel
  • 50013 Missing Permissions role order or channel overwrites
  • 10062 Unknown interaction responded after 3 seconds
  • 40060 Interaction has already been acknowledged
  • 4014 Disallowed intent(s) Gateway close code: enable the intent in the portal

Source: discord.com/developers/docs.

Last checked against official documentation: