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)

cursorstring[]

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

max_idstring snowflake
min_idstring snowflake
contentstring

Text content to search for

contentsstring[]

Multiple content queries to search for

exact_phrasesstring[]

Exact phrases that must appear contiguously in message content

channel_idSnowflakeType[]

Channel IDs to search in

exclude_channel_idSnowflakeType[]

Channel IDs to exclude from search

author_typestring[]

Author types to filter by

exclude_author_typestring[]

Author types to exclude

author_idSnowflakeType[]

Author user IDs to filter by

exclude_author_idSnowflakeType[]

Author user IDs to exclude

mentionsSnowflakeType[]

User IDs that must be mentioned

exclude_mentionsSnowflakeType[]

User IDs that must not be mentioned

mention_everyoneboolean

Filter by whether message mentions everyone

pinnedboolean

Filter by pinned status

hasstring[]

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

exclude_hasstring[]

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_typestring[]

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

exclude_embed_typestring[]

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'

Field to sort results by

sort_order'asc' | 'desc'

Sort order for results

include_nsfwboolean

Whether to include NSFW channel results

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

Scope to search within when querying messages

context_channel_idstring snowflake
context_guild_idstring snowflake
channel_idsSnowflakeType[]

Specific channel IDs to search in

Response

Success

OR

Changes

No recorded changes to this endpoint across all 1 revision of this API.