RESTGetAPIGuildMessagesSearchQuery
Index
Properties
optionalattachment_extension
Filter messages by attachment extension (e.g. txt) (max 256 characters, max 100)
optionalattachment_filename
Filter messages by attachment filename (max 1024 characters, max 100)
optionalauthor_id
Filter messages by these authors (max 100)
optionalauthor_type
Filter messages by author type
optionalchannel_id
Filter messages by these channels (max 500)
optionalcontent
Filter messages by content (max 1024 characters)
optionalembed_provider
Filter messages by embed provider (case-sensitive, e.g. Tenor) (max 256 characters, max 100)
optionalembed_type
Filter messages by embed type
optionalhas
Filter messages by whether or not they have specific things
optionalinclude_nsfw
Whether to include results from age-restricted channels
optionallimit
Max number of messages to return (1-25)
optionallink_hostname
Filter messages by link hostname (e.g. discordapp.com) (max 256 characters, max 100)
optionalmax_id
Get messages before this message ID
optionalmention_everyone
Filter messages that do or do not mention
optionalmentions
Filter messages that mention these users (max 100)
optionalmentions_role_id
Filter messages that mention these roles (max 100)
optionalmin_id
Get messages after this message ID
optionaloffset
Number to offset the returned messages by (max 9975)
optionalpinned
Filter messages by whether they are or are not pinned
optionalreplied_to_message_id
Filter messages that reply to these messages (max 100)
optionalreplied_to_user_id
Filter messages that reply to these users (max 100)
optionalslop
Max number of words to skip between matching tokens in the search content (max 100)
optionalsort_by
The sorting algorithm to use
optionalsort_order
The direction to sort (asc or desc)
Returns a list of messages without the
reactionskey that match a search query in the guild. Requires theREAD_MESSAGE_HISTORYpermission.The Search Guild Messages endpoint is restricted according to whether the
MESSAGE_CONTENTPrivileged Intent is enabled for your application.If the entity you are searching is not yet indexed, the endpoint will return a 202 accepted response. The response body will not contain any search results, and will look similar to an error response:
Due to speed optimizations, search may return slightly fewer results than the limit specified when messages have not been accessed for a long time. Clients should not rely on the length of the
messagesarray to paginate results.Additionally, when messages are actively being created or deleted, the
total_resultsfield may not be accurate.https://docs.discord.com/developers/resources/message#search-guild-messages