Base URL: https://discord.com/api/v10
Authorization header: Authorization: Bot YOUR_TOKEN
---
1. Get Current Bot User
```bash
bash -c 'curl -s "https://discord.com/api/v10/users/@me" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}"' | jq '{id, username, discriminator}'
```
---
2. Send Message to Channel
Write to /tmp/discord_request.json:
```json
{
"content": "Hello from bot!"
}
```
Then run (replace with the actual channel ID):
```bash
bash -c 'curl -s -X POST "https://discord.com/api/v10/channels//messages" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}" -H "Content-Type: application/json" -d @/tmp/discord_request.json'
```
---
3. Send Embed Message
Write to /tmp/discord_request.json:
```json
{
"embeds": [
{
"title": "Bot Message",
"description": "This is from the bot API",
"color": 5793266
}
]
}
```
Then run (replace with the actual channel ID):
```bash
bash -c 'curl -s -X POST "https://discord.com/api/v10/channels//messages" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}" -H "Content-Type: application/json" -d @/tmp/discord_request.json'
```
---
4. Get Channel Info
Replace with the actual channel ID:
```bash
bash -c 'curl -s "https://discord.com/api/v10/channels/" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}"' | jq '{id, name, type, guild_id}'
```
---
5. Get Channel Messages
Replace with the actual channel ID:
```bash
bash -c 'curl -s "https://discord.com/api/v10/channels//messages?limit=10" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}"' | jq '.[] | {id, author: .author.username, content}'
```
---
6. Get Specific Message
Replace and with the actual IDs:
```bash
bash -c 'curl -s "https://discord.com/api/v10/channels//messages/" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}"' | jq '{id, content, author: .author.username}'
```
---
7. Delete Message
Replace and with the actual IDs:
```bash
bash -c 'curl -s -X DELETE "https://discord.com/api/v10/channels//messages/" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}"'
```
---
8. Add Reaction
Replace and with the actual IDs:
```bash
bash -c 'curl -s -X PUT "https://discord.com/api/v10/channels//messages//reactions/%F0%9F%91%8D/@me" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}" -H "Content-Length: 0"'
```
Note: Emoji must be URL encoded (π = %F0%9F%91%8D)
---
9. Get Guild (Server) Info
Replace with the actual guild ID:
```bash
bash -c 'curl -s "https://discord.com/api/v10/guilds/" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}"' | jq '{id, name, member_count, owner_id}'
```
---
10. List Guild Channels
Replace with the actual guild ID:
```bash
bash -c 'curl -s "https://discord.com/api/v10/guilds//channels" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}"' | jq '.[] | {id, name, type}'
```
---
11. Get Guild Members
Replace with the actual guild ID:
```bash
bash -c 'curl -s "https://discord.com/api/v10/guilds//members?limit=10" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}"' | jq '.[] | {user: .user.username, nick, joined_at}'
```
---
12. Get Guild Roles
Replace with the actual guild ID:
```bash
bash -c 'curl -s "https://discord.com/api/v10/guilds//roles" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}"' | jq '.[] | {id, name, color, position}'
```
---
13. Create Webhook
Write to /tmp/discord_request.json:
```json
{
"name": "My Webhook"
}
```
Then run (replace with the actual channel ID):
```bash
bash -c 'curl -s -X POST "https://discord.com/api/v10/channels//webhooks" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}" -H "Content-Type: application/json" -d @/tmp/discord_request.json' | jq '{id, token, url: "https://discord.com/api/webhooks/\(.id)/\(.token)"}'
```
---
14. List Channel Webhooks
Replace with the actual channel ID:
```bash
bash -c 'curl -s "https://discord.com/api/v10/channels//webhooks" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}"' | jq '.[] | {id, name, token}'
```
---
15. Create Text Channel
Write to /tmp/discord_request.json:
```json
{
"name": "new-channel",
"type": 0
}
```
Then run (replace with the actual guild ID):
```bash
bash -c 'curl -s -X POST "https://discord.com/api/v10/guilds//channels" -H "Authorization: Bot ${DISCORD_BOT_TOKEN}" -H "Content-Type: application/json" -d @/tmp/discord_request.json' | jq '{id, name}'
```
---