Skip to content

Guild member search

Member search filters, sorts and pages a guild's members by name, role, join time and account type. It powers the Members page in guild settings. Each match is a guild member search result.

The route is relative to https://tebhos.com/api/v1, requires authentication and accepts both user sessions and bot tokens. Error bodies follow Errors.

Results always come from the member records

Filtering, sorting and paging run over the guild's stored memberships, so results are current. When the request has a text query, TEBHOS asks its search engine for relevance order; if the engine is unavailable, it falls back to substring matching on the same records. indexing is always false.

Join source types

The search result and the join_source_type filter use these values.

Value Name Description
0 CREATOR Member created the guild
1 INSTANT_INVITE Member joined through an invite
2 VANITY_URL Member joined through the custom invite code
3 BOT_INVITE Account was added through a bot authorisation
4 ADMIN_FORCE_ADD An instance administrator added the member
6 DISCOVERY Member joined through discovery

Join source is not recorded yet

TEBHOS does not currently record a join source type when a membership is created, so supplemental.join_source_type is always null. A join_source_type filter sent by a caller with MANAGE_GUILD therefore matches no members. source_invite_code is recorded for members who joined through an invite.

Guild member search result object

A matched membership. Account fields are at the top level rather than under user.

Field Type Description
id string The result identifier, {guild_id}:{user_id}. No other route accepts it
guild_id snowflake The ID of the guild
user_id snowflake The ID of the member's account
username string The account username (empty when none is set)
discriminator string The account discriminator, left-padded to four digits
global_name ?string The account display name
nickname ?string The member's nickname in this guild
role_ids array[snowflake] The member's role IDs in ascending order. @everyone is never included
joined_at integer When the account joined the guild, in Unix seconds
supplemental supplemental object Join metadata
is_bot boolean Whether the account is a bot
{
  "id": "1489002177550843904:1489002177550843906",
  "guild_id": "1489002177550843904",
  "user_id": "1489002177550843906",
  "username": "ada",
  "discriminator": "0042",
  "global_name": "Ada",
  "nickname": null,
  "role_ids": ["1489002177550843910"],
  "joined_at": 1755158400,
  "supplemental": {"join_source_type": null, "source_invite_code": "a1b2c3d4", "inviter_id": "1489002177550843905"},
  "is_bot": false
}

The result has no avatar, timeout or voice fields. Use Get guild member for the full membership.

Guild member search supplemental object

Field Type Description
join_source_type ?integer The join source type. Currently always null
source_invite_code ?string The invite code the member joined with
inviter_id ?snowflake The account that created that invite

Every field is null unless the caller is the guild owner or holds MANAGE_GUILD (or ADMINISTRATOR). A null value therefore does not tell you whether the data exists.

Guild member search response object

Field Type Description
guild_id snowflake The ID of the guild
members array[guild member search result object] The requested page
page_result_count integer The number of results in members
total_result_count integer The total number of members matching the filters
indexing boolean Always false

Search guild members

POST /guilds/{guild_id}/members-search

Returns a guild member search response. The caller must be a member and must be the owner or hold at least one of MANAGE_GUILD, MANAGE_ROLES, MANAGE_NICKNAMES, BAN_MEMBERS, MODERATE_MEMBERS, KICK_MEMBERS or ADMINISTRATOR.

Rate limit: guild:members, 40 per 10 seconds per account and guild (shared with the member reads and List guild bans).

JSON body

Every field is optional, and an empty object {} returns the first page of all members.

Field Type Description
query? string Text to match (max 100 characters). Trimmed; an empty value applies no text filter
limit? integer Page size, 1-100 (default 25)
offset? integer Number of matches to skip, at least 0 (default 0)
role_ids? array[snowflake] Roles a member must all hold (max 10)
joined_at_gte? integer Unix seconds; members who joined at or after this time
joined_at_lte? integer Unix seconds; members who joined at or before this time
join_source_type? array[integer] Join source types to include (max 10). Applied only for callers with MANAGE_GUILD
source_invite_code? array[string] Invite codes to include (max 10). Applied only for callers with MANAGE_GUILD
is_bot? boolean true for bot accounts only, false for non-bot accounts only
user_created_at_gte? integer Unix seconds; accounts created at or after this time (derived from the user ID)
user_created_at_lte? integer Unix seconds; accounts created at or before this time
sort_by? string joinedAt or relevance
sort_order? string asc or desc

Text matching. Without the search engine, query matches the member's nickname, display name or username (case-insensitive: exact match first, then prefix, then substring) or exactly equals the user ID. With the engine, the engine decides which members match and in what order; the filters above still apply to its matches.

Sorting. With a query and no sort_by, or with sort_by relevance, results are ordered by relevance and then by join time. Otherwise they are ordered by join time, oldest first, or newest first with sort_order desc. Ties are broken by user ID.

Status Code Condition
400 BAD_REQUEST A value is out of range, a list has more than 10 entries, a role ID is not a snowflake, or sort_by/sort_order is not an accepted value
403 FORBIDDEN The caller is not a member
403 MISSING_PERMISSIONS The caller holds none of the required permissions
curl -X POST https://tebhos.com/api/v1/guilds/1489002177550843904/members-search \
  -H "Authorization: Bearer $TEBHOS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query": "ada", "role_ids": ["1489002177550843910"], "limit": 50}'