patch
/channels/{channel_id}/messages/{message_id}Edit a message
Updates an existing message. Only the message author can edit messages (or admins with proper permissions). Supports updating content, embeds, and attachments. Returns the updated message object. Maintains original message ID and timestamps.
edit_message
Parameters
| Name | In | Type | Description |
|---|---|---|---|
| channel_id* | path | SnowflakeType | The ID of the channel |
| message_id* | path | SnowflakeType | The ID of the message |
Request body
application/json
json
{
"type": "object",
"properties": {
"content": {
"anyOf": [
{
"$ref": "#/components/schemas/MessageContentRequest"
},
{
"type": "null"
}
]
},
"embeds": {
"type": "array",
"items": {
"$ref": "#/components/schemas/RichEmbedRequest"
},
"description": "Array of embed objects to include in the message"
},
"allowed_mentions": {
"anyOf": [
{
"$ref": "#/components/schemas/AllowedMentionsRequest"
},
{
"type": "null"
}
],
"description": "Controls which mentions trigger notifications"
},
"flags": {
"$ref": "#/components/schemas/MessageFlags"
},
"attachments": {
"type": "array",
"items": {
"oneOf": [
{
"$ref": "#/components/schemas/ClientUploadedAttachmentRequest"
},
{
"$ref": "#/components/schemas/ClientAttachmentReferenceRequest"
}
]
},
"description": "Array of attachment objects to keep or add"
},
"message_snapshots": {
"type": "array",
"items": {
"type": "object",
"properties": {
"attachments": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"oneOf": [
{
"$ref": "#/components/schemas/Int32Type"
},
{
"$ref": "#/components/schemas/SnowflakeType"
}
],
"description": "The identifier of the snapshot attachment"
},
"title": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "A title for the attachment (1-1024 characters)"
},
"description": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "Alt text description for the attachment (1-4096 characters)"
}
},
"required": [
"id"
]
},
"maxItems": 10
}
}
},
"maxItems": 10,
"description": "Per-snapshot edits aligned by index with the existing snapshots. Currently supports updating attachment metadata (title/description)."
}
}
}Responses
200
Success
json
{
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$",
"description": "The unique identifier (snowflake) for this message"
},
"channel_id": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$",
"description": "The ID of the channel this message was sent in"
},
"author": {
"$ref": "#/components/schemas/UserPartialResponse"
},
"webhook_id": {
"anyOf": [
{
"$ref": "#/components/schemas/SnowflakeType"
},
{
"type": "null"
}
],
"description": "The ID of the webhook that sent this message"
},
"type": {
"type": "integer",
"format": "int32",
"enum": [
0,
1,
2,
3,
4,
5,
6,
7,
19
],
"x-enumNames": [
"DEFAULT",
"RECIPIENT_ADD",
"RECIPIENT_REMOVE",
"CALL",
"CHANNEL_NAME_CHANGE",
"CHANNEL_ICON_CHANGE",
"CHANNEL_PINNED_MESSAGE",
"USER_JOIN",
"REPLY"
],
"x-enumDescriptions": [
"A regular message",
"A system message indicating a user was added to the conversation",
"A system message indicating a user was removed from the conversation",
"A message representing a call",
"A system message indicating the channel name changed",
"A system message indicating the channel icon changed",
"A system message indicating a message was pinned",
"A system message indicating a user joined",
"A reply message"
],
"description": "The type of message"
},
"flags": {
"$ref": "#/components/schemas/MessageFlags"
},
"content": {
"type": "string",
"description": "The text content of the message"
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "The ISO 8601 timestamp of when the message was created"
},
"edited_timestamp": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"description": "The ISO 8601 timestamp of when the message was last edited"
},
"pinned": {
"type": "boolean",
"description": "Whether the message is pinned"
},
"mention_everyone": {
"type": "boolean",
"description": "Whether the message mentions @everyone"
},
"tts": {
"type": "boolean",
"description": "Whether the message was sent as text-to-speech"
},
"mentions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserPartialResponse"
},
"description": "The users mentioned in the message"
},
"mention_roles": {
"type": "array",
"items": {
"type": "string"
},
"description": "The role IDs mentioned in the message"
},
"mention_channels": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageChannelMentionResponse"
}
},
{
"type": "null"
}
],
"description": "Channels mentioned in the message that are visible to @everyone"
},
"users": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/UserPartialResponse"
}
},
{
"type": "null"
}
],
"description": "Users referenced from non-notifying content, embed, and snapshot text, included for client-side resolution"
},
"embeds": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageEmbedResponse"
}
},
{
"type": "null"
}
],
"description": "The embeds attached to the message"
},
"attachments": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageAttachmentResponse"
}
},
{
"type": "null"
}
],
"description": "The files attached to the message"
},
"stickers": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageStickerResponse"
}
},
{
"type": "null"
}
],
"description": "The stickers sent with the message"
},
"nsfw_emojis": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SnowflakeType"
},
"description": "IDs of custom emojis in this message that are classified as NSFW"
},
"reactions": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageReactionResponse"
}
},
{
"type": "null"
}
],
"description": "The reactions on the message"
},
"message_reference": {
"anyOf": [
{
"type": "object",
"properties": {
"channel_id": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$",
"description": "The ID of the channel containing the referenced message"
},
"message_id": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$",
"description": "The ID of the referenced message"
},
"guild_id": {
"anyOf": [
{
"$ref": "#/components/schemas/SnowflakeType"
},
{
"type": "null"
}
],
"description": "The ID of the guild containing the referenced message"
},
"type": {
"$ref": "#/components/schemas/MessageReferenceType"
}
},
"required": [
"channel_id",
"message_id",
"type"
]
},
{
"type": "null"
}
],
"description": "Reference data for replies or forwards"
},
"message_snapshots": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageSnapshotResponse"
}
},
{
"type": "null"
}
],
"description": "Snapshots of forwarded messages"
},
"nonce": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "A client-provided value for message deduplication"
},
"call": {
"anyOf": [
{
"type": "object",
"properties": {
"participants": {
"type": "array",
"items": {
"type": "string"
},
"description": "The user IDs of participants in the call"
},
"ended_timestamp": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"description": "The ISO 8601 timestamp of when the call ended"
}
},
"required": [
"participants"
]
},
{
"type": "null"
}
],
"description": "Call information if this message represents a call"
},
"referenced_message": {
"anyOf": [
{
"type": "object",
"properties": {
"id": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$",
"description": "The unique identifier (snowflake) for this message"
},
"channel_id": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$",
"description": "The ID of the channel this message was sent in"
},
"author": {
"$ref": "#/components/schemas/UserPartialResponse"
},
"webhook_id": {
"anyOf": [
{
"$ref": "#/components/schemas/SnowflakeType"
},
{
"type": "null"
}
],
"description": "The ID of the webhook that sent this message"
},
"type": {
"type": "integer",
"format": "int32",
"enum": [
0,
1,
2,
3,
4,
5,
6,
7,
19
],
"x-enumNames": [
"DEFAULT",
"RECIPIENT_ADD",
"RECIPIENT_REMOVE",
"CALL",
"CHANNEL_NAME_CHANGE",
"CHANNEL_ICON_CHANGE",
"CHANNEL_PINNED_MESSAGE",
"USER_JOIN",
"REPLY"
],
"x-enumDescriptions": [
"A regular message",
"A system message indicating a user was added to the conversation",
"A system message indicating a user was removed from the conversation",
"A message representing a call",
"A system message indicating the channel name changed",
"A system message indicating the channel icon changed",
"A system message indicating a message was pinned",
"A system message indicating a user joined",
"A reply message"
],
"description": "The type of message"
},
"flags": {
"$ref": "#/components/schemas/MessageFlags"
},
"content": {
"type": "string",
"description": "The text content of the message"
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "The ISO 8601 timestamp of when the message was created"
},
"edited_timestamp": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"description": "The ISO 8601 timestamp of when the message was last edited"
},
"pinned": {
"type": "boolean",
"description": "Whether the message is pinned"
},
"mention_everyone": {
"type": "boolean",
"description": "Whether the message mentions @everyone"
},
"tts": {
"type": "boolean",
"description": "Whether the message was sent as text-to-speech"
},
"mentions": {
"type": "array",
"items": {
"$ref": "#/components/schemas/UserPartialResponse"
},
"description": "The users mentioned in the message"
},
"mention_roles": {
"type": "array",
"items": {
"type": "string"
},
"description": "The role IDs mentioned in the message"
},
"mention_channels": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageChannelMentionResponse"
}
},
{
"type": "null"
}
],
"description": "Channels mentioned in the message that are visible to @everyone"
},
"users": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/UserPartialResponse"
}
},
{
"type": "null"
}
],
"description": "Users referenced from non-notifying content, embed, and snapshot text, included for client-side resolution"
},
"embeds": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageEmbedResponse"
}
},
{
"type": "null"
}
],
"description": "The embeds attached to the message"
},
"attachments": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageAttachmentResponse"
}
},
{
"type": "null"
}
],
"description": "The files attached to the message"
},
"stickers": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageStickerResponse"
}
},
{
"type": "null"
}
],
"description": "The stickers sent with the message"
},
"nsfw_emojis": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SnowflakeType"
},
"description": "IDs of custom emojis in this message that are classified as NSFW"
},
"reactions": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageReactionResponse"
}
},
{
"type": "null"
}
],
"description": "The reactions on the message"
},
"message_reference": {
"anyOf": [
{
"type": "object",
"properties": {
"channel_id": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$",
"description": "The ID of the channel containing the referenced message"
},
"message_id": {
"type": "string",
"pattern": "^(0|[1-9][0-9]*)$",
"description": "The ID of the referenced message"
},
"guild_id": {
"anyOf": [
{
"$ref": "#/components/schemas/SnowflakeType"
},
{
"type": "null"
}
],
"description": "The ID of the guild containing the referenced message"
},
"type": {
"$ref": "#/components/schemas/MessageReferenceType"
}
},
"required": [
"channel_id",
"message_id",
"type"
]
},
{
"type": "null"
}
],
"description": "Reference data for replies or forwards"
},
"message_snapshots": {
"anyOf": [
{
"type": "array",
"items": {
"$ref": "#/components/schemas/MessageSnapshotResponse"
}
},
{
"type": "null"
}
],
"description": "Snapshots of forwarded messages"
},
"nonce": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"description": "A client-provided value for message deduplication"
},
"call": {
"anyOf": [
{
"type": "object",
"properties": {
"participants": {
"type": "array",
"items": {
"type": "string"
},
"description": "The user IDs of participants in the call"
},
"ended_timestamp": {
"anyOf": [
{
"type": "string",
"format": "date-time"
},
{
"type": "null"
}
],
"description": "The ISO 8601 timestamp of when the call ended"
}
},
"required": [
"participants"
]
},
{
"type": "null"
}
],
"description": "Call information if this message represents a call"
}
},
"required": [
"id",
"channel_id",
"author",
"type",
"flags",
"content",
"timestamp",
"pinned",
"mention_everyone",
"tts",
"mentions",
"mention_roles"
]
},
{
"type": "null"
}
],
"description": "The message that this message is replying to or forwarding"
}
},
"required": [
"id",
"channel_id",
"author",
"type",
"flags",
"content",
"timestamp",
"pinned",
"mention_everyone",
"tts",
"mentions",
"mention_roles"
]
}400
Bad Request - The request was malformed or contained invalid data
json
{
"type": "object",
"properties": {
"code": {
"$ref": "#/components/schemas/APIErrorCode"
},
"message": {
"type": "string",
"description": "Human-readable error message"
},
"errors": {
"type": "array",
"description": "Field-specific validation errors",
"items": {
"$ref": "#/components/schemas/ValidationErrorItem"
}
}
},
"required": [
"code",
"message"
]
}401
Unauthorized - Authentication is required or the token is invalid
json
{
"type": "object",
"properties": {
"code": {
"$ref": "#/components/schemas/APIErrorCode"
},
"message": {
"type": "string",
"description": "Human-readable error message"
},
"errors": {
"type": "array",
"description": "Field-specific validation errors",
"items": {
"$ref": "#/components/schemas/ValidationErrorItem"
}
}
},
"required": [
"code",
"message"
]
}403
Forbidden - You do not have permission to perform this action
json
{
"type": "object",
"properties": {
"code": {
"$ref": "#/components/schemas/APIErrorCode"
},
"message": {
"type": "string",
"description": "Human-readable error message"
},
"errors": {
"type": "array",
"description": "Field-specific validation errors",
"items": {
"$ref": "#/components/schemas/ValidationErrorItem"
}
}
},
"required": [
"code",
"message"
]
}429
Too Many Requests - You are being rate limited
json
{
"type": "object",
"properties": {
"code": {
"type": "string",
"enum": [
"RATE_LIMITED"
]
},
"message": {
"type": "string"
},
"retry_after": {
"type": "number",
"description": "Seconds to wait before retrying"
},
"global": {
"type": "boolean",
"description": "Whether this is a global rate limit"
}
},
"required": [
"code",
"message",
"retry_after"
]
}500
Internal Server Error - An unexpected error occurred
json
{
"type": "object",
"properties": {
"code": {
"$ref": "#/components/schemas/APIErrorCode"
},
"message": {
"type": "string",
"description": "Human-readable error message"
},
"errors": {
"type": "array",
"description": "Field-specific validation errors",
"items": {
"$ref": "#/components/schemas/ValidationErrorItem"
}
}
},
"required": [
"code",
"message"
]
}