Discord API
discord.com · Communication
Build Discord bots and integrations — send messages, manage servers, read channels, handle events, and interact with users. Free, bot token required.
Authentication
Sample Requests
Get info about the bot's own account.
Hover any highlighted part to learn what it does
| Authorization | Bot YOUR_BOT_TOKEN |
curl -X GET "https://discord.com/api/v10/users/@me" \ -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
import requests
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
response = requests.get(
"https://discord.com/api/v10/users/@me",
headers=headers,
)
print(response.json())const url = 'https://discord.com/api/v10/users/@me';
const response = await fetch(url, {
headers: {
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://discord.com/api/v10/users/@me"
req, _ := http.NewRequest("GET", targetURL, nil)
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://discord.com/api/v10/users/@me")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
req["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://discord.com/api/v10/users/@me";
$opts = ["http" => [
"method" => "GET",
"header" => implode("\r\n", [
"Authorization: Bearer YOUR_ACCESS_TOKEN"
]),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Send a message to a channel.
Hover any highlighted part to learn what it does
| Content-Type | application/json |
| Authorization | Bot YOUR_BOT_TOKEN |
{
"content": "Hello from the API!"
}
curl -X POST "https://discord.com/api/v10/channels/{channel_id}/messages" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"content":"Hello from the API!"}'import requests
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_ACCESS_TOKEN"
}
data = {
"content": "Hello from the API!"
}
response = requests.post(
"https://discord.com/api/v10/channels/{channel_id}/messages",
headers=headers,
json=data,
)
print(response.json())const url = 'https://discord.com/api/v10/channels/{channel_id}/messages';
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_ACCESS_TOKEN'
},
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"content": "Hello from the API!"
}),
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"bytes"
"encoding/json"
)
func main() {
targetURL := "https://discord.com/api/v10/channels/{channel_id}/messages"
jsonData, _ := json.Marshal({"content":"Hello from the API!"})
req, _ := http.NewRequest("POST", targetURL, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer YOUR_ACCESS_TOKEN")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://discord.com/api/v10/channels/{channel_id}/messages")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Post.new(uri)
req["Content-Type"] = "application/json"
req["Authorization"] = "Bearer YOUR_ACCESS_TOKEN"
req["Content-Type"] = "application/json"
req.body = "{\"content\":\"Hello from the API!\"}"
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://discord.com/api/v10/channels/{channel_id}/messages";
$opts = ["http" => [
"method" => "POST",
"header" => implode("\r\n", [
"Content-Type: application/json",
"Authorization: Bearer YOUR_ACCESS_TOKEN",
"Content-Type: application/json"
]),
"content" => json_encode({"content":"Hello from the API!"}),
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- Create an app at discord.com/developers/applications
- Go to Bot tab → Reset Token to get your bot token
- Set Authorization: Bot YOUR_TOKEN
- Invite your bot: OAuth2 → URL Generator → bot scope + required permissions
- GET /users/@me to verify the token works
What can you build with Discord API?
Discord API is a Communication API. Developers commonly use communication APIs for:
- sending SMS alerts and notifications
- building in-app chat and messaging features
- automating email sequences and transactional emails
- creating voice bots and IVR systems
- verifying phone numbers at signup
Bearer token. Your app exchanges credentials for a short-lived token, then sends it as an Authorization header. Tokens expire, so your code needs to handle renewal. Discord API is free to use up to a usage limit, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide