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 webhook token
message_id*pathSnowflakeTypeThe ID of the message
thread_idquery-

Request body

application/json

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

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": {}
}
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": {}
}