Gateway Events
Gateway connections are WebSockets, meaning they're bidirectional and either side of the WebSocket can send events to the other. The following events are split up into two types:
- Send events are Gateway events sent by a client to Discord (like when identifying with the Gateway)
- Receive events are Gateway events that are sent by Discord to a client. These events typically represent something happening inside of a guild where the user is a member of, like a channel being updated.
All Gateway events are encapsulated in a Gateway payload.
For more information about interacting with the Gateway, you can reference the Gateway documentation.
Event Names
In practice, event names are UPPER-CASED with under_scores joining each word in the name. For instance, Channel Create would be CHANNEL_CREATE
and Voice State Update would be VOICE_STATE_UPDATE
.
For readability, event names in the following documentation are typically left in Title Case.
Gateway Payload Structure
Gateway event payloads have a common structure, but the contents of the associated data (d
) varies between the different events.
Field | Type | Description |
---|---|---|
op | integer | Gateway Opcode, which indicates the payload type |
d | ?JSON value | Event data |
s? 1 | ?integer | Sequence number of event used for resuming sessions and heartbeating |
t? 1 | ?string | Event name for this payload (DISPATCH Opcode only) |
1 These fields are received only, and null
when the op
is not DISPATCH
.
Example Gateway Payload (Send)
{"op": 2,"d": {}}
Example Gateway Payload (Receive)
{"op": 0,"d": {},"s": 42,"t": "GATEWAY_EVENT_NAME"}
Send Events
Send events are Gateway events encapsulated in an event payload, and are sent by a client to Discord through a Gateway connection.
Name | Description |
---|---|
Identify | Trigger the initial handshake with the Gateway |
Resume | Resume a dropped Gateway connection |
Heartbeat | Maintain an active Gateway connection |
Update Presence | Update the client's presence |
Update Voice State | Join, move, or disconnect the client from a voice channel or call |
Ping Voice Server | Ping the Discord voice servers |
Request Guild Members | Request members for one or more guilds |
Request Call Connect | Request a private channels's pre-existing call information |
Request Soundboard Sounds | Request soundboard sounds for one or more guilds |
Update Guild Subscriptions | Update subscriptions for a guild |
Connect Lobby | Join a lobby |
Disconnect Lobby | Leave a lobby |
Update Lobby Voice State | Update the client's voice state in a lobby |
Create Stream | Create a stream for the client (Go Live) |
Delete Stream | End a client stream |
Watch Stream | Watch a user's stream |
Ping Stream | Ping a user stream's voice server |
Set Stream Paused | Pause/resume a client stream |
Create Embedded Activity | Launch an embedded activity in a voice channel or call |
Update Embedded Activity | Update an embedded activity |
Delete Embedded Activity | Delete an embedded activity |
Request Forum Unreads | Request thread-only channel unread counts |
Remote Command | Send a remote command to an embedded (Xbox, PlayStation) voice session |
Request Deleted Entity IDs | Request deleted entity IDs not matching a given hash for a guild |
Request Soundboard Sounds | Request soundboard sounds for one or more guilds |
Create Speed Test | Create a voice speed test |
Delete Speed Test | Delete a voice speed test |
Request Last Messages | Request last messages for a guild's channels |
Search Recent Members | Request recently-joined members for a guild |
Request Channel Statuses | Request voice channel statuses for a guild |
Identify
Used to trigger the initial handshake with the Gateway.
Details about identifying is in the Gateway documentation.
Identify Structure
Field | Type | Description |
---|---|---|
token | string | Authentication token |
properties | client properties object | Client and system information |
compress? | boolean | Whether this connection uses legacy payload compression (default false) |
large_threshold? | integer | Total number of members where, for bots, the Gateway will stop sending offline members in the guild member list, or, for users, stop sending non-stateful events for guilds without a subscription (25-250, default 25 for bots and 250 for users) {/ TODO: Verify default /} |
shard? | array[integer, integer] | The connection's shard (shard_id, num_shards), used for connection sharding |
presence? 1 | update presence object | Initial presence information |
intents? 2 | integer | The Gateway intents you wish to receive |
capabilities? | integer | The Gateway capabilities you wish to enable |
client_state? | client state object | The client's current cache state, used for reducing unneeded information transmission on re-identify |
1 For user accounts, the status
and activities
specified may not always be respected. The field should only be used when re-identifying to communicate the last known presence of the user.
2 Required for bots on API v8 and above.
Example Identify
{"op": 2,"d": {"token": "my_token","properties": {"os": "linux","browser": "disco","device": "disco"},"compress": false,"presence": {"activities": [],"status": "unknown","since": 0,"afk": false},"capabilities": 16381,"client_state": {"api_code_version": 0,"guild_versions": {}}}}
Resume
Used to replay missed events when a disconnected client resumes.
Details about resuming are in the Gateway documentation.
Resume Structure
Field | Type | Description |
---|---|---|
token | string | Authentication token |
session_id | string | Existing session ID |
seq | integer | Last sequence number received |
Example Resume
{"op": 6,"d": {"token": "randomstring","session_id": "30f32c5d54ae86130fc4a215c7474263","seq": 1337}}
Heartbeat
Used to maintain an active Gateway connection. Must be sent every heartbeat_interval
milliseconds after the Opcode 10 Hello payload is received. The inner d
key is the last sequence number—s
—received by the client. If you have not yet received one, send null
. Fires a Heartbeat ACK Gateway event.
Details about heartbeats are in the Gateway documentation.
Example Heartbeat
{"op": 1,"d": 251}
Update Presence
Sent by the client to indicate a presence update.
Update Presence Structure
Field | Type | Description |
---|---|---|
activities | array[activity object] | The user's activities |
status | string | the user's new status |
since | integer | Unix timestamp (in milliseconds) of when the client went idle, or 0 if it is not |
afk | boolean | Whether or not the client is AFK, used to determine whether to dispatch mobile push notifications |
Example Update Presence
{"op": 3,"d": {"since": 0,"activities": [{"application_id": "383226320970055681","assets": {"large_image": "565945350846939145","large_text": "Editing a TEXT file","small_image": "565945770067623946","small_text": "Visual Studio Code"},"buttons": ["View Repository"],"created_at": "1695164784863","details": "Editing index.astro","flags": 0,"id": "d11307d8c0abb135","name": "Visual Studio Code","session_id": "30f32c5d54ae86130fc4a215c7474263","state": "Workspace: vendicated.dev","timestamps": {"start": "1695164482423"},"type": 0}],"status": "online","afk": false}}
Update Voice State
Sent when a client wants to join, move, or disconnect from a voice channel.
Update Voice State Structure
Field | Type | Description |
---|---|---|
guild_id | ?snowflake | The ID of the guild the voice channel is in, if any |
channel_id | ?snowflake | The ID of the voice or private channel the client wants to join (null if disconnecting) |
self_mute | boolean | Whether the client is muted |
self_deaf | boolean | Whether the client is deafened |
self_video? | boolean | Whether the client is streaming video to the channel |
preferred_region? | string | The preferred voice region ID for the voice channel (not guaranteed) |
flags? | integer | The client's voice flags |
Example Update Voice State
{"op": 4,"d": {"guild_id": "41771983423143937","channel_id": "127121515262115840","self_mute": false,"self_deaf": false,"self_video": false,"flags": 3}}
Ping Voice Server
Sent when a client wants to ping a voice server. The inner d
key should be set to null
.
Example Ping Voice Server
{"op": 5,"d": null}
Request Guild Members
Used to request all members for a guild or a list of guilds. When initially connecting, if you don't have the GUILD_PRESENCES
Gateway intent, or if the guild is over 75k members, it will only send members who are in voice, plus the member for you (the connecting user). Otherwise, if a guild has over large_threshold
members (value in the Gateway Identify), it will only send members who are online, have a role, have a nickname, or are in a voice channel, and if it has under large_threshold
members, it will send all members. If a client wishes to receive additional members, they need to explicitly request them via this operation. Fires multiple Guild Members Chunk events with up to 1000 members per chunk until all members that match the request have been sent.
Due to our privacy and infrastructural concerns with this feature, there are some limitations that apply:
- For bots, the
GUILD_PRESENCES
privileged intent is required to request presences - For bots, the
GUILD_MEMBERS
privileged intent is required to request the entire member list (query of "" and limit of 0) - For users, the
MANAGE_ROLES
,KICK_MEMBERS
, orBAN_MEMBERS
permissions are required to request the entire member list (query of "" and limit of 0) - For bots, only one guild ID may be requested at a time
- Requesting a prefix (
query
parameter) will return a maximum of 100 members user_ids
will be limited to 100 members
Request Guild Members Structure
Field | Type | Description |
---|---|---|
guild_id | array[snowflake] | snowflake | ID(s) of the guild(s) to get members for |
query? 1 | string | String that the username/nickname starts with, or an empty string to return all members |
limit? 2 | integer | Maximum number of members to send matching the query (0-100, must be 0 with an empty query ) |
presences? | boolean | Whether the presence of matched members will be returned |
user_ids? 1 | snowflake or array of snowflakes | The user IDs to request (max 100) |
nonce? 3 | string | Nonce to identify the Guild Members Chunk response |
1 One of query
or user_ids
is required.
2 Required when specifying query
.
3 The nonce can only be up to 32 bytes. If you send an invalid nonce, it will be ignored, and the reply member chunk(s) will not have a nonce set.
Example Request Guild Members
{"op": 8,"d": {"guild_id": ["41771983444115456"],"query": "","limit": 0}}
Request Call Connect
Used to request a private channel's pre-existing call data, created before the Gateway connection was established. Fires a Call Create Gateway event if a call is found.
Request Call Connect Structure
Field | Type | Description |
---|---|---|
channel_id | snowflake | ID of the DM or group DM channel |
Example Request Call Connect
{"op": 13,"d": {"channel_id": "957057010334048288"}}
Request Soundboard Sounds
Used to request soundboard sounds for a list of guilds. Fires a Soundboard Sounds Gateway event for every guild in response.
Request Soundboard Sounds Structure
Field | Type | Description |
---|---|---|
guild_ids | array[snowflake] | The IDs of the guilds to get soundboard sounds for |
Example Request Soundboard Sounds
{"op": 31,"d": {"guild_ids": ["41771983444115456", "1015060230222131221", "811255666990907402"]}}
Request Last Messages
Used to request the last messages (indicated by the last_message_id
field) from channels. Fires a Last Messages Gateway event with up to 100 messages that match the request.
Request Last Messages Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
channel_ids | array[snowflake] | The IDs of the channels to request last messages for (max 100) |
Example Request Last Messages
{"op": 34,"d": {"guild_id": "957057010334048288","channel_ids": ["1145501524013895733", "1145501524013895734"]}}
Search Recent Members
Used to search the 10,000 most recently joined members in a guild. Fires a Guild Members Chunk Gateway event with up to 1000 members that match the request.
Search Recent Members Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild to search members for |
query 1 | string | String that the username/nickname starts with, or an empty string to return all members |
continuation_token 2 | ?snowflake | The member ID to continue pagination from |
nonce? 3 | string | Nonce to identify the Guild Members Chunk response |
1 When a query is provided, results are limited to one member.
2 Pagination is based on the joined_at
field descending. To paginate, you provide the member ID of the member that joined the earliest in the previously received Guild Members Chunk. You can only paginate up to 10,000 members back from the most recently joined member.
3 The nonce can only be up to 32 bytes. If you send an invalid nonce, it will be ignored, and the reply member chunk will not have a nonce set.
Example Search Recent Members
{"op": 35,"d": {"guild_id": "957057010334048288","query": "","continuation_token": null}}
Request Channel Statuses
Used to request the voice channel statuses for a guild. Fires a Channel Statuses Gateway event with the requested statuses.
Request Channel Statuses Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
Example Request Channel Statuses
{"op": 36,"d": {"guild_id": "957057010334048288"}}
Receive Events
Received events are Gateway events encapsulated in an event payload, and are sent by Discord to a client through a Gateway connection. Most received events correspond to dispatch events that happen relevant to the current user and the guilds it is a member of.
Name | Description |
---|---|
Hello | Defines the heartbeat interval |
Heartbeat ACK | Acknowledges a received client heartbeat |
Reconnect | Indicates the server is going away, client should reconnect to Gateway and resume |
Invalid Session | Failure response to Identify or Resume, or indicates an invalid active session |
Dispatch | Dispatches an event to the client |
Hello
Sent on connection to the WebSocket. Defines the heartbeat interval that the client should heartbeat to.
Hello Structure
Field | Type | Description |
---|---|---|
_trace | array[string] | An array of stringified JSON values representing the connection trace, used for debugging |
heartbeat_interval | integer | The interval (in milliseconds) the client should heartbeat at |
Example Hello
{"op": 10,"d": {"heartbeat_interval": 41250,"_trace": ["[\"gateway-prd-us-east1-c-6w69\",{\"micros\":0.0}]"]},"s": null,"t": null}
Heartbeat ACK
Sent in response to receiving a heartbeat to acknowledge that it has been received.
Details about heartbeats are in the Gateway documentation.
Example Heartbeat ACK
{"op": 11,"d": null,"s": null,"t": null}
Reconnect
The reconnect event is dispatched when a client should reconnect to the Gateway (and resume their existing session, if they have one). This event usually occurs during deploys to migrate sessions gracefully off old hosts.
Example Reconnect
{"op": 7,"d": null,"s": null,"t": null}
Invalid Session
Sent to indicate one of at least three different situations:
- The Gateway could not initialize a session after receiving an Opcode 2 Identify
- The Gateway could not resume a previous session after receiving an Opcode 6 Resume
- The Gateway has invalidated an active session and is requesting client action
The inner d
key is a boolean that indicates whether the session may be resumable. See Connecting and Resuming for more information.
Example Invalid Session
{"op": 9,"d": false,"s": null,"t": null}
Dispatch Events
These events directly correspond with a specific action or state change that has occurred in the platform.
Name | Description |
---|---|
Ready | Initial state information |
Ready Supplemental | Supplemental information for the initial state, not critical to beginning use of the platform |
Resumed | Acknowledges a successful Resume |
Auth Session Change | Current session's associated auth session ID changed |
Authenticator Create | WebAuthn authenticator was created |
Authenticator Update | WebAuthn authenticator was updated |
Authenticator Delete | WebAuthn authenticator was deleted |
Application Command Permissions Update | Application command permission was updated |
Auto Moderation Rule Create | AutoMod rule was created |
Auto Moderation Rule Update | AutoMod rule was updated |
Auto Moderation Rule Delete | AutoMod rule was deleted |
Auto Moderation Action Execution | AutoMod rule was triggered and an action was executed (e.g. a message was blocked) |
Auto Moderation Mention Raid Detection | AutoMod mention raid incident was detected |
Call Create | Private channel call was created |
Call Update | Private channel call was updated |
Call Delete | Private channel call was deleted |
Channel Create | New guild channel created |
Channel Update | Channel was updated |
Channel Delete | Channel was deleted |
Channel Statuses | Response to Request Channel Statuses |
Voice Channel Status Update | Voice channel status was updated |
Channel Pins Update | Message was pinned or unpinned |
Channel Recipient Add | User joined a group DM channel |
Channel Recipient Remove | User was removed from a group DM channel |
DM Settings Upsell Show | DM privacy settings upsell modal was triggered |
Thread Create | Thread was created, also sent when being added to a private thread |
Thread Update | Thread was updated |
Thread Delete | Thread was deleted |
Thread List Sync | Sent when gaining access to a channel, contains all active threads in that channel |
Thread Member Update | Thread member for the current user was updated |
Thread Members Update | User(s) were added to or removed from a thread |
Friend Suggestion Create | Friend suggestion was created |
Friend Suggestion Delete | Friend suggestion was deleted |
Guild Create | Guild became available or user joined a new guild |
Guild Update | Guild was updated |
Guild Delete | Guild became unavailable, or user left/was removed from a guild |
Guild Audit Log Entry Create | Guild audit log entry was created |
Guild Ban Add | User was banned from a guild |
Guild Ban Remove | User was unbanned from a guild |
Guild Emojis Update | Guild emoji were updated |
Guild Stickers Update | Guild stickers were updated |
Guild Join Request Create | Guild join request was created |
Guild Join Request Update | Guild join request was updated |
Guild Join Request Delete | Guild join request was deleted |
Guild Member Add | User joined a guild |
Guild Member Remove | User was removed from a guild |
Guild Member Update | Guild member was updated |
Guild Members Chunk | Response to Request Guild Members |
Guild Role Create | Guild role was created |
Guild Role Update | Guild role was updated |
Guild Role Delete | Guild role was deleted |
Guild Scheduled Event Create | Guild scheduled event was created |
Guild Scheduled Event Update | Guild scheduled event was updated |
Guild Scheduled Event Delete | Guild scheduled event was deleted |
Guild Scheduled Event User Add | User subscribed to a guild scheduled event |
Guild Scheduled Event User Remove | User unsubscribed from a guild scheduled event |
Guild Soundboard Sound Create | Guild soundboard sound was created |
Guild Soundboard Sound Update | Guild soundboard sound was updated |
Guild Soundboard Sound Delete | Guild soundboard sound was deleted |
Soundboard Sounds | Response to Request Soundboard Sounds |
Guild Integrations Update | Guild integration was updated |
Integration Create | Guild integration was created |
Integration Update | Guild integration was updated |
Integration Delete | Guild integration was deleted |
Interaction Create | User used an interaction, such as an Application Command |
Invite Create | Guild invite to a channel was created |
Invite Delete | Guild invite to a channel was deleted |
Message Create | Message was created |
Message Update | Message was edited |
Message Delete | Message was deleted |
Message Delete Bulk | Multiple messages were deleted at once |
Message Poll Vote Add | User voted on a poll |
Message Poll Vote Remove | User removed a vote on a poll |
Message Reaction Add | User reacted to a message |
Message Reaction Add Many | Many users reacted to a message |
Message Reaction Remove | User removed a reaction from a message |
Message Reaction Remove All | All reactions were explicitly removed from a message |
Message Reaction Remove Emoji | All reactions for a given emoji were explicitly removed from a message |
Recent Mention Delete | Recent message that mentioned the current user was acknowledged |
Last Messages | Response to Request Last Messages |
OAuth2 Token Revoke | OAuth2 application was deauthorized |
Presence Update | User presence was updated |
Relationship Add | User had a relationship added |
Relationship Update | User had a relationship updated |
Relationship Remove | User had a relationship removed |
Stage Instance Create | Stage instance was created |
Stage Instance Update | Stage instance was updated |
Stage Instance Delete | Stage instance was deleted or closed |
Typing Start | User started typing in a channel |
User Update | Current user changed |
User Application Remove | User uninstalled an application |
User Connections Update | User connection was created, updated, or deleted |
User Note Update | User note was updated |
User Required Action Update | User's required action was updated |
User Settings Update | User settings were updated |
Voice State Update | User joined, left, or moved a voice channel |
Voice Server Update | Voice connection server was updated |
Voice Channel Effect Send | User sent an effect in a voice channel the current user is connected to |
Webhooks Update | Channel webhook was created, update, or deleted |
Ready
Sent when a client has completed the initial handshake with the Gateway (for new sessions). The Ready event is the largest and most complex event the Gateway will send, as it contains all the state required for a client to begin interacting with the rest of the platform.
Ready Structure
Field | Type | Description |
---|---|---|
_trace | array[string] | An array of stringified JSON values representing the connection trace, used for debugging |
v | integer | API version |
user | user object | The connected user |
user_settings 1 4 (deprecated) | user settings object | The client settings for the user |
user_settings_proto? 1 | string | The base-64 encoded preloaded user settings for the user, (if missing, defaults are used) |
guilds 2 6 | array[gateway guild object] | The guilds the user is in |
guild_join_requests 1 | array[partial guild join request] | Active guild join requests the user has |
relationships 1 | array[relationship] | The relationships the user has with other users |
friend_suggestion_count? 1 | integer | The number of friend suggestions the user has |
private_channels 1 | array[channel object] | The DMs and group DMs the user is participating in |
connected_accounts | array[connection] | The third-party accounts the user has linked |
notes 1 5 | map[snowflake, string] | A mapping of user IDs to notes the user has made for them |
presences 6 | array[presence object] | The presences of the user's non-offline friends and implicit relationships (depending on the NO_AFFINE_USER_IDS Gateway capability). |
merged_presences 6 | merged presences object | The presences of the user's non-offline friends and implicit relationships (depending on the NO_AFFINE_USER_IDS Gateway capability), and any guild presences sent at startup |
merged_members 6 7 | array[array[guild member object]] | The members of the user's guilds, in the same order as the guilds array |
users 6 | array[partial user object] | The deduped users across all objects in the event |
application? | gateway application object | The application of the connected user, if it is a bot |
session_id | string | Unique session ID, used for resuming connections |
session_type | string | The type of session that was started |
auth_session_id_hash 1 | string | The hash of the auth session ID corresponding to the auth token used to connect |
auth_token? 1 3 | string | The refreshed auth token for this user; if present, the client should discard the current auth token and use this in subsequent requests to the API |
analytics_token 1 | string | The token used for analytical tracking requests |
authenticator_types | array[integer] | The types of multi-factor authenticators the user has enabled |
required_action? 1 | string | The action a user is required to take before continuing to use Discord |
country_code 1 | string | The detected ISO 3166-1 alpha-2 country code of the user's current IP address |
geo_ordered_rtc_regions | array[string] | A geo-ordered list of RTC regions that can be used when when setting a voice channel's rtc_region or updating the client's voice state |
tutorial 1 8 | ?tutorial object | The tutorial state of the user, if any |
shard? | array[integer, integer] | The shard information (shard_id, num_shards) associated with this session, if sharded |
resume_gateway_url | string | WebSocket URL for resuming connections |
api_code_version 1 | integer | The API code version, used when re-identifying with client state v2 |
experiments 1 | array[user experiment object] | User experiment rollouts for the user |
guild_experiments 1 | array[guild experiment object] | Guild experiment rollouts for the user |
1 Feature is not available to or not tracked for bots. This field may be empty, omitted, or null
.
2 For bots, guilds start out as unavailable when they connect to the Gateway. As they become available, the bot will be notified via Guild Create events.
3 Requires the AUTH_TOKEN_REFRESH
Gateway capability.
4 Omitted when using the USER_SETTINGS_PROTO
Gateway capability.
5 Omitted when using the LAZY_USER_NOTES
Gateway capability.
6 When using the DEDUPE_USER_OBJECTS
Gateway capability, presences
, as well as each guild's presences
array, is replaced by merged_presences
. In addition, each guild's members
array will be collapsed into merged_members
. Finally, the users
array will contain the user objects for every user in the event. Any user object in the event will be omitted, with an ID left in its place (e.g. user_id
in member objects, recipient_ids
in private channel objects, etc.).
7 When using the PRIORITIZED_READY_PAYLOAD
Gateway capability, merged_members
in Ready will only include the client's member object for each guild. The rest will be sent in the Ready Supplemental event. See the gateway guild object documentation for more information about included data.
8 The tutorial state is cleared after a period of inactivity. A null
tutorial means no indicators will be shown.
Session Type
Value | Description |
---|---|
normal | A normal client session |
Merged Presences Structure
Field | Type | Description |
---|---|---|
friends | array[presence object] | Presences of the user's friends and implicit relationships (depending on the NO_AFFINE_USER_IDS Gateway capability) |
guilds 1 | array[array[presence object]] | Presences of the user's guilds, in the same order as the guilds array in Ready |
1 See the gateway guild object documentation for more information about included data.
Tutorial Structure
Field | Type | Description |
---|---|---|
indicators_suppressed | bool | Whether the user has suppressed all tutorial indicators |
indicators_confirmed | array[string] | An array of the tutorial indicators the user has confirmed |
Gateway Application Structure
Field | Type | Description |
---|---|---|
id | snowflake | The ID of the application |
flags | integer | The application's flags |
Ready Supplemental
Sent soon after Ready, with additional data that is not critical to begin interacting with the platform.
If this event is enabled, any fields received in it that are also present in Ready will not be received in Ready (unless otherwise specified).
Ready Supplemental Structure
Field | Type | Description |
---|---|---|
guilds | array[supplemental guild object] | The guilds the user is in |
merged_members 1 | array[array[member object]] | The members of the user's guilds, in the same order as the guilds array |
merged_presences 1 | merged presences object | The presences of the user's non-offline friends and implicit relationships (depending on the NO_AFFINE_USER_IDS Gateway capability), and any guild presences sent at startup |
lazy_private_channels | array[channel object] | Additional DMs and group DMs the user is participating in, omitted from Ready because they were already in client state cache |
disclose | array[string] | Upcoming changes that the client should disclose to the user |
1 See the gateway guild object documentation for more information about included data.
Supplemental Guild Structure
Field | Type | Description |
---|---|---|
id | snowflake | The ID of the guild |
voice_states | array[voice state object] | States of members currently in voice channels |
Resumed
Sent when a client has sent a resume payload to the Gateway (for resuming existing sessions). Signifies the end of event replaying.
Resumed Structure
Field | Type | Description |
---|---|---|
_trace | array[string] | An array of stringified JSON values representing the connection trace, used for debugging |
Example Resumed
{"_trace": ["[\"gateway-prd-us-east1-c-6w69\",{\"micros\":4493,\"calls\":[\"id_created\",{\"micros\":0,\"calls\":[]},\"session_lookup_time\",{\"micros\":4163,\"calls\":[]},\"session_lookup_finished\",{\"micros\":17,\"calls\":[]},\"discord-sessions-prd-2-31\",{\"micros\":66}]}]"]}
Authentication
Auth Session Change
Sent when the current session's associated auth session ID changes.
Auth Session Change Structure
Field | Type | Description |
---|---|---|
auth_session_id_hash | string | The hash of the auth session ID corresponding to the auth token used to connect |
Authenticator Create
Sent when a WebAuthn authenticator is created. The inner payload is an authenticator object.
Authenticator Update
Sent when a WebAuthn authenticator is updated. The inner payload is an authenticator object.
Authenticator Delete
Sent when a WebAuthn authenticator is deleted.
Authenticator Delete Structure
Field | Type | Description |
---|---|---|
id | string | The ID of the authenticator |
type | string | The type of authenticator |
Application Commands
Application Command Permissions Update
Sent when an application command's permissions are updated. The inner payload is an application command permissions object.
Auto Moderation
Auto Moderation Rule Create
Sent when a rule is created. The inner payload is an automod rule object. Requires the MANAGE_GUILD
permission.
Auto Moderation Rule Update
Sent when a rule is updated. The inner payload is an automod rule object. Requires the MANAGE_GUILD
permission.
Auto Moderation Rule Delete
Sent when a rule is deleted. The inner payload is an automod rule object. Requires the MANAGE_GUILD
permission.
Auto Moderation Action Execution
Sent when a rule is triggered and an action is executed (e.g. message is blocked). Requires the MANAGE_GUILD
permission.
Auto Moderation Action Execution Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild where the action was executed |
action | automod action object | The action that was executed |
rule_id | snowflake | The ID of the rule that was triggered |
rule_trigger_type | integer | The trigger type of the rule that was triggered |
user_id | snowflake | The ID of the user which generated the content that triggered the rule |
channel_id? | snowflake | The ID of the channel in which the user content was posted |
message_id? | snowflake | The ID of the message that triggered the rule |
alert_system_message_id? | snowflake | The ID of the AutoMod system message posted as a result of this action |
content | string | The user message content |
matched_keyword | ?string | The word or phrase configured that triggered the rule |
matched_content | ?string | The substring in content that triggered the rule |
Auto Moderation Mention Raid Detection
Sent when a mention raid is detected. Requires the MANAGE_GUILD
permission.
Auto Moderation Mention Raid Detection Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild where the mention raid was detected |
decision_id | string | The ID of the decision that was executed |
suspicious_mention_activity_until | ISO8601 timestamp | When the mention activity restrictions will end |
Calls
Call Create
Sent when a user creates a call in a private channel, or to inform the client of an existing call after a Request Call Connect.
Call Create Structure
Field | Type | Description |
---|---|---|
channel_id | snowflake | The ID of the private channel this call is occuring in |
message_id | snowflake | The ID of the message associated with the call |
region | string | The voice region ID the call is hosted from |
ringing | array[snowflake] | The IDs of the users that are being rung to join the call |
voice_states | array[voice state object] | The voice states of the users already in the call |
Call Update
Sent when metadata about a call changes.
Call Update Structure
Field | Type | Description |
---|---|---|
channel_id | snowflake | The ID of the private channel this call is occuring in |
message_id | snowflake | The ID of the message associated with the call |
region | string | The voice region ID the call is hosted from |
ringing | array | The IDs of the users that are being rung to join the call |
Call Delete
Sent when a call is deleted, or becomes unavailable due to an outage.
Call Delete Structure
Field | Type | Description |
---|---|---|
channel_id | snowflake | The ID of the private channel this call is occuring in |
unavailable? | boolean | Whether the call is unavailable due to an outage |
Channels
Channel Create
Sent when a new guild channel is created, relevant to the current user. The inner payload is a channel object.
Channel Update
Sent when a channel is updated. The inner payload is a channel object. This is not sent when the field last_message_id
or status
is altered.
To keep track of the last_message_id
changes, you must listen for Message Create events (or Thread Create events for thread-only channels).
To keep track of the status
changes, you must listen for Voice Channel Status Update events.
This event may reference roles or guild members that no longer exist in a guild.
Channel Delete
Sent when a channel relevant to the current user is deleted. The inner payload is a channel object.
Channel Statuses
Sent in response to Request Channel Statuses. Contains the statuses for all voice channels that have one set.
Channel Statuses Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
channels | array[channel status object] | The voice channels with statuses |
Channel Status Structure
Field | Type | Description |
---|---|---|
id | snowflake | The ID of the channel |
status | string | The status of the voice channel (max 500 characters) |
Voice Channel Status Update
Sent when a voice channel's status is updated.
Voice Channel Status Update Structure
Field | Type | Description |
---|---|---|
id | snowflake | The ID of the voice channel |
guild_id | snowflake | The ID of the guild |
status | ?string | The status of the voice channel (max 500 characters) |
Channel Pins Update
Sent when a message is pinned or unpinned in a text channel. This is not sent when a pinned message is deleted.
Channel Pins Update Structure
Field | Type | Description |
---|---|---|
guild_id? | snowflake | The ID of the guild |
channel_id | snowflake | The ID of the channel |
last_pin_timestamp? | ?ISO8601 timestamp | When the most recent pinned message was pinned |
Channel Recipient Add
Sent when a user is added to a group direct message channel.
Channel Recipient Add Structure
Field | Type | Description |
---|---|---|
channel_id | snowflake | The ID of the channel |
user | partial user object | The user who was added |
Channel Recipient Remove
Sent when a user is removed from a group direct message channel.
Channel Recipient Remove Structure
Field | Type | Description |
---|---|---|
channel_id | snowflake | The ID of the channel |
user | partial user object | The user who was removed |
DM Settings Upsell Show
May be sent when a user rejects a message request.
DM Settings Upsell Show Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
Thread Create
Sent when a thread is created, relevant to the current user, or when the current user is added to a thread. The inner payload is a channel object.
- When a thread is created, includes an additional
newly_created
boolean field. - When being added to an existing private thread, includes the optional
member
field.
Thread Create Structure Extra Fields
Field | Type | Description |
---|---|---|
newly_created? | boolean | Whether the thread was just created |
Thread Update
Sent when a thread is updated. The inner payload is a channel object. This is not sent when the field last_message_id
is altered. To keep track of the last_message_id
changes, you must listen for Message Create events.
Thread Delete
Sent when a thread relevant to the current user is deleted. The inner payload is a subset of the channel object, containing just the id
, guild_id
, parent_id
, and type
fields.
Thread List Sync
Sent to sync a guild's active thread list, or to sync specific channel lists when the current user gains access to a channel within a guild.
For bots, all active threads are synced at startup. For user accounts, only joined threads are synced, and the full list is sent through this event on subscription.
Thread List Sync Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
channel_ids? | array[snowflake] | The parent channel IDs whose threads are being synced (may contain channel IDs that have no active threads so you know to clear that data); if omitted, then threads were synced for the entire guild |
threads | array[channel object] | All active threads in the given channels that the current user can access |
members | array[thread member object] | All thread member objects from the synced threads for the current user, indicating which threads the current user has been added to |
Thread Member Update
Sent when the thread member object for the current user is updated. The inner payload is a thread member object with an extra guild_id
field. For bots, his event largely is just a signal that you are a member of the thread. See the threads docs for more details.
Thread Member Update Structure Extra Fields
Field | Type | Description |
---|---|---|
guild_id | snowflake | the id of the guild |
Thread Members Update
Sent when anyone is added to or removed from a thread. If the current user does not have the GUILD_MEMBERS
Gateway intent, then this event will only be sent if the current user was added to or removed from the thread.
Thread Members Update Structure
Field | Type | Description |
---|---|---|
id | snowflake | The ID of the thread |
guild_id | snowflake | The ID of the guild |
member_count | integer | The approximate number of members in the thread, capped at 50 |
added_members? 1 | array[thread member object] | The users who were added to the thread |
removed_member_ids? | array of snowflakes | The IDs of the users who were removed from the thread |
1 Also include member
and nullable presence
fields.
Friend Suggestions
Friend Suggestion Create
Sent when a friend suggestion is created. The inner payload is a friend suggestion object.
Friend Suggestion Delete
Sent when a friend suggestion is deleted.
Friend Suggestion Delete Structure
Field | Type | Description |
---|---|---|
suggested_user_id | snowflake | The ID of the suggested user |
Guilds
Gateway Guild Object
Guild objects received over the Gateway have extended attributes that are not provided in the REST API.
Gateway Guild Structure
Field | Type | Description |
---|---|---|
joined_at | ISO8601 timestamp | When this guild was joined |
large | boolean | Whether this is considered a large guild |
unavailable? | boolean | Whether the guild is unavailable due to an outage |
geo_restricted? 6 | boolean | Whether the guild is not available in your current region |
member_count | integer | Total number of members in this guild |
voice_states 4 | array[voice state object] | States of members currently in voice channels |
members 1 | array[guild member object] | Members in the guild |
channels | array[channel object] | Channels in the guild |
threads 3 | array[channel object] | All active threads in the guild that current user has permission to view |
presences 2 | array[presence object] | Presences of included guild members; will only include non-offline members for large guilds |
stage_instances | array[stage instance object] | Stage instances in the guild |
guild_scheduled_events | array[guild scheduled event object] | Scheduled events in the guild |
data_mode 5 | string | The data mode for this object |
properties 5 | partial guild object | The properties of the guild; an otherwise-normal guild object that is missing the below fields |
stickers | array[sticker object] | Custom guild stickers |
roles | array[role object] | Roles in the guild |
emojis | array[emoji object] | Custom guild emojis |
premium_subscription_count | integer | The number of premium subscriptions (boosts) the guild currently has |
1 For bots without the GUILD_PRESENCES
Gateway intent, user accounts, or guilds with over 75k members, this will only include the client's member and users in voice channels. User accounts additionally receive friends and implicit relationships (depending on the NO_AFFINE_USER_IDS
Gateway capability), as well as users they have an open DM with.
2 User accounts only receive presences for non-offline friends and implicit relationships (depending on the NO_AFFINE_USER_IDS
Gateway capability), as well as users they have an open DM with. Bots with the GUILD_PRESENCES
Gateway intent receive all presences.
3 User accounts are only synced threads they have been added to. Bots are synced all threads.
4 Omitted when using the PRIORITIZED_READY_PAYLOAD
Gateway capability.
5 Requires the CLIENT_STATE_V2
Gateway capability. Without the capability, the properties
field will be merged into the main object, along with the rest of the extended attributes.
6 Geo-restricted guilds will also be marked as unavailable and will not be joinable or accessable.
Unavailable Guild Object
A partial guild object. Represents an offline guild, or a guild the client is not connected to yet.
Unavailable Guild Structure
Field | Type | Description |
---|---|---|
id | snowflake | The ID of the guild |
unavailable? | boolean | Whether the guild is unavailable due to an outage |
geo_restricted? | boolean | Whether the guild is not available in your current region |
Example Unavailable Guild
{"id": "41771983423143937","unavailable": true}
Data Mode
Value | Description |
---|---|
full | The full guild object is sent |
partial | Guild data already in the client state cache is omitted |
unavailable | The guild is unavailable due to an outage |
Guild Create
This event can be sent in three different scenarios:
- When a bot is initially connecting, to lazily load and backfill information for all unavailable guilds sent in the Ready event. Guilds that are unavailable due to an outage or geo-restricted will send a Guild Delete event.
- When a Guild becomes available again to the client.
- When the current user joins a new Guild.
The inner payload can be:
- An available guild: a Gateway guild object.
- An unavailable guild: an unavailable guild object.
Guild Update
Sent when a guild is updated. The inner payload is a guild object.
Guild Delete
Sent when a guild becomes or was already unavailable due to an outage, or when the user leaves or is removed from a guild. The inner payload is an unavailable guild object. If the unavailable
field is not set, the user was removed from the guild.
Guild Audit Log Entry Create
Sent when a guild audit log entry is created. The inner payload is an Audit Log Entry object. Requires the VIEW_AUDIT_LOG
permission.
Guild Ban Add
Sent when a user is banned from a guild.
Guild Ban Add Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
user | partial user object | The banned user |
Guild Ban Remove
Sent when a user is unbanned from a guild.
Guild Ban Remove Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
user | partial user object | The unbanned user |
Guild Emojis Update
Sent when a guild's emojis have been updated.
Guild Emojis Update Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
emojis | array[emoji object] | The emojis in the guild |
Guild Stickers Update
Sent when a guild's stickers have been updated.
Guild Stickers Update Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
stickers | array[sticker object] | The stickers in the guild |
Guild Join Request Create
Sent when a user creates a guild join request. Requires the KICK_MEMBERS
permission for users other than the current user.
Guild Join Request Create Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
request | guild join request object | The created join request |
status | string | The status of the join request |
Guild Join Request Update
Sent when a guild join request is updated. Requires the KICK_MEMBERS
permission for users other than the current user.
Guild Join Request Update Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
request | guild join request object | The updated join request |
status | string | The status of the join request |
Guild Join Request Delete
Sent when a guild join request is deleted. Requires the KICK_MEMBERS
permission for users other than the current user.
Guild Join Request Delete Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
id | snowflake | The ID of the join request |
user_id | snowflake | The ID of the user who created the join request |
Guild Member Add
Sent when a new user joins a guild. The inner payload is a guild member object with an extra guild_id
key:
For user accounts, this event is only sent for themselves. Users are not automatically subscribed to friends and implicit relationships or users they have an open DM with upon them joining.
Guild Member Add Extra Fields
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
Guild Member Remove
Sent when a user is removed from a guild (leave/kick/ban).
For user accounts, this event is only sent for themselves, members they are subscribed to, and in response to actions committed by the user. Users are automatically subscribed to friends and implicit relationships (depending on the NO_AFFINE_USER_IDS
Gateway capability), as well as users they have an open DM with.
Guild Member Remove Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
user | user object | The removed user |
Guild Member Update
Sent when a guild member is updated. This will also fire when the user object of a guild member changes. Optional fields will only be included if changed.
For user accounts, this event is only sent for members they are subscribed to, and in response to actions committed by the user. Users are automatically subscribed to friends and implicit relationships (depending on the NO_AFFINE_USER_IDS
Gateway capability), as well as users they have an open DM with.
Guild Member Update Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
user | partial user object | The user this guild member represents |
nick? | ?string | The guild-specific nickname of the member (1-32 characters) |
avatar | ?string | The member's guild avatar hash |
avatar_decoration_data? | ?avatar decoration data object | The member's guild avatar decoration |
roles | array[snowflake] | The role IDs assigned to this member |
joined_at | ISO8601 timestamp | When the user joined the guild |
premium_since | ?ISO8601 timestamp | When the member subscribed to (started boosting) the guild |
deaf? | boolean | Whether the member is deafened in voice channels |
mute? | boolean | Whether the member is muted in voice channels |
pending? 1 | boolean | Whether the member has not yet passed the guild's member verification requirements |
communication_disabled_until 2 | ?ISO8601 timestamp | when the user's timeout will expire and the user will be able to communicate in the guild again, null or a time in the past if the user is not timed out |
flags | integer | The member's flags |
1 Won't be included in contexts that are impossible for a pending member to exist in.
2 If the value is a time in the past, the member's timeout has expired and they can communicate again. An event will not be sent when this happens.
Guild Members Chunk
Sent in response to Request Guild Members.
You can use the chunk_index
and chunk_count
to calculate how many chunks are left for your request.
Guild Members Chunk Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
members | array[guild member object] | Chunked guild members |
chunk_index | integer | The chunk index in the expected chunks for this response (0 <= chunk_index < chunk_count) |
chunk_count | integer | The total number of expected chunks for this response |
not_found? | array | The passed IDs that were not found |
presences? | array[presence object] | The presences of the returned members, if requested |
nonce? | string | The nonce used in Request Guild Members or Search Recent Members, if any |
Guild Role Create
Sent when a guild role is created.
Guild Role Create Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
role | role object | The role created |
Guild Role Update
Sent when a guild role is updated.
Guild Role Update Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
role | role object | The role updated |
Guild Role Delete
Sent when a guild role is deleted.
Guild Role Delete Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
role_id | snowflake | The ID of the role |
Guild Scheduled Events
Guild Scheduled Event Create
Sent when a guild scheduled event is created. The inner payload is a guild scheduled event object.
Guild Scheduled Event Update
Sent when a guild scheduled event is updated. The inner payload is a guild scheduled event object.
Guild Scheduled Event Delete
Sent when a guild scheduled event is deleted. The inner payload is a guild scheduled event object.
Guild Scheduled Event User Add
Sent when a user has subscribed to a guild scheduled event.
Guild Scheduled Event User Add Structure
Field | Type | Description |
---|---|---|
guild_scheduled_event_id | snowflake | The ID of the guild scheduled event |
user_id | snowflake | The ID of the subscribed user |
guild_id | snowflake | The ID of the guild |
Guild Scheduled Event User Remove
Sent when a user has unsubscribed from a guild scheduled event.
Guild Scheduled Event User Remove Structure
Field | Type | Description |
---|---|---|
guild_scheduled_event_id | snowflake | The ID of the guild scheduled event |
user_id | snowflake | The ID of the subscribed user |
guild_id | snowflake | The ID of the guild |
Guild Soundboard
Guild Soundboard Sound Create
Sent when a guild soundboard sound is created. The inner payload is a soundboard sound object.
Guild Soundboard Sound Update
Sent when a guild soundboard sound is updated. The inner payload is a soundboard sound object.
Guild Soundboard Sound Delete
Sent when a guild soundboard sound is deleted.
Guild Soundboard Sound Delete Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
sound_id | snowflake | The ID of the soundboard sound |
Soundboard Sounds
Sent in response to Request Soundboard Sounds.
Soundboard Sounds Event Fields
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the source guild |
soundboard_sounds | array[soundboard sound object] | Custom guild soundboard sounds |
Integrations
Guild Integrations Update
Sent when a guild integration is updated. This is sent in addition to one of the below events.
Guild Integrations Update Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild whose integrations were updated |
Integration Create
Sent when an integration is created. The inner payload is an integration object with an additional guild_id
key:
Integration Create Structure Extra Fields
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
Integration Update
Sent when an integration is updated. The inner payload is an integration object with an additional guild_id
key:
Integration Update Structure Extra Fields
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
Integration Delete
Sent when an integration is deleted.
Integration Delete Structure
Field | Type | Description |
---|---|---|
id | snowflake | The ID of the integration |
guild_id | snowflake | The ID of the guild |
application_id? | snowflake | The ID of the integrated OAuth2 application, if any |
Invites
Invite Create
Sent when a new invite to a guild channel is created. Requires the MANAGE_CHANNELS
permission.
Invite Create Structure
Field | Type | Description |
---|---|---|
code | string | The invite code (unique ID) |
type | integer | The type of invite |
channel_id | snowflake | The ID of the channel the invite is for |
guild_id | snowflake | The ID of the guild this invite is for |
inviter? | partial user object | The user who created the invite |
target_type? | integer | The type of target for this guild invite |
target_user? | partial user object | The user whose stream to display for this voice channel stream invite |
target_application? | partial application object | The embedded application to open for this voice channel embedded application invite |
expires_at | ?ISO8601 timestamp | The expiry date of the invite, if it expires |
created_at | ISO8601 timestamp | When this invite was created |
uses | integer | Number of times this invite has been used |
max_uses | integer | Max number of times this invite can be used |
max_age | integer | Duration (in seconds) after which the invite expires |
temporary | boolean | Whether this invite only grants temporary membership |
Invite Delete
Sent when a guild invite is deleted. Requires the MANAGE_CHANNELS
permission.
Invite Delete Structure
Field | Type | Description |
---|---|---|
code | string | The invite code (unique ID) |
channel_id | snowflake | The ID of the channel the invite is for |
guild_id | snowflake | The ID of the guild this invite is for |
Messages
Message Object Extra Fields
Field | Type | Description |
---|---|---|
guild_id? 1 | snowflake | The ID of the guild the message was sent in |
member? 1 2 | partial guild member object | Guild member data for this message's author |
mentions 1 | array[user object] | Users specifically mentioned in the message, with an extra member key representing guild member data |
1 Ephemeral messages will not include these fields.
2 Messages sent by webhooks will not include this field, as webhooks are not guild members.
Message Create
Sent when a message is created. The inner payload is a message object with the extra structure above.
Message Update
Sent when a message is updated. The inner payload is a message object with the extra structure above.
Message Delete
Sent when a message is deleted.
Message Delete Structure
Field | Type | Description |
---|---|---|
id | snowflake | The ID of the message |
channel_id | snowflake | The ID of the channel |
guild_id? | snowflake | The ID of the guild |
Message Delete Bulk
Sent when multiple messages are deleted at once.
Message Delete Bulk Structure
Field | Type | Description |
---|---|---|
ids | array[snowflake] | The IDs of the removed messages |
channel_id | snowflake | The ID of the channel |
guild_id? | snowflake | The ID of the guild |
Message Poll Vote Add
Sent when a user votes on a poll. If the poll allows multiple selection, one event will be sent per answer.
Message Poll Vote Add Fields
Field | Type | Description |
---|---|---|
user_id | snowflake | ID of the user |
channel_id | snowflake | ID of the channel |
message_id | snowflake | ID of the message |
guild_id? | snowflake | ID of the guild |
answer_id | integer | ID of the answer |
Message Poll Vote Remove
Sent when a user removes their vote on a poll. If the poll allows for multiple selections, one event will be sent per answer.
Message Poll Vote Remove Fields
Field | Type | Description |
---|---|---|
user_id | snowflake | ID of the user |
channel_id | snowflake | ID of the channel |
message_id | snowflake | ID of the message |
guild_id? | snowflake | ID of the guild |
answer_id | integer | ID of the answer |
Message Reaction Add
Sent when a user adds a reaction to a message.
Message Reaction Add Structure
Field | Type | Description |
---|---|---|
user_id | snowflake | The ID of the user |
channel_id | snowflake | The ID of the channel |
message_id | snowflake | The ID of the message |
message_author_id | snowflake | The ID of the message author |
guild_id? | snowflake | The ID of the guild |
member? | member object | The member who reacted |
emoji | partial emoji object | The emoji used to react |
type | integer | The type of reaction |
burst_colors? | array[string] | The hex-encoded colors to render the burst reaction with |
Message Reaction Add Many
Sent when multiple users add reactions to a message in a short period of time.
Message Reaction Add Many Structure
Field | Type | Description |
---|---|---|
channel_id | snowflake | The ID of the channel |
message_id | snowflake | The ID of the message |
guild_id? | snowflake | The ID of the guild |
reactions | array[debounced reaction object] | The reactions added to the message |
Debounced Reaction Structure
Field | Type | Description |
---|---|---|
users | array[snowflake] | The IDs of the users who reacted with this emoji |
emoji | partial emoji object | The emoji used to react |
Message Reaction Remove
Sent when a user removes a reaction from a message.
Message Reaction Remove Structure
Field | Type | Description |
---|---|---|
user_id | snowflake | The ID of the user |
channel_id | snowflake | The ID of the channel |
message_id | snowflake | The ID of the message |
guild_id? | snowflake | The ID of the guild |
emoji | a partial emoji object | The emoji used to react |
type | integer | The type of reaction |
Message Reaction Remove All
Sent when a user explicitly removes all reactions from a message.
Message Reaction Remove All Structure
Field | Type | Description |
---|---|---|
channel_id | snowflake | The ID of the channel |
message_id | snowflake | The ID of the message |
guild_id? | snowflake | The ID of the guild |
Message Reaction Remove Emoji
Sent when a user removes all instances of a given emoji from the reactions of a message.
Message Reaction Remove Emoji Structure
Field | Type | Description |
---|---|---|
channel_id | snowflake | The ID of the channel |
message_id | snowflake | The ID of the message |
guild_id? | snowflake | The ID of the guild |
emoji | partial emoji object | The emoji that was removed |
Recent Mention Delete
Sent when a message that mentioned the current user in the last week is acknowledged and deleted.
Recent Mention Delete Structure
Field | Type | Description |
---|---|---|
message_id | snowflake | The ID of the message |
Last Messages
Sent in response to Request Last Messages.
Last Messages Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
messages | array[message object] | Last messages of the requested channels |
OAuth2
OAuth2 Token Revoke
Sent when an OAuth2 application is deauthorized.
OAuth2 Token Revoke Structure
Field | Type | Description |
---|---|---|
access_token | string | The access token that was revoked |
application_id | snowflake | The OAuth2 application whose authorization was revoked |
Presence
Presence Update
This event is sent when a user's presence or info, such as name or avatar, is updated. The inner payload is a presence object.
For user accounts, this event is only sent for presences they are subscribed to. Users are automatically subscribed to the overall user presence and every per-guild presence of friends and implicit relationships (depending on the NO_AFFINE_USER_IDS
Gateway capability), as well as every per-guild presences of users they have an open DM with.
Relationships
Relationship Add
Sent when a relationship is created, relevant to the current user. Inner payload is a relationship object.
Relationship Add Structure Extra Fields
Field | Type | Description |
---|---|---|
should_notify? | boolean | Whether the client should notify the user of this relationship's creation |
Relationship Update
Sent when a relationship is updated, relevant to the current user (e.g. friend nickname changed).
Relationship Update Structure
Field | Type | Description |
---|---|---|
id | snowflake | The ID of the target user |
type | integer | The type of relationship |
nickname | string | The nickname of the user in this relationship (1-32 characters) |
is_spam_request? 1 | boolean | Whether the relationship is flagged as spam (default false) |
1 Only applicable to relationships of type INCOMING_REQUEST
.
Relationship Remove
Sent when a relationship is removed, relevant to the current user.
Relationship Remove Structure
Field | Type | Description |
---|---|---|
id | snowflake | The ID of the target user |
type | integer | The type of relationship |
nickname | string | The nickname of the user in this relationship (1-32 characters) |
is_spam_request? 1 | boolean | Whether the relationship is flagged as spam (default false) |
1 Only applicable to relationships of type INCOMING_REQUEST
.
Stage Instances
Stage Instance Create
Sent when a stage instance is created (i.e. the stage is now "live"). The inner payload is a stage instance object.
Stage Instance Update
Sent when a stage instance is updated. The inner payload is a stage instance object.
Stage Instance Delete
Sent when a stage instance is deleted (i.e. the stage has been closed). The inner payload is a stage instance object.
Typing
Typing Start
Sent when a user starts typing in a channel.
Typing Start Structure
Field | Type | Description |
---|---|---|
channel_id | snowflake | id of the channel |
guild_id? | snowflake | id of the guild |
user_id | snowflake | id of the user |
timestamp | integer | unix time (in seconds) of when the user started typing |
member? | member object | the member who started typing if this happened in a guild |
Current User
User Update
Sent when properties about the current user change. Inner payload is a user object.
User Application Remove
Sent when the current user uninstalls an application.
User Application Remove Structure
Field | Type | Description |
---|---|---|
application_id | snowflake | The ID of the application |
User Connections Update
Sent when the current user has their connections updated. Inner payload is either a connection object, or the following object:
User Connections Update Structure
Field | Type | Description |
---|---|---|
user_id | snowflake | The ID of the current user |
User Note Update
Sent when a note the current user has on another user is modified.
User Note Update Structure
Field | Type | Description |
---|---|---|
id | snowflake | The ID of the user |
note | string | The new note for the user |
User Settings Update
Sent when the client settings are modified. Inner payload is a user settings object.
User Required Action Update
Sent when a user must complete a certain action (such as verifying their phone number) before continuing to use Discord.
User Required Action Update Structure
Field | Type | Description |
---|---|---|
required_action | ?string | The action a user is required to take before continuing to use Discord, null if an action is no longer required |
Voice
Voice State Update
Sent when someone joins/leaves/moves voice channels or calls. Inner payload is a voice state object.
Voice Server Update
Sent when a guild or call's voice server is updated. This is sent when initially connecting to voice, and when the current voice instance fails over to a new server.
Voice Server Update Structure
Field | Type | Description |
---|---|---|
token | string | The voice connection token |
guild_id | ?snowflake | The guild this voice server update is for |
channel_id? | snowflake | The private channel this voice server update is for |
endpoint | ?string | The voice server host |
Example Voice Server Update Payload
{"token": "my_token","guild_id": "41771983423143937","endpoint": "smart.loyal.discord.media:443"}
Voice Channel Effect Send
Sent when someone sends an effect, such as an emoji reaction or a soundboard sound, in a voice channel the current user is connected to.
Voice Channel Effect Send Structure
Field | Type | Description |
---|---|---|
channel_id | snowflake | The ID of the channel the effect was sent in |
guild_id | snowflake | The ID of the guild the effect was sent in |
user_id | snowflake | The ID of the user who sent the effect |
animation_type | ?integer | The type of emoji animation |
animation_id | integer | The ID of the emoji animation (0-20) |
emoji | ?partial emoji object | The emoji sent, if applicable |
sound_id? | snowflake | The ID of the soundboard sound |
sound_volume? | float | The volume of the soundboard sound (represented as a float from 0 to 1) |
Example Voice Channel Effect Send Payload
{"guild_id": "839502008108580904","animation_id": 0,"animation_type": 1,"channel_id": "850360749460553769","emoji": {"animated": false,"id": null,"name": "🦆"},"sound_id": 1,"sound_volume": 1,"user_id": "852892297661906993"}
Webhooks
Webhooks Update
Sent when a guild channel's webhook is created, updated, or deleted.
Webhooks Update Structure
Field | Type | Description |
---|---|---|
guild_id | snowflake | The ID of the guild |
channel_id | snowflake | The ID of the channel |
Interactions
Interaction Create
Sent when a user uses an Application Command or Message Component. Inner payload is an Interaction.
Session Start Limit Object
Session Start Limit Structure
Field | Type | Description |
---|---|---|
total | integer | The total number of session starts the current user is allowed |
remaining | integer | The remaining number of session starts the current user is allowed |
reset_after | integer | The number of milliseconds after which the limit resets |
max_concurrency | integer | The number of identify requests allowed per 5 seconds |
Endpoints
Get Gateway
GET
/gateway
Returns an object with a single valid WebSocket URL, which the client can use for Connecting. Clients should cache this value and only call this endpoint to retrieve a new URL if they are unable to properly establish a connection using the cached version of the URL.
Response Body
Field | Type | Description |
---|---|---|
url | string | The WebSocket URL that can be used for connecting to the Gateway |
Example Response
{"url": "wss://gateway.discord.gg/"}
Get Gateway Bot
GET
/gateway/bot
Returns an object based on the information in Get Gateway, plus additional metadata that can help during the operation of large or sharded bots. Unlike Get Gateway, this route should not be cached for extended periods of time as the value is not guaranteed to be the same per-call, and changes as the user joins/leaves guilds.
JSON Response
Field | Type | Description |
---|---|---|
url | string | The WebSocket URL that can be used for connecting to the Gateway |
shards | integer | The recommended number of shards to use when connecting |
session_start_limit | session start limit object | Information on the current session start limit |
Example Response
{"url": "wss://gateway.discord.gg/","shards": 9,"session_start_limit": {"total": 1000,"remaining": 999,"reset_after": 14400000,"max_concurrency": 1}}