patch/webhooks/{webhook_id}/{token}/messages/{message_id}

Edit webhook message

Edits a message previously sent by the webhook. Only messages authored by the webhook can be edited. Returns the updated message object.

edit_webhook_message

Parameters

NameInTypeDescription
webhook_id*pathSnowflakeTypeThe ID of the webhook
token*pathstringThe token
message_id*pathSnowflakeTypeThe ID of the message

Request body

application/json

json
{
  "type": "object",
  "properties": {
    "content": {
      "anyOf": [
        {
          "$ref": "#/components/schemas/MessageContentRequest"
        },
        {
          "type": "null"
        }
      ],
      "description": "The new message content (up to 4000 characters)"
    },
    "embeds": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/RichEmbedRequest"
      },
      "description": "Array of embed objects to include in the message"
    },
    "flags": {
      "$ref": "#/components/schemas/MessageFlags"
    },
    "allowed_mentions": {
      "anyOf": [
        {
          "$ref": "#/components/schemas/AllowedMentionsRequest"
        },
        {
          "type": "null"
        }
      ],
      "description": "Controls which mentions trigger notifications"
    }
  }
}

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"
  ]
}
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"
  ]
}