Yes, Discord has a REST API, and it is how every bot actually does things: sending messages, giving roles, creating channels. This page covers the basics, with real endpoints from Discord’s documentation, for anyone wiring up a menu bot or a specials webhook for their server.
REST and the Gateway
Discord gives apps two connections. The REST API is plain HTTPS: you send a request, you get JSON back. The Gateway is a WebSocket that pushes events to you as they happen. Most events, such as new messages and role changes, only arrive over the Gateway. A bot that only posts things can live on REST alone. A bot that reacts to messages needs both.
The basics, from the docs
| Thing | Value |
|---|---|
| Base URL | https://discord.com/api |
| Versions | Add /v10 (or /v9). 8, 7 and 6 are deprecated |
| Bot auth | Authorization: Bot <token> |
| OAuth2 auth | Authorization: Bearer <token> |
| User-Agent | DiscordBot ($url, $versionNumber). Requests without a valid one may be blocked |
| IDs | Snowflakes, always returned as strings |
Send a message
The endpoint is POST /channels/{channel.id}/messages. A complete request looks like this:
POST https://discord.com/api/v10/channels/123456789012345678/messages
Authorization: Bot YOUR_BOT_TOKEN
User-Agent: DiscordBot (https://example.com, 1.0)
Content-Type: application/json
{ "content": "Thursday special: mushroom risotto" }The bot must be in the server and allowed to view and send messages in that channel. Keep the token secret: anyone with it controls your bot.
Or skip the bot: webhooks
Discord’s docs call webhooks “a low-effort way to post messages to channels”. They need no bot user and no token. Create one in a channel’s settings under Integrations, copy the URL, and POST to it:
POST https://discord.com/api/webhooks/{webhook.id}/{webhook.token}
Content-Type: application/json
{ "content": "Kitchen closes at 10pm tonight" }A webhook can send up to 10 embeds per message. It cannot read messages or react to members. For a daily specials post from your till or booking system, it is often all you need.
Endpoints a restaurant server might use
| Task | Endpoint |
|---|---|
| Post the specials | POST /channels/{id}/messages |
| Post via webhook | POST /webhooks/{id}/{token} |
| Add a member who authorized your app | PUT /guilds/{guild.id}/members/{user.id} |
The last one is how member restore works. Discord’s docs say it needs an OAuth2 access token for the user with the guilds.join scope, and a bot in the server with the Create Instant Invite permission. It returns 201 with the new member, or 204 if they were already there.
Every endpoint has rate limits. Read Discord’s rate limit docs before you loop over anything.
Libraries
You rarely call the REST API by hand. Libraries such as discord.js (JavaScript) and discord.py (Python) wrap both the REST API and the Gateway, handle authentication headers and pace requests for you. discord.js also publishes its REST client as a separate package, handy for small scripts that only post. Whichever you use, keep the bot token in an environment variable, never in code you share.