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

NameInTypeDescription
channel_id*pathSnowflakeTypeThe ID of the channel
message_id*pathSnowflakeTypeThe 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": {
      "description": "Controls which mentions trigger notifications",
      "anyOf": [
        {
          "$ref": "#/components/schemas/AllowedMentionsRequest"
        },
        {
          "type": "null"
        }
      ]
    },
    "flags": {
      "$ref": "#/components/schemas/MessageFlags",
      "description": "Message flags bitfield"
    },
    "attachments": {
      "description": "Array of attachment objects to keep or add",
      "type": "array",
      "items": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/ClientUploadedAttachmentRequest"
          },
          {
            "$ref": "#/components/schemas/ClientAttachmentReferenceRequest"
          }
        ]
      }
    },
    "message_snapshots": {
      "description": "Per-snapshot edits aligned by index with the existing snapshots. Currently supports updating attachment metadata (title/description).",
      "maxItems": 10,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "attachments": {
            "maxItems": 10,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "anyOf": [
                    {
                      "$ref": "#/components/schemas/Int32Type"
                    },
                    {
                      "$ref": "#/components/schemas/SnowflakeType"
                    }
                  ],
                  "description": "The identifier of the snapshot attachment"
                },
                "title": {
                  "description": "A title for the attachment (1-1024 characters)",
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "description": {
                  "description": "Alt text description for the attachment (1-4096 characters)",
                  "type": [
                    "string",
                    "null"
                  ]
                }
              },
              "required": [
                "id"
              ]
            }
          }
        }
      }
    }
  }
}

Responses

200

Success

json
{
  "type": "object",
  "properties": {
    "id": {
      "description": "The unique identifier (snowflake) for this message",
      "$ref": "#/components/schemas/SnowflakeStringType"
    },
    "channel_id": {
      "description": "The ID of the channel this message was sent in",
      "$ref": "#/components/schemas/SnowflakeStringType"
    },
    "author": {
      "description": "The author of the message",
      "$ref": "#/components/schemas/UserPartialResponse"
    },
    "webhook_id": {
      "description": "The ID of the webhook that sent this message",
      "anyOf": [
        {
          "$ref": "#/components/schemas/SnowflakeStringType"
        },
        {
          "type": "null"
        }
      ]
    },
    "type": {
      "$ref": "#/components/schemas/MessageType"
    },
    "flags": {
      "$ref": "#/components/schemas/MessageFlags",
      "description": "The bitwise flags for this message"
    },
    "content": {
      "type": "string",
      "description": "The text content of the message"
    },
    "timestamp": {
      "type": "string",
      "format": "date-time",
      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
      "description": "The ISO 8601 timestamp of when the message was created"
    },
    "edited_timestamp": {
      "description": "The ISO 8601 timestamp of when the message was last edited",
      "anyOf": [
        {
          "type": "string",
          "format": "date-time",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
        },
        {
          "type": "null"
        }
      ]
    },
    "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": {
      "description": "Channels mentioned in the message that are visible to @everyone",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/MessageChannelMentionResponse"
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "users": {
      "description": "Users referenced from non-notifying content, embed, and snapshot text, included for client-side resolution",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/UserPartialResponse"
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "embeds": {
      "description": "The embeds attached to the message",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/MessageEmbedResponse"
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "attachments": {
      "description": "The files attached to the message",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/MessageAttachmentResponse"
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "stickers": {
      "description": "The stickers sent with the message",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/MessageStickerResponse"
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "reactions": {
      "description": "The reactions on the message",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/MessageReactionResponse"
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "message_reference": {
      "description": "Reference data for replies or forwards",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "channel_id": {
              "description": "The ID of the channel containing the referenced message",
              "$ref": "#/components/schemas/SnowflakeStringType"
            },
            "message_id": {
              "description": "The ID of the referenced message, absent on a channel follow system message and on thread created messages that reference only a thread",
              "anyOf": [
                {
                  "$ref": "#/components/schemas/SnowflakeStringType"
                },
                {
                  "type": "null"
                }
              ]
            },
            "guild_id": {
              "description": "The ID of the guild containing the referenced message",
              "anyOf": [
                {
                  "$ref": "#/components/schemas/SnowflakeStringType"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": {
              "$ref": "#/components/schemas/MessageReferenceType"
            }
          },
          "required": [
            "channel_id",
            "type"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "message_snapshots": {
      "description": "Snapshots of forwarded messages",
      "anyOf": [
        {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/MessageSnapshotResponse"
          }
        },
        {
          "type": "null"
        }
      ]
    },
    "nonce": {
      "description": "A client-provided value for message deduplication",
      "type": [
        "string",
        "null"
      ]
    },
    "call": {
      "description": "Call information if this message represents a call",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "participants": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "The user IDs of participants in the call"
            },
            "ended_timestamp": {
              "description": "The ISO 8601 timestamp of when the call ended",
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                {
                  "type": "null"
                }
              ]
            }
          },
          "required": [
            "participants"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    },
    "thread": {
      "description": "The thread started from this message, when the viewer can see threads",
      "$ref": "#/components/schemas/ThreadChannelResponse"
    },
    "referenced_message": {
      "description": "The reply target. Present and populated when the target resolved, present and null when the target is gone, absent when this message has no default reference. Clients must tell null apart from absent by key presence.",
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "description": "The unique identifier (snowflake) for this message",
              "$ref": "#/components/schemas/SnowflakeStringType"
            },
            "channel_id": {
              "description": "The ID of the channel this message was sent in",
              "$ref": "#/components/schemas/SnowflakeStringType"
            },
            "author": {
              "description": "The author of the message",
              "$ref": "#/components/schemas/UserPartialResponse"
            },
            "webhook_id": {
              "description": "The ID of the webhook that sent this message",
              "anyOf": [
                {
                  "$ref": "#/components/schemas/SnowflakeStringType"
                },
                {
                  "type": "null"
                }
              ]
            },
            "type": {
              "$ref": "#/components/schemas/MessageType"
            },
            "flags": {
              "$ref": "#/components/schemas/MessageFlags",
              "description": "The bitwise flags for this message"
            },
            "content": {
              "type": "string",
              "description": "The text content of the message"
            },
            "timestamp": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$",
              "description": "The ISO 8601 timestamp of when the message was created"
            },
            "edited_timestamp": {
              "description": "The ISO 8601 timestamp of when the message was last edited",
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time",
                  "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                },
                {
                  "type": "null"
                }
              ]
            },
            "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": {
              "description": "Channels mentioned in the message that are visible to @everyone",
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MessageChannelMentionResponse"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "users": {
              "description": "Users referenced from non-notifying content, embed, and snapshot text, included for client-side resolution",
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UserPartialResponse"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "embeds": {
              "description": "The embeds attached to the message",
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MessageEmbedResponse"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "attachments": {
              "description": "The files attached to the message",
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MessageAttachmentResponse"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "stickers": {
              "description": "The stickers sent with the message",
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MessageStickerResponse"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "reactions": {
              "description": "The reactions on the message",
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MessageReactionResponse"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "message_reference": {
              "description": "Reference data for replies or forwards",
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "channel_id": {
                      "description": "The ID of the channel containing the referenced message",
                      "$ref": "#/components/schemas/SnowflakeStringType"
                    },
                    "message_id": {
                      "description": "The ID of the referenced message, absent on a channel follow system message and on thread created messages that reference only a thread",
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/SnowflakeStringType"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "guild_id": {
                      "description": "The ID of the guild containing the referenced message",
                      "anyOf": [
                        {
                          "$ref": "#/components/schemas/SnowflakeStringType"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "type": {
                      "$ref": "#/components/schemas/MessageReferenceType"
                    }
                  },
                  "required": [
                    "channel_id",
                    "type"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "message_snapshots": {
              "description": "Snapshots of forwarded messages",
              "anyOf": [
                {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/MessageSnapshotResponse"
                  }
                },
                {
                  "type": "null"
                }
              ]
            },
            "nonce": {
              "description": "A client-provided value for message deduplication",
              "type": [
                "string",
                "null"
              ]
            },
            "call": {
              "description": "Call information if this message represents a call",
              "anyOf": [
                {
                  "type": "object",
                  "properties": {
                    "participants": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "The user IDs of participants in the call"
                    },
                    "ended_timestamp": {
                      "description": "The ISO 8601 timestamp of when the call ended",
                      "anyOf": [
                        {
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "required": [
                    "participants"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "null"
                }
              ]
            },
            "thread": {
              "description": "The thread started from this message, when the viewer can see threads",
              "$ref": "#/components/schemas/ThreadChannelResponse"
            }
          },
          "required": [
            "id",
            "channel_id",
            "author",
            "type",
            "flags",
            "content",
            "timestamp",
            "pinned",
            "mention_everyone",
            "tts",
            "mentions",
            "mention_roles"
          ],
          "additionalProperties": false
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "channel_id",
    "author",
    "type",
    "flags",
    "content",
    "timestamp",
    "pinned",
    "mention_everyone",
    "tts",
    "mentions",
    "mention_roles"
  ],
  "additionalProperties": false
}
400

Bad Request - The request was malformed or contained invalid data

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "description": "Field-specific validation errors",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Field path that failed validation"
          },
          "code": {
            "description": "Machine-readable validation error code",
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "Human-readable validation error message"
          }
        },
        "required": [
          "path",
          "message"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "code",
    "message"
  ],
  "additionalProperties": {}
}
401

Unauthorized - Authentication is required or the token is invalid

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "description": "Field-specific validation errors",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Field path that failed validation"
          },
          "code": {
            "description": "Machine-readable validation error code",
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "Human-readable validation error message"
          }
        },
        "required": [
          "path",
          "message"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "code",
    "message"
  ],
  "additionalProperties": {}
}
403

Forbidden - You do not have permission to perform this action

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "description": "Field-specific validation errors",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Field path that failed validation"
          },
          "code": {
            "description": "Machine-readable validation error code",
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "Human-readable validation error message"
          }
        },
        "required": [
          "path",
          "message"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "code",
    "message"
  ],
  "additionalProperties": {}
}
429

Too Many Requests - You are being rate limited

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "description": "Field-specific validation errors",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Field path that failed validation"
          },
          "code": {
            "description": "Machine-readable validation error code",
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "Human-readable validation error message"
          }
        },
        "required": [
          "path",
          "message"
        ],
        "additionalProperties": false
      }
    },
    "retry_after": {
      "type": "number",
      "description": "Seconds to wait before retrying"
    },
    "global": {
      "type": "boolean",
      "description": "Whether this is a global rate limit"
    }
  },
  "required": [
    "code",
    "message"
  ],
  "additionalProperties": {}
}
500

Internal Server Error - An unexpected error occurred

json
{
  "type": "object",
  "properties": {
    "code": {
      "type": "string",
      "description": "Machine-readable error code"
    },
    "message": {
      "type": "string",
      "description": "Human-readable error message"
    },
    "errors": {
      "description": "Field-specific validation errors",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "Field path that failed validation"
          },
          "code": {
            "description": "Machine-readable validation error code",
            "type": "string"
          },
          "message": {
            "type": "string",
            "description": "Human-readable validation error message"
          }
        },
        "required": [
          "path",
          "message"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "code",
    "message"
  ],
  "additionalProperties": {}
}