This page provides a comprehensive guide to the Discord Bot API, covering various endpoints and functionalities.
Endpoints
/channels
- Manage channels on the Discord server./guilds
- Manage guilds (servers) on Discord./users
- Manage users on Discord.
Usage
To interact with the API, you need to have an OAuth2 token. You can obtain one from the Discord Developer Portal.
Channels
- List Channels: Get a list of channels in a guild.
curl -H "Authorization: Bearer YOUR_TOKEN" https://discord.com/api/v10/guilds/GUILD_ID/channels
- Create Channel: Create a new channel in a guild.
curl -X POST -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" -d '{"name": "General", "type": 0}' https://discord.com/api/v10/guilds/GUILD_ID/channels
Guilds
- List Guilds: Get a list of guilds the user is in.
curl -H "Authorization: Bearer YOUR_TOKEN" https://discord.com/api/v10/users/@me/guilds
- Create Guild: Create a new guild.
curl -X POST -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" -d '{"name": "My New Guild", "region": "us-west", "verification_level": 0, "default_message_notifications": 0, "afk_channel_id": null, "afk_timeout": 60, "icon": null, "owner_id": "USER_ID"}' https://discord.com/api/v10/guilds
Users
- Get User: Get information about a user.
curl -H "Authorization: Bearer YOUR_TOKEN" https://discord.com/api/v10/users/USER_ID
Example
Here's an example of how to create a channel in a guild:
curl -X POST -H "Authorization: Bearer YOUR_TOKEN" -H "Content-Type: application/json" -d '{"name": "General", "type": 0}' https://discord.com/api/v10/guilds/GUILD_ID/channels
Discord Bot