GET returns the matching messages, newest first. Each carries the full text, an excerpt with the match marked, and the author, channel and server it came from.
This is an expert search: one indexed source, searched on its own terms. To watch a term continuously instead, create a monitor on the Discord source.
Availability and cost
Availability: Telegram/Discord Monitoring. The same plan feature covers Telegram. Plans and quotas lists what each plan includes. Cost: no metered allowance. As with every call made with an API key, each call that returns2xx counts once against your monthly API Calls allowance. See Rate limits.
Without the feature, or when your license is not active, create_discord_search, retrieve_discord_servers and retrieve_discord_search_history return 403:
403 with {"detail": "Your license is not active."}.
No call on this page draws a metered allowance, so a 429 here always comes from the per-second rate limit or the API Calls allowance. Errors explains each body.
Search
create_discord_search runs the search and returns one page of matches.
q is one piece of text, matched as a case-insensitive substring of the message text or the author’s name. Operators are not read: acme.com OR acme-login.com looks for that exact text. Run one search per term.
To read the next page, raise
skip by limit. Each call runs the search again and, unless you send _save_to_history=false, saves another entry. Send false on every page after the first.
What comes back
total— messages that match.total_is_estimate—truewhen the exact count took more than 3 seconds.totalis then a lower bound:skipplus the matches on this page.search_history_id— the ID of the saved search, ornullwhen you sent_save_to_history=false. Use it to export the results.
results is one message:
content— the full message text.content_highlighted— an excerpt about twicecontext_charswide that starts about 60 characters before the first match. The match is wrapped in[[HIGHLIGHT]]and[[/HIGHLIGHT]]....marks trimmed text.context— the same excerpt split intobefore,matchandafter, plusmatch_position, the match’s offset incontent. Whenqmatched only the author’s name,match_positionis-1,matchis empty and the excerpt is the start of the message.posted_at,edited_at— when the message was posted and last edited.edited_atisnullfor an unedited message.is_pinned— whether the message is pinned in its channel.author,channel,server— each asnameandid.embeds— the message’s embeds as Discord stored them.
IDs are Discord IDs of up to 19 digits. Search results return
author.id, channel.id and server.id as JSON numbers, which JavaScript’s JSON.parse rounds. Parse them as 64-bit integers or strings. retrieve_discord_servers returns the same IDs as strings. Send them as digits in server_id or channel_id.Servers and channels
retrieve_discord_servers lists the tracked servers that are still collected, largest first. The list is the same for every organization.
- The response holds
total,skip,limitandservers. skipdefaults to0.limitis 1 to 1000, default100.include_channels=trueadds each server’schannels. It isnullwhen you leave it out, and also for a server with no channels.totalis the number of servers in this response, not across all pages. Raiseskipbylimituntil a response holds fewer thanlimitservers.
id, name, description, member_count, icon_url, discovered_at and last_scraped_at. Each channel carries id, name, type and message_count.
List saved searches
retrieve_discord_search_history lists your organization’s saved Discord searches, newest first.
pageis 1-based.page_sizedefaults to20, max200.- The response holds
items,total,pageandpage_size. - Each item carries
id(thesearch_history_id, as a string),query,searched_atandtotal_matches.
Export the results
Export a saved search through the export service with theDiscordSearch catalog entry. Pass the search_history_id as history_id. The entry offers CSV, JSON, XML and PDF. The export runs the saved search again, newest first, and holds up to 10,000 messages. It matches q against the message text only, not the author’s name.