Search

Search messages

Searches for messages across guilds and channels accessible to the authenticated user. Bots must supply a context guild or channel and may only use the current scope.

post/search/messages

Request body

hits_per_pageinteger

Number of results per page (1-25)

pageinteger

Page number for pagination (ignored when cursor is provided). Use cursor to page beyond this.

cursorstring[]

Opaque cursor for search_after pagination. When provided, page is ignored.

contentstring

Text content to search for

contentsstring[]

Multiple content queries to search for

exact_phrasesstring[]

Exact phrases that must appear contiguously in message content

author_typeMessageAuthorType[]

Author types to filter by

exclude_author_typeMessageAuthorType[]

Author types to exclude

mention_everyoneboolean

Filter by whether message mentions everyone

pinnedboolean

Filter by pinned status

hasMessageContentType[]

Content flags the message must have. Use image, video, sound, or file for uploaded attachments and embed for link previews or rich embeds.

exclude_hasMessageContentType[]

Content flags the message must not have. Use image, video, sound, or file for uploaded attachments and embed for link previews or rich embeds.

embed_typeMessageEmbedType[]

Generated or supplied embed types to filter by; does not match uploaded attachments

exclude_embed_typeMessageEmbedType[]

Generated or supplied embed types to exclude; does not match uploaded attachments

embed_providerstring[]

Embed providers to filter by

exclude_embed_providerstring[]

Embed providers to exclude

link_hostnamestring[]

Link hostnames to filter by

exclude_link_hostnamestring[]

Link hostnames to exclude

attachment_filenamestring[]

Attachment filenames to filter by

exclude_attachment_filenamestring[]

Attachment filenames to exclude

attachment_extensionstring[]

File extensions to filter by

exclude_attachment_extensionstring[]

File extensions to exclude

sort_by'timestamp' | 'relevance'

The field to sort search results by

sort_order'asc' | 'desc'

The order to sort search results

include_nsfwboolean

Whether to include NSFW channel results

scope'current' | 'open_dms' | 'all_dms' | 'all_guilds' | 'all' | 'open_dms_and_all_guilds'

Search scope for message searches

Response

Success

OR

Changes