RPC over IPC
Discord’s RPC server supports IPC (Inter-Process Communication) as transport for native applications and games. This allows high-performance, local communication with the Discord client without requiring network-level overhead.IPC Path
On Linux/macOS, Discord resolves the IPC prefix in this order:
XDG_RUNTIME_DIR, TMPDIR, TMP, TEMP, then /tmp as a final fallback.
Connecting to IPC
To begin a session, the application must open the IPC socket and send aHANDSHAKE opcode.
Handshake Payload
The payload is a JSON object containing the RPC version and your application’s client ID.Example Handshake
FRAME (Opcode 1) containing the READY event.
Once the handshake is complete, all subsequent requests and responses use the FRAME opcode. The internal structure of these frames follows the standard RPC Payload structure
Opcodes
RPC over WebSocket (Deprecated)
RPC over WebSocket (Deprecated)
This is a deprecated way, which is only available for old participants of private beta. It is preferable to use RPC that uses IPC.
Connecting to WebSocket
The local RPC server runs on localhost (127.0.0.1) and is set up to process WebSocket connections and proxy API requests.For WebSocket connections, the connection is always ws://127.0.0.1:PORT/?v=VERSION&client_id=CLIENT_ID&encoding=ENCODING:CLIENT_IDis the client ID of the application accessing the RPC Server.VERSIONis the version of the RPC Server.PORTis the port of the RPC Server.ENCODINGis the type of encoding for this connection to use.jsonandetfare supported.
SCHEME://HOST[:PORT], where SCHEME is typically https or http, HOST is your domain or ip, and PORT is the port of the webserver from which the user will be connecting (omitted for ports 80 and 443). For example, https://discord.com would be used if the user were connecting from https://discord.com/some/page/url.If you’re connecting to the RPC server from within a non-browser application (like a game), you just need to make sure that the origin is sent with the upgrade request when connecting to the WebSocket. For local testing, we recommend testing with an origin like https://localhost. For production apps, we recommend setting the origin to your company/game’s domain, for example https://discord.com.RPC Server Ports
The port range for Discord’s local RPC server is [6463, 6472]. Since the RPC server runs locally, there’s a chance it might not be able to obtain its preferred port when it tries to bind to one. For this reason, the local RPC server will pick one port out of a range of these 10 ports, trying sequentially until it can bind to one. When implementing your client, you should perform the same sequential checking to find the correct port to connect to.RPC Versions
Restrictions
For connections to the RPC server, a list of approved testers is used to restrict access while you’re still developing. You can invite up to 50 people. For applications/games not approved, we limit you to creating 10 guilds and 10 channels. This limit is raised to virtually unlimited after approval.Payloads
Payload Structure
Authenticating
In order to call any commands over RPC, you must be authenticated or you will receive a code4006 error response. To begin, call AUTHORIZE:
RPC Authorize Example
AUTHORIZE command returns a code that you can exchange with a POST to https://discord.com/api/oauth2/token containing the standard OAuth2 body parameters for the token exchange. The token endpoint on our API will return an access_token that can be sent with AUTHENTICATE:
RPC Authenticate Example
Commands and Events
Commands are requests made to the RPC socket by a client.RPC Commands
Events are payloads sent over the socket to a client that correspond to events in Discord.
RPC Events
AUTHORIZE
Used to authenticate a new client with your app. By default this pops up a modal in-app that asks the user to authorize access to your app. We currently do not allow access to RPC for unapproved apps without being on the game’s list of testers. We grant 50 testing spots, which should be ample for development. After approval, this restriction is removed and your app will be accessible to anyone. We also have an RPC token system to bypass the user authorization modal. This is usable by approved games as well as by users on a game’s list of testers, and also disallows use of themessages.read scope. If you have been granted access, you can send a POST request to https://discord.com/api/oauth2/token/rpc with your application’s client_id and client_secret in the body (sent as a url-encoded body, not JSON). You can then pass the returned rpc_token value to the rpc_token field in your RPC authorize request (documented below).
Authorize Argument Structure
Authorize Response Structure
Example Authorize Command Payload
Example Authorize Response Payload
AUTHENTICATE
Used to authenticate an existing client with your app.Authenticate Argument Structure
Authenticate Response Structure
OAuth2 Application Structure
Example Authenticate Command Payload
Example Authenticate Response Payload
GET_GUILDS
Used to get a list of guilds the client is in.Get Guilds Response Structure
Example Get Guilds Command Payload
Example Get Guilds Response Payload
GET_GUILD
Used to get a guild the client is in.Get Guild Argument Structure
Get Guild Response Structure
Example Get Guild Command Payload
Example Get Guild Response Payload
GET_CHANNEL
Used to get a channel the client is in.Get Channel Argument Structure
Get Channel Response Structure
Example Get Channel Command Payload
Example Get Channel Response Payload
GET_CHANNELS
Used to get a guild’s channels the client is in.Get Channels Argument Structure
Get Channels Response Structure
Example Get Channels Command Payload
Example Get Channels Response Payload
SET_USER_VOICE_SETTINGS
Used to change voice settings of users in voice channelsSet User Voice Settings Argument and Response Structure
In the current release, we only support a single modifier of voice settings at a time over RPC. If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously lose the ability to change voice settings. Settings reset to what they were before being changed after the controlling app disconnects. When an app that has previously set voice settings connects, the client will swap to that app’s configured voice settings and lock voice settings again. This is a temporary situation that will be changed in the future.
Pan Object
Example Set User Voice Settings Command Payload
Example Set User Voice Settings Response Payload
SELECT_VOICE_CHANNEL
Used to join and leave voice channels, group dms, or dms. Returns the Get Channel response,null if none.
Select Voice Channel Argument Structure
Example Select Voice Channel Command Payload
Example Select Voice Channel Response Payload
GET_SELECTED_VOICE_CHANNEL
Used to get the client’s current voice channel. There are no arguments for this command. Returns the Get Channel response, ornull if none.
SELECT_TEXT_CHANNEL
Used to join and leave text channels, group dms, or dms. Returns the Get Channel response, ornull if none.
Select Text Channel Argument Structure
GET_VOICE_SETTINGS
Get Voice Settings Response Structure
Voice Settings Input Object
Voice Settings Output Object
Voice Settings Mode Object
Shortcut Key Combo Object
Key Types
Example Get Voice Settings Response Payload
SET_VOICE_SETTINGS
In the current release, we only support a single modifier of voice settings at a time over RPC. If an app changes voice settings, it will lock voice settings so that other apps connected simultaneously lose the ability to change voice settings. Settings reset to what they were before being changed after the controlling app disconnects. When an app that has previously set voice settings connects, the client will swap to that app’s configured voice settings and lock voice settings again. This is a temporary situation that will be changed in the future.
Set Voice Settings Argument and Response Structure
Example Set Voice Settings Command Payload
Example Set Voice Settings Response Payload
SUBSCRIBE
Used to subscribe to events.evt of the payload should be set to the event being subscribed to. args of the payload should be set to the args needed for the event.
Subscribe Response Structure
Example Subscribe Command Payload
Example Subscribe Response Payload
UNSUBSCRIBE
Used to unsubscribe from events.evt of the payload should be set to the event that was subscribed to. args of the payload should be set to the args needed for the previously subscribed event.
Unsubscribe Response Structure
Example Unsubscribe Command Payload
Example Unsubscribe Response Payload
SET_CERTIFIED_DEVICES
Used by hardware manufacturers to send information about the current state of their certified devices that are connected to Discord.Set Certified Devices Argument Structure
Device Object
*These fields are only applicable for
AUDIO_INPUT device types
Vendor Object
Model Object
Device Type
Example Set Certified Devices Command Payload
Example Set Certified Devices Response Payload
SET_ACTIVITY
Used to update a user’s Rich Presence.Set Activity Argument Structure
When using
SET_ACTIVITY, the activity object is limited to a type of Playing (0), Listening (2), Watching (3), or Competing (5).Example Set Activity Payload
SEND_ACTIVITY_JOIN_INVITE
Used to accept an Ask to Join request.Send Activity Join Invite Argument Structure
Example Send Activity Join Invite Payload
CLOSE_ACTIVITY_REQUEST
Used to reject an Ask to Join request.Close Activity Request Argument Structure
Example Close Activity Request Payload
READY
Ready Dispatch Data Structure
RPC Server Configuration Object
Example Ready Dispatch Payload
ERROR
Error Data Structure
Example Error Payload
GUILD_STATUS
Guild Status Argument Structure
Guild Status Dispatch Data Structure
Example Guild Status Dispatch Payload
GUILD_CREATE
No argumentsGuild Create Dispatch Data Structure
Example Guild Create Dispatch Payload
CHANNEL_CREATE
No argumentsChannel Create Dispatch Data Structure
Example Channel Create Dispatch Payload
VOICE_CHANNEL_SELECT
No argumentsVoice Channel Select Dispatch Data Structure
Example Voice Channel Select Dispatch Payload
VOICE_SETTINGS_UPDATE
Voice Settings Argument Structure
No arguments. Dispatches the Get Voice Settings response.Example Voice Settings Dispatch Payload
VOICE_STATE_CREATE/VOICE_STATE_UPDATE/VOICE_STATE_DELETE
Dispatches channel voice state objectsVoice State Argument Structure
Example Voice State Dispatch Payload
VOICE_CONNECTION_STATUS
No argumentsVoice Connection Status Dispatch Data Structure
Voice Connection States
Example Voice Connection Status Dispatch Payload
MESSAGE_CREATE/MESSAGE_UPDATE/MESSAGE_DELETE
Dispatches message objects, with the exception of deletions, which only contains the id in the message object.Message Argument Structure
Example Message Dispatch Payload
SPEAKING_START/SPEAKING_STOP
Speaking Argument Structure
Speaking Dispatch Data Structure
Example Speaking Dispatch Payload
NOTIFICATION_CREATE
No arguments. This event requires therpc.notifications.read OAuth2 scope.
Notification Create Dispatch Data Structure
Example Notification Create Dispatch Payload
ACTIVITY_JOIN
No argumentsActivity Join Dispatch Data Structure
Example Activity Join Dispatch Payload
ACTIVITY_SPECTATE
No argumentsActivity Spectate Dispatch Data Structure
Example Activity Spectate Dispatch Payload
ACTIVITY_JOIN_REQUEST
No argumentsActivity Join Request Data Structure
Example Activity Join Request Dispatch Payload
ACTIVITY_INVITE
No argumentsActivity Invite Dispatch Data Structure
Example Activity Invite Dispatch Payload
CURRENT_USER_UPDATE
No arguments. Dispatches the current user’s profile whenever it changes (avatar, username, etc.).Current User Update Dispatch Data Structure
Example Current User Update Dispatch Payload
RELATIONSHIP_UPDATE
No arguments. Requires therelationships_read OAuth2 scope.
Fired when a relationship is added, updated (e.g. presence change), or removed. When a relationship is removed, type will be 0 (NONE).