Discord API
Bot token setup, Gateway info, guilds, channel messages, slash command registration, interaction replies and webhooks on API v10.
CommunicationGuided#bots#chat#slash-commands#webhooks#gaming#community
Fork copies the collection into your workspace, without the publisher's secrets, so you can add your own key and send requests. Star saves it to your starred APIs (Account › Marketplace) and helps others find it.
Overview
The Discord HTTP API is how bots and apps act in Discord servers (guilds): send and manage messages, read guild and channel information, register slash commands, answer interactions and post through webhooks. Live events (new messages, members joining) come over the Gateway WebSocket; this collection covers the HTTP side and the one Gateway call you need over HTTP, which tells you where and how to connect.
Getting a bot token
- Open the Developer Portal at https://discord.com/developers/applications and choose New Application.
- On General Information, copy the Application ID into
applicationId. The Public Key there is what you use to verify interaction signatures on your server. - On the Bot page, choose Reset Token, copy the token once and paste it into
botToken(secret). Turn on privileged intents (Message Content, Server Members, Presence) only if you need them. - Invite the bot: on Installation (or OAuth2 URL generator) pick the scopes
botandapplications.commandsand the permissions it needs (View Channels, Send Messages, Read Message History, Add Reactions, Manage Webhooks), then open the generated link and add it to a test server. - In Discord turn on Developer Mode (User Settings > Advanced), then right-click your server and a text channel to copy their IDs into
guildIdandchannelId.
Docs: https://docs.discord.com/developers/quick-start/getting-started
Authentication and version
Bot requests send Authorization: Bot <token> (the collection auth adds this header). HTTP clients must also send a User-Agent of the form DiscordBot (url, version); requests without one may be blocked. The base URL carries the API version: v10 is current and v9 is still available, older versions are deprecated or discontinued. All IDs are snowflakes returned as strings. Webhook execution needs no bot token: the webhook token in the URL is the credential.
Base URL
https://discord.com/api/v10. There is no sandbox: create a private test server for development.
Variables and run order
Fill botToken, applicationId, guildId and channelId. Run 1. Start here to check the token and Gateway session limits, 2. Guilds and channels, then 3. Messages (saves messageId), 4. Slash commands (guild commands update instantly, so register there while testing), 5. Interactions (needs interactionId and interactionToken from a real interaction your server received) and 6. Webhooks (saves webhookId and webhookToken).
Limits
Routes have per-route buckets reported in X-RateLimit-* headers, and each bot has a global limit of 50 requests per second. A 429 body carries retry_after in seconds and a global flag. Too many 401, 403 or 429 responses in a short window gets your IP temporarily blocked by Cloudflare. See https://docs.discord.com/developers/topics/rate-limits.
Common errors
| Status / code | Meaning | Fix |
|---|---|---|
| 401 | Bad token or missing Bot prefix | Re-copy the token; header must be Bot <token>. |
| 403, code 50001 / 50013 | Missing access or permissions | Give the bot's role the permission or channel access. |
| 404, code 10003 / 10008 | Unknown channel / message | Check the IDs; the bot must see the channel. |
| 400, code 50035 | Invalid form body | Read errors for the field at fault. |
| 429 | Rate limited | Wait retry_after seconds. |
Links
- API reference: https://docs.discord.com/developers/reference
- Application commands: https://docs.discord.com/developers/interactions/application-commands
- Interactions: https://docs.discord.com/developers/interactions/receiving-and-responding
- Webhooks: https://docs.discord.com/developers/resources/webhook
Endpoints 20
1. Start here
- GETGet current bot user
/users/@meReturns the bot's own user object (id, username, bot: true). Run this first: a 401 means the token is wrong or lacks the Bot prefix. The id is the bot's user… - GETGet Gateway (bot)
/gateway/botReturns the WebSocket url to connect to, the recommended number of shards, and session_start_limit (total, remaining, reset_after in milliseconds,… - GETGet current application
/applications/@meReturns your application: id, name, bot_public, the interactions endpoint URL, install settings and approximate guild count. Useful to confirm applicationId…
2. Guilds and channels
- GETList the bot's guilds
/users/@me/guildsLists the guilds (servers) the bot has joined, up to 200 per page; page with after set to the last guild ID. Each entry has id, name, icon and the bot's… - GETGet a guild
/guilds/{{guildId}}Reads one guild with its roles, emojis and settings. Add with_counts=true to get approximate_member_count and approximate_presence_count. Returns 403 or 404… - GETList guild channels
/guilds/{{guildId}}/channelsLists the guild's channels (threads excluded). type 0 is a text channel, 2 voice, 4 category, 5 announcement, 15 forum. Pick a text channel the bot can post…
3. Messages
- POSTSend a message
/channels/{{channelId}}/messagesPosts a message in channelId. Send at least one of content (up to 2000 characters), embeds, components, a file or a poll. allowed_mentions controls which… - GETGet channel messages
/channels/{{channelId}}/messagesReturns up to limit (1 to 100) recent messages in the channel, newest first. Page with before, after or around set to a message ID. Without the Message… - PATCHEdit a message
/channels/{{channelId}}/messages/{{messageId}}Edits the message in messageId. A bot can change the content of its own messages only; send just the fields you want to change. Returns the updated message… - PUTAdd a reaction
/channels/{{channelId}}/messages/{{messageId}}/reactions/%E2%9C%85/@meAdds the bot's reaction to the message. The emoji goes in the path URL-encoded: a Unicode emoji such as %E2%9C%85 (white check mark) or a custom emoji as… - DELETEDelete a message
/channels/{{channelId}}/messages/{{messageId}}Deletes the message in messageId. Deleting the bot's own messages needs no extra permission; deleting other people's needs Manage Messages. Returns 204. Run…
4. Slash commands
- POSTCreate a guild command
/applications/{{applicationId}}/guilds/{{guildId}}/commandsRegisters a slash command in one guild only. type 1 is a chat-input (slash) command; name is lowercase, 1 to 32 characters; description 1 to 100. Option type… - GETList guild commands
/applications/{{applicationId}}/guilds/{{guildId}}/commandsLists the commands registered for your application in guildId. Use it to check what is live before overwriting, or to find a command id to delete. - PUTBulk overwrite global commands
/applications/{{applicationId}}/commandsReplaces all of the application's global commands with the array you send: commands missing from the array are deleted. Use it from your deploy script.… - DELETEDelete a guild command
/applications/{{applicationId}}/guilds/{{guildId}}/commands/{{commandId}}Removes the guild command in commandId. Returns 204. For a global command use /applications/{applicationId}/commands/{commandId} instead.
5. Interactions
- POSTRespond to an interaction (callback)
/interactions/{{interactionId}}/{{interactionToken}}/callbackSends the first reply to an interaction. Put the interaction id and token from the payload Discord delivered into interactionId and interactionToken. You must… - PATCHEdit the original interaction response
/webhooks/{{applicationId}}/{{interactionToken}}/messages/@originalChanges the first reply to an interaction, typically after a deferred (type 5) callback when your slow work is done. Uses the application ID and the… - POSTSend a follow-up message
/webhooks/{{applicationId}}/{{interactionToken}}Posts an additional message for the same interaction within the 15-minute token window. Accepts the same body as executing a webhook (content, embeds, flags…
6. Webhooks
- POSTCreate a webhook
/channels/{{channelId}}/webhooksCreates an incoming webhook in channelId. Needs the Manage Webhooks permission. name is 1 to 80 characters and may not contain 'clyde' or 'discord'. The… - POSTExecute a webhook
/webhooks/{{webhookId}}/{{webhookToken}}Posts a message through the webhook. No Authorization header is used: the webhook token in the URL is the credential, so this works from any server or script.…
API details
- Base URL
https://discord.com/api/v10- Authentication
- An API key in the Authorization header
- Operations
- 20 operations on 20 pathsGET 8POST 6PUT 2PATCH 2DELETE 2
- Main resources
- 1. Start here 32. Guilds and channels 33. Messages 54. Slash commands 45. Interactions 36. Webhooks 2
- Description format
- Swastik Codes guided collection, API version
checked against the docs on 2026-11-18 - Links
- Documentation
How to test the Discord API in Swastik Codes
- Open the APISelect “Fork & run in Swastik Codes” on this page. Sign in or create a free account if asked.
- Fork it into your workspaceChoose a workspace. You get your own copy of the Discord API collection, without the publisher's secrets.
- Add your credentialsThis API uses an API key in the Authorization header. Add yours in the collection's variables or an environment; the requests already reference it.
- Send a requestPick an endpoint, for example “Get current bot user” (GET /users/@me), and press Send. Check the response, add tests and run the whole collection with the runner.
Frequently asked questions
What is the Discord API?
Bot token setup, Gateway info, guilds, channel messages, slash command registration, interaction replies and webhooks on API v10. It is listed under Communication and has 20 endpoints.
Who publishes the Discord API?
It is listed from Discord's public API description (an OpenAPI document), not published by Discord on Swastik Codes. Anyone who controls discord.com can claim the profile by adding a DNS TXT record.
What is the base URL of the Discord API?
Requests go to https://discord.com/api/v10. Endpoint paths are added to this base URL.
How do I authenticate with the Discord API?
With an API key in the Authorization header.
How many endpoints does the Discord API have?
20 operations on 20 paths (8 GET, 6 POST, 2 PUT, 2 PATCH, 2 DELETE). The largest groups are 1. Start here, 2. Guilds and channels, 3. Messages, 4. Slash commands.
Is forking the Discord API free?
Yes. Forking copies the collection into your workspace for free. It has been starred 0 times and forked 0 times.