Message Resource

Messages are the core of Discord. They are the primary way users communicate with each other, and they can contain text, images, and other media. Embeddable content, such as polls, system messages, and calls are also represented as messages.

Message Object

A message sent in a channel within Discord.

Message Structure
FieldTypeDescription
idsnowflakeThe ID of the message
channel_idsnowflakeThe ID of the channel the message was sent in
guild_id?snowflakeThe ID of the guild the message was sent in
author 1partial user objectThe author of the message
member?partial guild member objectGuild member data for this message's author
content 2stringContents of the message
timestampISO8601 timestampWhen this message was sent
edited_timestamp?ISO8601 timestampwhen this message was last edited
ttsbooleanWhether this message will be read out by TTS
mention_everyonebooleanWhether this message mentions everyone
mentionsarray[user object]Users specifically mentioned in the message
mention_rolesarray[snowflake]Roles specifically mentioned in this message
mention_channels? 3array[partial channel object]Channels specifically mentioned in this message
attachments 2array[attachment object]The attached files
embeds 2array[embed object]Content embedded in the message
reactions?array[reaction object]Reactions on the message
nonce?integer | stringThe message's nonce, used for message deduplication
pinnedbooleanWhether this message is pinned
webhook_id?snowflakeThe ID of the webhook that send the message
typeintegerThe type of message
activity?message activity objectThe rich presence activity the author is inviting users to
application?integration application objectThe application of the message's rich presence activity
application_id?snowflakeThe ID of the application; only send for interaction responses
flags?integerThe message's flags
message_reference? 4message reference objectThe source of a crosspost, snapshot, channel follow add, pin, or reply message
referenced_message? 5 4?message objectThe message associated with the message_reference
message_snapshots? 4array[message snapshot object]The partial message snapshot associated with the message_reference
call?message call objectThe private channel call that prompted this message
interaction? (deprecated)message interaction objectThe interaction the message is responding to
interaction_metadata?message interaction metadata objectThe interaction the message originated from
thread?channel objectThe thread that was started from this message, with the member key representing thread member data
role_subscription_data?message role subscription objectThe role subscription purchase or renewal that prompted this message
purchase_notification?message purchase notification objectThe guild purchase that prompted this message
gift_infomessage gift info objectInformation on the gift that prompted this message
components? 2array[message component object]The message's components (e.g. buttons, select menus)
sticker_items?array[sticker item object]The message's sticker items
stickers?array[sticker object]Extra rich information for the message's sticker items; only available in some contexts
poll? 2poll objectA poll!

1 The author object follows the structure of the user object, but may not be a valid user in the case where the message is generated by a webhook; you can recognize this by checking for the webhook_id key on the message object. In these cases, the below notice about the additional member keys does not apply as webhooks are not guild members.

2 Users must configure (or, in the case of bots, be approved for) the MESSAGE_CONTENT intent to receive non-empty values for these fields in most situations.

3 Not all channel mentions in a message will appear in mention_channels. Only textual channels that are visible to everyone in a lurkable guild will ever be included. Only crossposted messages (via Channel Following) currently include mention_channels at all. If no mentions in the message meet these requirements, this field will not be sent.

4 See the message reference types for more information on which message references have which fields.

5 Only returned for messages with a type of REPLY or THREAD_STARTER_MESSAGE. If the message is a reply but the referenced_message field is not present, the backend did not attempt to fetch the message that was being replied to, so its state is unknown. If the field exists but is null, the referenced message was deleted.

Message Type
ValueNameDescriptionRendered ContentDeletable
0DEFAULTA default message (see below)"{content}"true
1RECIPIENT_ADDA message sent when a user is added to a group DM or thread"{author} added {mentions[0]} to the {group/thread}."false
2RECIPIENT_REMOVEA message sent when a user is removed from a group DM or thread"{author} removed {mentions[0]} from the {group/thread}."false
3CALLA message sent when a user creates a call in a private channelparticipated ? "{author} started a call{ended ? " that lasted {duration}" : " — Join the call"}." : "You missed a call from {author} that lasted {duration}."false
4CHANNEL_NAME_CHANGEA message sent when a group DM or thread's name is changed"{author} changed the {is_forum ? "post title" : "channel name"}: {content}"false
5CHANNEL_ICON_CHANGEA message sent when a group DM's icon is changed"{author} changed the channel icon."false
6CHANNEL_PINNED_MESSAGEA message sent when a message is pinned in a channel"{author} pinned a message to this channel."true
7USER_JOINA message sent when a user joins a guildSee user join message type, obtained via the formula timestamp_ms % 13true
8PREMIUM_GUILD_SUBSCRIPTIONA message sent when a user subscribes to (boosts) a guild"{author} just boosted the server{content ? " {content} times"}!"true
9PREMIUM_GUILD_SUBSCRIPTION_TIER_1A message sent when a user subscribes to (boosts) a guild to tier 1"{author} just boosted the server{content ? " {content} times"}! {guild} has achieved Level 1!"true
10PREMIUM_GUILD_SUBSCRIPTION_TIER_2A message sent when a user subscribes to (boosts) a guild to tier 2"{author} just boosted the server{content ? " {content} times"}! {guild} has achieved Level 2!"true
11PREMIUM_GUILD_SUBSCRIPTION_TIER_3A message sent when a user subscribes to (boosts) a guild to tier 3"{author} just boosted the server{content ? " {content} times"}! {guild} has achieved Level 3!"true
12CHANNEL_FOLLOW_ADDA message sent when a news channel is followed"{author} has added {content} to this channel. Its most important updates will show up here."true
13GUILD_STREAMA message sent when a user starts streaming in a guildtrue
14GUILD_DISCOVERY_DISQUALIFIEDA message sent when a guild is disqualified from discovery"This server has been removed from Server Discovery because it no longer passes all the requirements. Check Server Settings for more details."true
15GUILD_DISCOVERY_REQUALIFIEDA message sent when a guild requalifies for discovery"This server is eligible for Server Discovery again and has been automatically relisted!"true
16GUILD_DISCOVERY_GRACE_PERIOD_INITIAL_WARNINGA message sent when a guild has failed discovery requirements for a week"This server has failed Discovery activity requirements for 1 week. If this server fails for 4 weeks in a row, it will be automatically removed from Discovery."true
17GUILD_DISCOVERY_GRACE_PERIOD_FINAL_WARNINGA message sent when a guild has failed discovery requirements for 3 weeks"This server has failed Discovery activity requirements for 3 weeks in a row. If this server fails for 1 more week, it will be removed from Discovery."true
18THREAD_CREATEDA message sent when a thread is created"{author} started a thread: {content}. See all threads."true
19REPLYA message sent when a user replies to a message"{content}"true
20CHAT_INPUT_COMMANDA message sent when a user uses a slash command"{content}"true
21THREAD_STARTER_MESSAGEA message sent when a thread starter message is added to a thread"{referenced_message?.content}" ?? "Sorry, we couldn't load the first message in this thread"false
22GUILD_INVITE_REMINDERA message sent to remind users to invite friends to a guild"Wondering who to invite?\nStart by inviting anyone who can help you build the server!"true
23CONTEXT_MENU_COMMANDA message sent when a user uses a context menu command"{content}"true
24AUTO_MODERATION_ACTIONA message sent when auto moderation takes an actionSpecial embed rendered from embeds[0]true 1
25ROLE_SUBSCRIPTION_PURCHASEA message sent when a user purchases or renews a role subscription"{author} {is_renewal ? "renewed" : "joined"} {role_subscription.tier_name} and has been a subscriber of {guild} for {role_subscription.total_months_subscribed} month(?s)!"true
26INTERACTION_PREMIUM_UPSELLA message sent when a user is upsold to a premium interaction"{content}"true
27STAGE_STARTA message sent when a stage channel starts"{author} started {content}"true
28STAGE_ENDA message sent when a stage channel ends"{author} ended {content}"true
29STAGE_SPEAKERA message sent when a user starts speaking in a stage channel"{author} is now a speaker."true
30STAGE_RAISE_HANDA message sent when a user raises their hand in a stage channel"{author} requested to speak."true
31STAGE_TOPICA message sent when a stage channel's topic is changed"{author} changed the Stage topic: {content}"true
32GUILD_APPLICATION_PREMIUM_SUBSCRIPTIONA message sent when a user purchases an application premium subscription"{author} upgraded {application ?? "a deleted application"} to premium for this server!"true
33PRIVATE_CHANNEL_INTEGRATION_ADDEDA message sent when a user adds an application to group DM"{author} added {"the {application} app" ?? "a deleted application"}. See our Help Centre for more info."false
34PRIVATE_CHANNEL_INTEGRATION_REMOVEDA message sent when a user removed an application from a group DM"{author} removed {"the {application} app" ?? "a deleted application"}. See our Help Centre for more info."false
35PREMIUM_REFERRALA message sent when a user gifts a premium (Nitro) referral"{content}"true
36GUILD_INCIDENT_ALERT_MODE_ENABLEDA message sent when a user enabled lockdown for the guild"{author} enabled security actions until {content}."true
37GUILD_INCIDENT_ALERT_MODE_DISABLEDA message sent when a user disables lockdown for the guild"{author} disabled security actions."true
38GUILD_INCIDENT_REPORT_RAIDA message sent when a user reports a raid for the guild"{author} reported a raid in {guild}."true
39GUILD_INCIDENT_REPORT_FALSE_ALARMA message sent when a user reports a false alarm for the guild"{author} reported a false alarm in {guild}."true
40GUILD_DEADCHAT_REVIVE_PROMPTA message sent when no one sends a message in the current channel for 1 hour"{content}"true
41CUSTOM_GIFTA message sent when a user buys another user a giftSpecial embed rendered from embeds[0].url and gift_infotrue
42GUILD_GAMING_STATS_PROMPT"{content}"true
43POLLA message sent when a user posts a polltrue
44PURCHASE_NOTIFICATIONA message sent when a user purchases a guild product"{author} has purchased {purchase_notification.guild_product_purchase.product_name}!"true
45VOICE_HANGOUT_INVITEA message sent when a user invites another user to hangout in a voice channelSpecial embed rendered from embeds[0]true
46POLL_RESULTSpecial embed rendered from embeds[0]true
47CHANGELOGA message sent by the Discord Updates account when a new changelog is posted"{content}"true
48NITRO_NOTIFICATIONA message sent when a Nitro promotion is triggeredSpecial embed rendered from contenttrue

1 Can only be deleted by members with the MANAGE_MESSAGES permission.

User Join Message Type

The type of rendered message is determined via converting the message's timestamp to a unix timestamp with millisecond precision, modulo 13.

ValueRendered Content
0"{author} joined the party."
1"{author} is here."
2"Welcome, {author}. We hope you brought pizza."
3"A wild {author} appeared."
4"{author} just landed."
5"{author} just slid into the server."
6"{author} just showed up!"
7"Welcome {author}. Say hi!"
8"{author} hopped into the server."
9"Everyone welcome {author}!"
10"Glad you're here, {author}."
11"Good to see you, {author}."
12"Yay you made it, {author}!"
Message Flags
ValueNameDescription
1 << 0CROSSPOSTEDThis message has been published to subscribed channels (via Channel Following)
1 << 1IS_CROSSPOSTThis message originated from a message in another channel (via Channel Following)
1 << 2SUPPRESS_EMBEDSEmbeds will not be included when serializing this message
1 << 3SOURCE_MESSAGE_DELETEDThe source message for this crosspost has been deleted (via Channel Following)
1 << 4URGENTThis message came from the urgent message system
1 << 5HAS_THREADThis message has an associated thread, with the same ID as the message
1 << 6EPHEMERALThis message is only visible to the user who invoked the interaction
1 << 7LOADINGThis message is an interaction response and the bot is "thinking"
1 << 8FAILED_TO_MENTION_SOME_ROLES_IN_THREADSome roles were not mentioned and added to the thread
1 << 9GUILD_FEED_HIDDENThis message is hidden from the guild's feed
1 << 10SHOULD_SHOW_LINK_NOT_DISCORD_WARNINGThis message contains a link that impersonates Discord
1 << 12SUPPRESS_NOTIFICATIONSThis message will not trigger push and desktop notifications
1 << 13VOICE_MESSAGEThis message's audio attachments are rendered as voice messages
1 << 14HAS_SNAPSHOTThis message has a forwarded message snapshot attached
Example Message
{
"id": "1076229630052270231",
"type": 0,
"content": "guh",
"channel_id": "1029316811088478299",
"author": {
"id": "545581357812678656",
"username": "alien",
"global_name": "Alien",
"avatar": "60387de43133809b083fb0f7458d2708",
"avatar_decoration_data": null,
"discriminator": "0",
"public_flags": 4194432
},
"attachments": [],
"embeds": [],
"mentions": [],
"mention_roles": [],
"pinned": false,
"mention_everyone": false,
"tts": false,
"timestamp": "2023-02-17T19:52:19.184000+00:00",
"edited_timestamp": null,
"flags": 0,
"components": [],
"reactions": [
{
"emoji": { "id": null, "name": "‼️" },
"count": 2,
"count_details": { "burst": 0, "normal": 82 },
"burst_colors": ["#f0ca59", "#4c704f", "#e07f45", "#f0ae59", "#f0bc59", "#f0a059", "#e08e45", "#f0984a"],
"me_burst": false,
"me": false
}
]
}
Example Crossposted Message
{
"id": "1076589465084104805",
"type": 0,
"content": "test",
"channel_id": "909072028911423498",
"author": {
"bot": true,
"id": "999498190359371866",
"username": "Testing Server #News",
"avatar": "47b30f67c7e2c15637936cd180dd681c",
"discriminator": "0000"
},
"attachments": [],
"embeds": [],
"mentions": [],
"mention_roles": [],
"pinned": false,
"mention_everyone": false,
"tts": false,
"timestamp": "2023-02-18T19:42:10.541000+00:00",
"edited_timestamp": null,
"flags": 2,
"components": [],
"webhook_id": "999498190359371866",
"message_reference": {
"type": 0,
"channel_id": "901900332408381450",
"guild_id": "901900332408381449",
"message_id": "1076589456297054320"
}
}

Message Activity Object

A rich presence invite in a message.

Message Activity Structure
FieldTypeDescription
typeintegerThe type of activity request
session_id 1stringThe session ID associated with this activity
party_id?stringThe activity's party ID

1 This field is send-only.

Message Call Object

A call in a private channel.

Message Call Structure
FieldTypeDescription
participantsarray[snowflake]The channel recipients that participated in the call
ended_timestamp 1?ISO8601 timestampWhen the call ended, if it has

1 This is a best-effort marker and may be unexpectedly null in some cases.

Message Interaction Metadata Object

Metadata about the interaction, including the source of the interaction and the relevant guild and users.

Message Interaction Metadata Structure
FieldTypeDescription
idsnowflakeThe ID of the interaction
typeintegerThe type of interaction
name?stringThe name of the application command executed (including subcommands and subcommand groups), present only on APPLICATION_COMMAND interactions
userpartial user objectThe user that initiated the interaction
authorizing_integration_ownersmap[integer, snowflake]IDs for each installation context related to an interaction
original_response_message_id?snowflakeThe ID of the original response message, present only on follow-up messages
interacted_message_id?snowflakeID of the message that contained interactive component, present only on messages created from component interactions
triggering_interaction_metadata?message interaction metadata objectMetadata for the interaction that was used to open the modal, present only on MODAL_SUBMIT interactions

Message Role Subscription Object

A role subscription purchase or renewal.

Message Role Subscription Structure
FieldTypeDescription
role_subscription_listing_idsnowflakeThe ID of the sku and listing that the user is subscribed to
tier_namestringThe name of the tier that the user is subscribed to
total_months_subscribedintegerThe cumulative number of months that the user has been subscribed for
is_renewalbooleanWhether this notification is for a renewal rather than a new purchase

Message Purchase Notification Object

A guild product purchase notification.

Message Purchase Notification Structure
FieldTypeDescription
typeintegerThe type of purchase
guild_product_purchase?guild product purchaseThe guild product purchase that prompted this message
Message Purchase Notification Type

Determines the type of purchase notification.

ValueNameDescription
0GUILD_PRODUCTA guild product purchase
Guild Product Purchase Structure
FieldTypeDescription
listing_idsnowflakeThe ID of the product listing that was purchased
product_namestringThe name of the product that was purchased

Message Gift Info Object

Information on a gift that prompted a message. The relevant gift link is provided in the first embed of the message.

Message Gift Info Structure
FieldTypeDescription
emoji? 1partial emojiThe emoji associated with the gift
sound?message soundboard sound objectThe sound associated with the gift

1 The emoji name and id fields are user-provided and not guaranteed to be valid or accurate. The animated field is never present.

Message Soundboard Sound Structure
FieldTypeDescription
idstringThe ID of the soundboard sound

Message Reference Object

A reference to an originating (replied to) message.

Message references are generic attribution on a message. There are multiple message types that have a message_reference object.

Message Reference Structure
FieldTypeDescription
type? 1integerThe type of message reference (default DEFAULT)
message_id?snowflakeThe ID of the originating message
channel_id 1snowflakeThe ID of the originating channel
guild_id?snowflakeThe ID of the originating channel's guild
fail_if_not_exists? 2booleanWhether to error if the referenced message doesn't exist instead of sending as a normal (non-reply) message (default true)
forward_only? 2 3message forward only objectWhat to include in the forwarded message

1 Optional when creating a reply, but will always be present when receiving this object. In future API versions this will become a required field.

2 This field is send-only.

3 Only applicable to FORWARD type references.

Message Forward Only Structure
FieldTypeDescription
embed_indices?array[integer]The indices of the embeds from the original message to include
attachment_ids?array[snowflake]The IDs of the attachments from the original message to include
Message Reference Type

Determines how associated data is populated.

ValueNameDescriptionCoupled Message Field
0DEFAULTA standard reference used by replies and system messagesreferenced_message?
1FORWARD 1A reference used to point to a message at a point in timemessage_snapshot

1 This can only be used for basic messages, i.e., messages which do not have strong bindings to a non-global entity. Thus it only supports messages with DEFAULT or REPLY types, without any polls, calls, or components. This is subject to change in the future.

Message Snapshot Object

A snapshot of a partial message at a point in time.

Message Snapshot Structure
FieldTypeDescription
messagesnapshot message objectA snapshot of the message when the forward was created
Snapshot Message Structure
FieldTypeDescription
channel_idsnowflakeThe ID of the channel the message was sent in
content 1stringContents of the message
timestampISO8601 timestampWhen this message was sent
edited_timestamp?ISO8601 timestampwhen this message was last edited
attachments 1array[attachment object]The attached files
embeds 1array[embed object]Content embedded in the message
typeintegerThe type of message
flags?integerThe message's flags
components? 1array[message component object]The message's components (e.g. buttons, select menus)

1 Users must configure (or, in the case of bots, be approved for) the MESSAGE_CONTENT intent to receive non-empty values for these fields in most situations.

Example Message Snapshot
{
"message": {
"channel_id": "1029316811088478299",
"content": "guh",
"timestamp": "2023-02-17T19:52:19.184000+00:00",
"edited_timestamp": null,
"attachments": [],
"embeds": [],
"type": 0,
"flags": 0,
"components": []
}
}

Message Types

There are multiple message types that have a message_reference object. Since message references are generic attribution to a previous message, there will be more types of messages which have this information in the future.

Crosspost Messages
  • These are messages that originated from another channel (IS_CROSSPOST flag).
  • These messages have all three fields, with data of the original message that was crossposted.
Forwarded Messages
  • These are messages which capture a snapshot of a message, preventing spoofing or tampering.
  • These messages have an array of message_snapshots field containing a copy of the original message. This copy follows the same structure as a message, but has only the minimal set of fields returned required for context/rendering.
  • A forwarded message can be identified by looking at it's message_reference.type field.
    • Message snapshots will be the message data associated with the forward. Currently only 1 snapshot is supported.
    • Message snapshots are taken at moment the forward message is created, and are immutable; any mutations to the orignal message will not be propagated.
  • Forwards are created by including a message_reference of a FORWARD type when sending a message. When sending, type, message_id, and channel_id are required, and the requester must have VIEW_CHANNEL permissions.
  • You can opt to only include specific attachments and embed in the forward by including the forward_only field in the message_reference.
Channel Follow Add Messages
  • These are automatic messages sent when a channel is followed into the current channel (type 12).
  • These messages have the channel_id and guild_id fields, with data of the followed announcement channel.
Pin Messages
  • These are automatic messages sent when a message is pinned (type 6).
  • These messages have message_id and channel_id, and guild_id if it is in a guild, with data of the message that was pinned.
Reply Messages
  • These are messages replying to a previous message (type 19).
  • These messages have message_id and channel_id, and guild_id if it is in a guild, with data of the message that was replied to. The channel_id and guild_id will be the same as the reply.
  • Replies are created by including a message_reference when sending a message. When sending, only message_id is required.
Thread Created Messages
  • These are automatic messages sent when a public thread is created from an old message or without a message (type 18).
  • These messages have the channel_id and guild_id fields, with data of the created thread channel.
Thread Starter Messages
  • These are the first message in public threads created from messages. They point back to the message in the parent channel from which the thread was started (type 21).
  • These messages have message_id, channel_id, and guild_id.
  • These messages will never have content, embeds, or attachments, mainly just the message_reference and referenced_message fields.
Voice Messages

Voice messages are messages with the VOICE_MESSAGE flag. They have the following properties:

  • They cannot be edited.
  • Only a single audio attachment is allowed. No other attachments, content, embeds, stickers, etc.
  • The attachment has the additional fields duration_secs and waveform.

The waveform is intended to be a preview of the entire voice message, with 1 byte per datapoint encoded in base64. Official clients sample the recording at most once per 100 milliseconds, but will downsample so that no more than 256 datapoints are in the waveform.

Official clients upload a 1 channel, 48000 Hz, 32 kbps Opus stream in an OGG container. The encoding and waveform details are an implementation detail and may change without warning.

Clips

Clips are a special type of attachment that can be sent with a message. They are created by recording a stream and then clipping a portion of the recording.

Clip attachments have the CLIP flag set, and have the additional fields clip_created_at, clip_participants, and optionally title and application.

An attachment can be sent as a clip by specifying the is_clip, clip_created_at, and clip_participant_ids fields, and optionally the title and application_id fields. For an attachment to be a valid clip, it must have a UUID appended to the end of the file in binary format. An example in hexadecimal format is 75 75 69 64 A1 C8 52 99 33 46 4D B8 88 F0 83 F5 7A 75 A5 EF. This can be done with the following pseudocode:

import uuid
with open("cat.mp4", "r+b") as file:
file.seek(0, 2)
file.write(b"uuid")
file.write(uuid.uuid4().bytes)

Followed Channel Object

Followed Channel Structure
FieldTypeDescription
channel_idsnowflakeThe source channel ID
webhook_idsnowflakeCreated target webhook ID

Reaction Object

Reaction Structure
FieldTypeDescription
countintegerTotal amount of times this emoji has been used to react
count_detailsreaction count details objectDetails about the number of times this emoji has been used to react
mebooleanWhether the current user reacted using this emoji
me_burstbooleanWhether the current user burst-reacted using this emoji
emojipartial emoji objectReaction emoji information
burst_colorsarray[string]The hex-encoded colors to render the burst reaction with
Reaction Count Details Structure
FieldTypeDescription
normalintegerAmount of times this emoji has been used to react normally
burstintegerAmount of times this emoji has been used to burst-react
Reaction Type
ValueNameDescription
0NORMALA normal reaction
1BURSTA burst (super) reaction

Embed Object

Embed Structure
FieldTypeDescription
title?stringThe title of the embed (max 256)
type?stringThe type of embed (always rich for sent embeds)
description?stringThe description of the embed (max 4096)
url?stringThe URL of the embed
timestamp?ISO8601 timestampTimestamp of embed content
color?integerThe color of the embed encoded as an integer representation of hexadecimal color code
footer?embed footer objectEmbed footer information
image?embed image objectEmbed image information
thumbnail?embed thumbnail objectEmbed thumbnail information
video?embed video objectEmbed video information
provider?embed provider objectEmbed provider information
author?embed author objectEmbed author information
fields?array[embed field object]The fields of the embed (max 25)
reference_id?snowflakeThe ID of the message this embed was generated from
Embed Type

Most embed types are "loosely defined" and, for the most part, are not used by our clients for rendering. Embed attributes power what is rendered.

TypeDescription
application_news (deprecated)Application news embed
articleArticle embed
auto_moderation_message 1AutoMod alert
auto_moderation_notification 1AutoMod incident notification
giftGift embed
gifvAnimated GIF image rendered as a video embed
imageImage embed
linkLink embed
post_preview 2Media channel post preview embed
richGeneric embed rendered from embed attributes
videoVideo embed

1 These embed types are system-generated and cannot be sent by users. Their fields array represents the object linked in the description as a list of key-value pairs.

2 This embed type is used to signal to the client to render a preview of the linked media channel post. This embed is created for URLs that link to a media channel post if the channel is a paywalled role subscription benefit. The URL is always in the format https://discord.com/channels/:guild_id/:parent_id/threads/:thread_id/:initial_message_id.

Embed Thumbnail Structure
FieldTypeDescription
urlstringSource URL of thumbnail (only supports http(s) and attachments)
proxy_url?stringA proxied URL of the thumbnail
height?integerHeight of thumbnail
width?integerWidth of thumbnail
Embed Video Structure
FieldTypeDescription
urlstringSource URL of video
proxy_url?stringA proxied URL of the video
height?integerHeight of video
width?integerWidth of video
Embed Image Structure
FieldTypeDescription
urlstringSource URL of image (only supports http(s) and attachments)
proxy_url?stringA proxied URL of the image
height?integerHeight of image
width?integerWidth of image
Embed Provider Structure
FieldTypeDescription
name?stringThe name of the provider
url?stringURL of the provider
Embed Author Structure
FieldTypeDescription
namestringThe name of the author (max 256)
url?stringURL of the author (only supports http(s))
icon_url?stringSource URL of the author's icon (only supports http(s) and attachments)
proxy_icon_url?stringA proxied URL of the author's icon
FieldTypeDescription
textstringThe footer text (max 2048)
icon_url?stringSource URL of the footer icon (only supports http(s) and attachments)
proxy_icon_url?stringA proxied URL of the footer icon
Embed Field Structure
FieldTypeDescription
namestringThe name of the field (max 256)
valuestringThe value of the field (max 1024)
inline?booleanwhether this field should display inline

Attachment Object

Attachment Structure
FieldTypeDescription
idsnowflakeThe attachment ID
filenamestringThe name of file attached (max 1024 characters)
title?stringThe name of the file without the extension or title of the clip (max 1024 characters, automatically provided when the filename is normalized or randomly generated due to invalid characters)
uploaded_filename? 3stringThe name of the file pre-uploaded to Discord's GCP bucket
description?stringThe description for the file (max 1024 characters)
content_type? 2stringThe attachment's media type
sizeintegerThe size of file in bytes
url 2stringSource URL of the file
proxy_url 2 4stringA proxied url of the file
height? 2?integerHeight of image
width? 2?integerWidth of image
placeholder_version? 2integerThe attachment placeholder protocol version (currently 1)
placeholder? 2stringA low-resolution thumbhash of the image, to display before it is loaded
ephemeral? 1 2booleanWhether this attachment is ephemeral
duration_secs?floatDuration of the audio file (if voice message)
waveform?stringBase64 encoded bytearray representing a sampled waveform (if voice message)
flags? 5integerThe attachment's flags
is_clip? 5 6 7booleanWhether the file being uploaded is a clipped recording of a stream
is_thumbnail? 5booleanWhether the file being uploaded is a thumbnail
is_remix? 5booleanWhether this attachment is a remixed version of another attachment
is_spoiler? 5booleanWhether this attachment is a spoiler
clip_created_at? 6ISO8601 timestampWhen the clip was created
clip_participant_ids? 6 7array[snowflake]The IDs of the participants in the clip (max 100)
clip_participants? 7array[partial user object]The participants in the clip (max 100)
application_id? 7snowflakeThe ID of the application the clip was taken in
application? 7partial application objectThe application the clip was taken in

1 Ephemeral attachments will automatically be removed after a set period of time. Ephemeral attachments on messages are guaranteed to be available as long as the message itself exists.

2 These fields are received only and cannot be set.

3 This field is send-only. See uploading to Google Cloud for more information.

4 The proxy URL only supports attachments with a defined width and height, such as images and videos. For all other attachments, the proxy returns a 415 unsupported media type error.

5 The flags field is received only and cannot be set directly. To set flags, use the is_clip, is_thumbnail, and is_remix send-only fields.

6 When sending a clip, is_clip, clip_created_at, and clip_participant_ids are required. See message types for more information.

7 The clip_participant_ids and application_id fields are send-only. You will receive the clip_participants and application fields back when retrieving the message.

Attachment Flags
ValueNameDescription
1 << 0CLIPThis attachment is a clipped recording of a stream
1 << 1THUMBNAILThis attachment is a thumbnail
1 << 2REMIXThis attachment has been remixed
1 << 3SPOILERThis attachment is a spoiler
1 << 4CONTAINS_EXPLICIT_MEDIAThis attachment contains explicit media

Allowed Mentions Object

The allowed mention field allows for more granular control over mentions without various hacks to the message content. This will always validate against message content to avoid phantom pings (e.g. to ping everyone, you must still have @everyone in the message content), and check against user permissions.

Allowed Mention Types
ValueDescription
rolesControls role mentions
usersControls user mentions
everyoneControls @everyone and @here mentions
Allowed Mentions Structure
FieldTypeDescription
parse?array[string]The allowed mention types to parse from the content
roles?array[snowflake]The role IDs to mention (max 100)
users?array[snowflake]The user IDs to mention (max 100)
replied_user?booleanFor replies, whether to mention the author of the message being replied to (default false)
Allowed Mentions Reference

Due to the complexity of possibilities, we have included a set of examples and behavior for the allowed mentions field.

If allowed_mentions is not passed in (i.e. the key does not exist), the mentions will be parsed via the content. This corresponds with existing behavior.

In the example below we would ping @here (and also @role124 and @user123)

{
"content": "@here Hi there from <@123>, cc <@&124>"
}

To suppress all mentions in a message use:

{
"content": "@everyone hi there, <@&123>",
"allowed_mentions": {
"parse": []
}
}

This will suppress all mentions in the message (no @everyone or user mention).

The parse field is mutually exclusive with the other fields. In the example below, we would ping users 123 and role 124, but not @everyone. Note that passing a falsy value ([], null) into the users field does not trigger a validation error.

{
"content": "@everyone <@123> <@&124>",
"allowed_mentions": {
"parse": ["users", "roles"],
"users": []
}
}

In the next example, we would ping @everyone, (and also users 123 and 124 if they suppressed @everyone mentions), but we would not ping any roles.

{
"content": "@everyone <@123> <@124> <@125> <@&200>",
"allowed_mentions": {
"parse": ["everyone"],
"users": ["123", "124"]
}
}

Due to possible ambiguities, not all configurations are valid. An invalid configuration is as follows

{
"content": "@everyone <@123> <@124> <@125> <@&200>",
"allowed_mentions": {
"parse": ["users"],
"users": ["123", "124"]
}
}

Because parse: ["users"] and users: ["123", "124"] are both present, we would throw a validation error. This is because the conditions cannot be fulfilled simultaneously (they are mutually exclusive).

Any entities with an ID included in the list of IDs can be mentioned. Note that the IDs of entities not present in the message's content will simply be ignored. e.g. The following example is valid, and would mention user 123, but not user 125 since there is no mention of user 125 in the content.

{
"content": "<@123> Time for some memes.",
"allowed_mentions": {
"users": ["123", "125"]
}
}

Poll Object

The poll object has a lot of levels and nested structures. It was also designed to support future extensibility, so some fields may appear to be more complex than necessary.

Poll Structure
FieldTypeDescription
question 1poll media objectThe question of the poll
answersarray[poll answer object]The answers available in the poll
expiry 2?IS08601 timestampWhen the poll ends
allow_multiselectbooleanWhether a user can select multiple answers
layout_typeintegerThe layout type of the poll
results?poll results objectThe results of the poll

1 Only text is supported.

2 expiry is marked as nullable to support non-expiring polls in the future, but all polls have an expiry currently.

Poll Create Structure

This is the request object used when creating a poll across the different endpoints. It is similar but not exactly identical to the main poll object. The main difference is that the request has duration which eventually becomes expiry.

FieldTypeDescription
question 1poll media objectThe question of the poll
answersarray[poll answer object]Each of the answers available in the poll (max 10)
durationintegerNumber of hours the poll should be open for (max 32 days, default 1)
allow_multiselect?booleanWhether a user can select multiple answers (default false)
layout_type?integerThe layout type of the poll (default DEFAULT)

1 Only text is supported.

Poll Layout Type

Different layouts for polls will come in the future. For now though, this value will always be DEFAULT.

ValueNameDescription
1DEFAULTThe default layout type
2IMAGE_ONLY_ANSWERSPoll answers can have only images
Poll Media Structure

The poll media object is a common object that backs both the question and answers. For now, question only supports text, while answers can have an optional emoji.

FieldTypeDescription
text? 1stringThe text of the field (max 300 characters for question, 55 characters for answer)
emoji? 2partial emojiThe emoji of the field

1 text should always be non-null for both questions and answers, but please do not depend on that in the future.

2 When creating a poll answer with an emoji, one only needs to send either the id (custom emoji) or name (default emoji) as the only field.

Poll Answer Structure

The answer_id is a number that labels each answer. As an implementation detail, it currently starts at 1 for the first answer and goes up sequentially. We recommend against depending on this sequence.

Currently, there is a maximum of 10 answers per poll.

FieldTypeDescription
answer_id 1integerThe ID of the answer
poll_mediapoll media objectThe data of the answer

1 When sending, this field is optional.

Poll Results Structure

In a nutshell, this contains the number of votes for each answer. The results field may be not present in certain responses where, as an implementation detail, Discord does not fetch the poll results in the backend. This should be treated as "unknown results", as opposed to "no results". You can keep using the results if you have previously received them through other means. Due to the intricacies of counting at scale, while a poll is in progress the results may not be perfectly accurate. They usually are accurate, and shouldn't deviate significantly—it's just difficult to make guarantees. To compensate for this, after a poll is finished there is a background job which performs a final, accurate tally of votes. This tally concludes once is_finalized is true. Polls that have ended will also always contain results. If answer_counts does not contain an entry for a particular answer, then there are no votes for that answer.

FieldTypeDescription
is_finalizedbooleanWhether the votes have been precisely counted
answer_countsarray[poll answer count object]The counts for each answer
Poll Answer Count Structure
FieldTypeDescription
idintegerThe ID of the answer
countintegerThe number of votes for this answer
me_votedbooleanWhether the current user voted for this answer
Example Poll
{
"question": {
"text": "Aliens?"
},
"answers": [
{
"answer_id": 1,
"poll_media": {
"text": "Alien"
}
},
{
"answer_id": 2,
"poll_media": {
"text": "Alien 2",
"emoji": {
"id": null,
"name": "👽"
}
}
},
{
"answer_id": 3,
"poll_media": {
"text": "Alien 3",
"emoji": {
"id": "1120790948302033046",
"name": "meowlien"
}
}
}
],
"expiry": "2024-05-02T10:00:02.039342+00:00",
"allow_multiselect": true,
"layout_type": 1,
"results": {
"answer_counts": [
{
"id": 1,
"count": 1,
"me_voted": false
}
],
"is_finalized": false
}
}

Endpoints

Get Messages

GET/channels/{channel.id}/messages

Returns an array of message objects in the channel. Requires the VIEW_CHANNEL permission if operating on a guild channel. If the current user is missing the READ_MESSAGE_HISTORY permission in the channel then this will return no messages (since they cannot read the message history).

Query String Params
FieldTypeDescription
around?snowflakeGet messages around this message ID
before?snowflakeGet messages before this message ID
after?snowflakeGet messages after this message ID
limitintegerMax number of messages to return (1-100, default 50)

Search Messages

GET/guilds/{guild.id}/messages/search OR /channels/{channel.id}/messages/search

Returns messages without the reactions key that match a search query in the guild or channel. The messages that are direct results will have an extra hit key set to true. Requires the READ_MESSAGE_HISTORY permission if operating on a guild channel.

Query String Params
FieldTypeDescription
limit?integerMax number of messages to return (1-25, default 25)
offset?integerNumber to offset the returned messages by (max 9975, default 0)
max_id?snowflakeGet messages before this message ID
min_id?snowflakeGet messages after this message ID
include_nsfw?booleanWhether to include results from NSFW channels (default false)
content?stringFilter messages by content
channel_id? 1array[snowflake]Filter messages by these channels
author_type?array[string]Filter messages by author type
author_id?array[snowflake]Filter messages by these authors
mentions?array[snowflake]Filter messages that mention these users
mention_everyone?booleanFilter messages that do or do not mention @everyone
pinned?booleanFilter messages by whether they are or are not pinned
has?array[string]Filter messages by whether or not they have specific things
embed_type?array[string]Filter messages by embed type
embed_provider?array[string]Filter messages by embed provider (e.g. tenor)
link_hostname?array[string]Filter messages by link hostname (e.g. google.com)
attachment_filename?array[string]Filter messages by attachment filename
attachment_extension?array[string]Filter messages by attachment extension (e.g. txt)
command_id?array[snowflake]Filter messages by these application command IDs
sort_by?stringThe sorting algorithm to use
sort_order?stringThe direction to sort (asc or desc, default desc)

1 Not applicable when using the GET /channels/{channel.id}/messages/search endpoint.

Author Type

All types can be negated by prefixing them with -, which means results will not include messages that match the type.

ValueDescription
userReturn messages sent by user accounts
botReturn messages sent by bot accounts
webhookReturn messages sent by webhooks
Has Type

All types can be negated by prefixing them with -, which means results will not include messages that match the type.

ValueDescription
imageReturn messages that have an image
soundReturn messages that have a sound attachment
videoReturn messages that have a video
fileReturn messages that have an attachment
stickerReturn messages that have a sent sticker
embedReturn messages that have an embed
linkReturn messages that have a link
pollReturn messages that have a poll
snapshotReturn messages that have a forwarded message
Message Sort Type
ValueDescription
timestampSort by the message creation time (default)
relevanceSort by the relevance of the message to the search query
Response Body
FieldTypeDescription
messagesarray[array[message object]]A nested array of messages (with optional surrounding context) 1 that match the query
threads?array[channel object]The threads that are the channels of the returned messages
members?array[thread member object]A thread member object for each returned thread the current user has joined
total_resultsintegerThe total number of results that match the query
analytics_idstringThe analytics ID for the search query
documents_indexed?integerThe number of documents that have been indexed during the current index operation, if any
doing_deep_historical_index?booleanThe status of the guild/channel's deep historical indexing operation, if any

1 Surrounding context messages are no longer returned.

Example Response
{
"total_results": 1,
"messages": [
[
{
"id": "1076986676557131916",
"type": 0,
"content": "domainreaction fear",
"channel_id": "885895521909227581",
"author": {
"id": "545581357812678656",
"username": "alien",
"global_name": "Alien",
"avatar": "60387de43133809b083fb0f7458d2708",
"avatar_decoration_data": null,
"discriminator": "0",
"public_flags": 4194432
},
"attachments": [],
"embeds": [],
"mentions": [],
"mention_roles": [],
"pinned": false,
"mention_everyone": false,
"tts": false,
"timestamp": "2023-02-19T22:00:33.136000+00:00",
"edited_timestamp": null,
"flags": 0,
"components": [],
"hit": true
}
]
],
"analytics_id": "largealienalphanumericstring"
}

Get Message

GET/channels/{channel.id}/messages/{message.id}

Returns a specific message object in the channel. Requires the READ_MESSAGE_HISTORY permission if operating on a guild channel.

Create Message

POST/channels/{channel.id}/messages

Posts a message to a text-based channel. Returns a message object on success. Fires a Message Create Gateway event. See message formatting for more information on how to properly format messages.

To create a message as a reply to another message, you can include a message_reference with a message_id. The channel_id and guild_id in the message_reference are optional, but will be validated if provided.

Files must be attached using a multipart/form-data body (or pre-uploaded to Discord's GCP bucket) as described in Uploading Files.

Limitations
  • When operating on a guild channel, the current user must have the SEND_MESSAGES permission.
  • When sending a message with poll, the current user must have the SEND_POLLS permission.
  • When sending a message with tts (text-to-speech) set to true, the current user must have the SEND_TTS_MESSAGES permission.
  • When creating a message as a reply to another message, the current user must have the READ_MESSAGE_HISTORY permission.
    • The referenced message must exist and cannot be a system message.
  • The maximum request size when sending a message is 100 MiB.
  • For the embed object, you can set every field except type (it will be rich regardless of if you try to set it), provider, video, and any height, width, or proxy_url values for images.
JSON/Form Params
FieldTypeDescription
content?stringThe message contents (up to 2000 characters)
tts?booleanWhether this is a TTS message
embeds? 2array[embed object]Embedded rich content (max 6000 characters, max 10)
embed? 2 (deprecated)embed objectEmbedded rich content (max 6000 characters), deprecated in favor of embeds
nonce? 3integer | stringThe message's nonce, used for message deduplication (will be present in the returned object and accompanying Message Create event)
allowed_mentions?allowed mention objectAllowed mentions for the message
message_reference?message reference objectThe message being replied to or forwarded
components? 2array[message component object]The components to include with the message
sticker_ids?array[snowflake]IDs of up to 3 stickers to send in the message
activity?message activity objectThe rich presence activity to invite users to
application_id?snowflakeThe application ID of the activity to create a rich presence invite for (defaults to the primary activity if unspecified)
flags?integerThe message's flags (only SUPPRESS_EMBEDS, SUPPRESS_NOTIFICATIONS, and VOICE_MESSAGE can be set)
files[n]? 1file contentsContents of the file being sent (max 10)
payload_json? 1stringJSON-encoded body of non-file params
attachments? 1array[partial attachment object]Partial attachment objects with filename and description (max 10)
poll?poll create objectA poll!

1 See Uploading Files for details.

2 Cannot be used by user accounts.

3 Sending multiple messages in the same channel with the same nonce in a short period of time will result in only the first message being sent.

Example Request Body (application/json)
{
"content": "Hello, World!",
"tts": false,
"embeds": [
{
"title": "Hello, Embed!",
"description": "This is an embedded message."
}
]
}

Examples for file uploads are available in Uploading Files.

Create Greet Message

POST/channels/{channel.id}/greet

Posts a greet message to a channel. This endpoint requires the channel is a DM channel or you reply to a system message. Returns a message object on success. Fires a Message Create Gateway event.

JSON Params
FieldTypeDescription
sticker_idsarray[snowflake]IDs of up to 1 sticker to send in the message
allowed_mentions?allowed mention objectAllowed mentions for the message
message_reference?message reference objectThe message being replied to

Create Attachments

POST/channels/{channel.id}/attachments

Creates attachment URLs to upload the intended attachments directly to Discord's GCP storage bucket. Returns an array of cloud attachment objects. Requires the same permissions as uploading an attachment inline with a message. See Uploading to Google Cloud for more information.

JSON Params
FieldTypeDescription
filesarray[upload attachment object]The target files to create a URL for, containing the name and size
Upload Attachment Structure
FieldTypeDescription
id??stringThe ID of the attachment to reference in the response
filenamestringThe name of the file being uploaded
file_sizeintegerThe size of the file being uploaded in bytes
is_clip? 1booleanWhether the file being uploaded is a clipped recording of a stream
clip_created_at? 1ISO8601 timestampWhen the clip was created
clip_participant_ids? 1array[snowflake]The IDs of the participants in the clip (max 100)
title?stringThe title of the clip
application_id?snowflakeThe ID of the application the clip was taken in

1 When uploading a clip, is_clip, clip_created_at, and clip_participant_ids are required. See message types for more information.

Cloud Attachment Structure
FieldTypeDescription
id?stringThe ID of the attachment upload, if provided in the request
upload_urlstringThe URL to upload the file to
upload_filenamestringThe name of the uploaded file
Example Response
{
"attachments": [
{
"id": "23",
"upload_url": "https://discord-attachments-uploads-prd.storage.googleapis.com/87e49c99-43f8-4a33-baad-5a834c94424c/cat.png?upload_id=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"upload_filename": "87e49c99-43f8-4a33-baad-5a834c94424c/cat.png"
}
]
}

Delete Attachment

DELETE/channels/{channel.id}/attachments/{cloud_attachment.upload_filename}

Deletes an attachment from Discord's GCP storage bucket. Returns a 204 empty response on success.

This endpoint should be used to delete an uploaded attachment that was not used. See Uploading to Google Cloud for more information.

Refresh Attachment URLs

POST/attachments/refresh-urls

Refreshes the URLs of attachments that were uploaded to Discord's CDN. The provided URLs do not have to be valid or signed. Existing query string parameters are preserved.

JSON Params
FieldTypeDescription
attachment_urlsarray[string]The URLs of the attachments to refresh (1-50)
Response Body
FieldTypeDescription
refreshed_urlsarray[refreshed attachment object]The refreshed URLs
Refreshed Attachment Structure
FieldTypeDescription
originalstringThe provided URL
refreshedstringThe refreshed URL
Example Response
{
"refreshed_urls": [
{
"original": "https://cdn.discordapp.com/attachments/1012345678900020080/1234567891233211234/my_image.png?ex=65d903de&is=65c68ede&hm=2481f30dd67f503f54d020ae3b5533b9987fae4e55f2b4e3926e08a3fa3ee24f&",
"refreshed": "https://cdn.discordapp.com/attachments/1012345678900020080/1234567891233211234/my_image.png?ex=66143372&is=6601be72&hm=5a90a0ac363d9de3619044102ffe963041517f0e2f78baecabfc2f544a14eace&"
}
]
}

Acknowledge Message

POST/channels/{channel.id}/messages/{message.id}/ack

Sets the channel's latest acknowledged message (marks a message as read) for the current user. Fires a Message Ack Gateway event.

The message ID parameter does not need to be a valid message ID, but it must be a valid snowflake. If the message ID is being set to a message sent prior to the latest acknowledged one, manual should be true or the resulting read state update should be ignored by clients (but is still saved), resulting in undefined behavior. In this case, mention_count should also be set to the amount of mentions unacknowledged as it is not automatically calculated by Discord.

JSON Params
FieldTypeDescription
token??stringThe last received ack token, or null
manual?booleanWhether the acknowleged message ID is manually set
mention_count? 1integerThe new unread indicator for the channel

1 Requires manual to be true.

Response Body
FieldTypeDescription
token?stringThe new ack token

Crosspost Message

POST/channels/{channel.id}/messages/{message.id}/crosspost

Crossposts a message in a News Channel to following channels. Requires the SEND_MESSAGES permission if the current user sent the message, or additionally the MANAGE_MESSAGES permission for all other messages. Returns a message object on success. Fires a Message Update (and possibly multiple Message Create) Gateway event.

Hide Message from Guild Feed

POST/channels/{channel.id}/messages/{message.id}/hide-guild-feed

Hides a message from the feed of the guild the channel belongs to. Returns a 204 empty response on success.

Get Reactions

GET/channels/{channel.id}/messages/{message.id}/reactions/{emoji}

Get a list of users that reacted with this emoji. Returns an array of partial user objects. The emoji must be URL Encoded or the request will fail. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji ID.

Query String Params
FieldTypeDescription
after?snowflakeGet users after this user ID
limit?integerMax number of users to return (1-100, default 25)
type?integerThe type of reaction to get users for (default REGULAR)

Create Reaction

PUT/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/@me

Creates a reaction for the message. Requires the READ_MESSAGE_HISTORY permission if operating on a guild channel. Additionally, if nobody else has reacted to the message using this emoji, this endpoint requires the ADD_REACTIONS permission. Returns a 204 empty response on success. Fires a Message Reaction Add (and optionally a Burst Credit Balance Update) Gateway event. The emoji must be URL Encoded or the request will fail. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji ID.

Query String Params
FieldTypeDescription
type?integerThe type of reaction to create (default REGULAR)

Delete Own Reaction

DELETE/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{reaction_type}/@me

Deletes a reaction the current user has made for the message. Returns a 204 empty response on success. Fires a Message Reaction Remove Gateway event. The emoji must be URL Encoded or the request will fail. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji ID.

Delete Reaction

DELETE/channels/{channel.id}/messages/{message.id}/reactions/{emoji}/{reaction_type}/{user.id}

Deletes another user's reaction. Requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success. Fires a Message Reaction Remove Gateway event. The emoji must be URL Encoded or the request will fail. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji ID.

Delete Reaction Emoji

DELETE/channels/{channel.id}/messages/{message.id}/reactions/{emoji}

Deletes all the reactions for a given emoji on a message. Returns a 204 empty response on success. Requires the MANAGE_MESSAGES permission. Fires a Message Reaction Remove Emoji Gateway event. The emoji must be URL Encoded or the request will fail. To use custom emoji, you must encode it in the format name:id with the emoji name and emoji ID.

Delete All Reactions

DELETE/channels/{channel.id}/messages/{message.id}/reactions

Deletes all reactions on a message. Returns a 204 empty response on success. Requires the MANAGE_MESSAGES permission. Fires a Message Reaction Remove All Gateway event.

Edit Message

PATCH/channels/{channel.id}/messages/{message.id}

Edits a previously sent message. All fields can be edited by the original message author. Other users can only edit flags and only if they have the MANAGE_MESSAGES permission in the corresponding channel. When specifying flags, ensure to include all previously set flags/bits in addition to ones that you are modifying.

When the content field is edited, the mentions array in the message object will be reconstructed from scratch based on the new content. The allowed_mentions field of the edit request controls how this happens. If there is no explicit allowed_mentions in the edit request, the content will be parsed with default allowances, that is, without regard to whether or not an allowed_mentions was present in the request that originally created the message.

Returns a message object. Fires a Message Update Gateway event.

Refer to Uploading Files for details on attachments and multipart/form-data requests. Any provided files will be appended to the message. To remove or replace files you will have to supply the attachments field which specifies the files to retain on the message after edit.

JSON/Form Params
FieldTypeDescription
content??stringThe message contents (up to 2000 characters)
embeds? 2?array[embed object]Embedded rich content (max 6000 characters)
embed? 2 (deprecated)?embed objectEmbedded rich content (max 6000 characters), deprecated in favor of embeds
allowed_mentions??allowed mention objectAllowed mentions for the message
components? 2?array[message component object]The components to include with the message
flags??integerThe message's flags (only SUPPRESS_EMBEDS can be set)
files[n] 1?file contentsContents of the file being sent
payload_json 1?stringJSON-encoded body of non-file params
attachments 1?array[partial attachment object]Partial attachment objects with filename and description, including attached files to keep

1 See Uploading Files for details.

Delete Message

DELETE/channels/{channel.id}/messages/{message.id}

Deletes a message. Requires the MANAGE_MESSAGES permission if operating on a guild channel and trying to delete a message that was not sent by the current user. Returns a 204 empty response on success. Fires a Message Delete Gateway event.

Bulk Delete Messages

POST/channels/{channel.id}/messages/bulk-delete

Deletes multiple messages from a guild channel in a single request. Requires the MANAGE_MESSAGES permission. Returns a 204 empty response on success. Fires a Message Delete Bulk Gateway event.

Any message IDs given that do not exist or are invalid will count towards the minimum and maximum message count (currently 2 and 100 respectively).

JSON Params
FieldTypeDescription
messagesarray[snowflake]The message IDs to delete (2-100)

Get Pinned Messages

GET/channels/{channel.id}/pins

Returns all pinned messages in the channel as an array of message objects without the reactions key.

Pin Message

PUT/channels/{channel.id}/pins/{message.id}

Pins a message in a channel. Requires the MANAGE_MESSAGES permission if operating on a guild channel. Returns a 204 empty response on success.

Unpin Message

DELETE/channels/{channel.id}/pins/{message.id}

Unpins a message in a channel. Requires the MANAGE_MESSAGES permission if operating on a guild channel. Returns a 204 empty response on success.

Acknowledge Pinned Messages

POST/channels/{channel.id}/pins/ack

Acknowledges the currently pinned messages in a channel. Returns a 204 empty response on success. Fires a Channel Pins Ack Gateway event.

Get Channel Media Preview

GET/channels/{channel.id}/media-post-preview

Returns information on the media of a post (thread) in a media channel. The media channel must be a paywalled role subscription benefit. If the user is not in the guild, the guild must be discoverable.

Response Body
FieldTypeDescription
mediamedia preview objectThe preview of the media in the thread's first message
Media Preview Structure
FieldTypeDescription
guild_idsnowflakeThe ID of the guild the media is in
guild_namestringThe name of the guild the media is in
guild_iconstringThe icon hash of the guild the media is in
channel_idsnowflakeThe ID of the thread that represents the media
parent_channel_idsnowflakeThe ID of the media channel the thread is in
message_idsnowflakeThe ID of the thread's first message (same as the thread ID)
author_idsnowflakeThe ID of the author of the thread's first message
titlestringThe name of the thread
descriptionstringThe first 64 characters of the first message's content
has_media_attachment 1booleanWhether the first message has a media attachment
thumbnail?attachment objectThe thumbnail of the thread's first message, if any

1 If a media attachment is present, a fake thumbnail will be rendered in the preview as a CTA to subscribe to the role that unlocks the media channel.

Example Response
{
"media": {
"guild_id": "1046920999469330512",
"channel_id": "1120793989809967114",
"parent_channel_id": "1120793939562217483",
"message_id": "1120793989809967114",
"title": "feet picers",
"description": "https://tenor.com/view/naomi-bunny-melon-gif-22514980",
"guild_name": "Hood Network",
"guild_icon": "a_78187748cb59baec2bf6a1f8766ff9fc",
"author_id": "728342296696979526",
"thumbnail": {
"url": "https://media.tenor.com/ttfzDdgGOqgAAAAM/naomi-bunny.png",
"proxy_url": "https://images-ext-2.discordapp.net/external/RGh8LSJbaADcUFgzFsvpODM6E2nz3xKVg_Mrg9UE58k/https/media.tenor.com/ttfzDdgGOqgAAAAe/naomi-bunny.png",
"width": 388,
"height": 640
},
"has_media_attachment": true
}
}

Unfurl Embed

POST/unfurler/unfurl

Returns debug information about an embed.

JSON Params
FieldTypeDescription
urlstringThe URL to unfurl
Response Body
FieldTypeDescription
response?embed response objectThe response from the website
error?stringThe error that occurred while parsing the website
context_errorsarray[string]The contextual errors that occurred while parsing the website
embeds?array[embed object]The found embeds for the URL
Embed Response Structure
FieldTypeDescription
headersmap[string, string]The relevant headers returned by the website
bodystringThe body of the website, if used to generate the embed

Unfurl Embeds

POST/unfurler/embed-urls

Returns embed data from a list of URLs.

JSON Params
FieldTypeDescription
urlsarray[string]The URLs to unfurl (max 4)
Response Body
FieldTypeDescription
embedsarray[embed object]The found embeds for the URLs

Get Answer Voters

GET/channels/{channel.id}/polls/{message.id}/answers/{answer.id}

Get a list of users that voted for this specific answer.

Query String Params
FieldTypeDescription
after?snowflakeGet users after this user ID
limit?integerMax number of users to return (1-100, default 25)
Response Body
FieldTypeDescription
usersarray[partial user object]Users who voted for this answer

End Poll

POST/channels/{channel.id}/polls/{message.id}/expire

Immediately ends the poll. You cannot end polls from other users.

Returns a message object. Fires a Message Update Gateway event.

Create Poll Vote

PUT/channels/{channel.id}/polls/{message.id}/answers/@me

Submits a poll vote for the current user. Returns a 204 empty response on success. Fires multiple Message Poll Vote Add and optionally Message Poll Vote Remove Gateway events.

JSON Params
FieldTypeDescription
answer_idsarray[integer]Selected answers, empty to clear votes