Query Members

Last Edit: Sep 22 2020

Sometimes channels will have many hundreds (or thousands) of members and it is important to be able to access ID's and information on all of these members. The queryMembers endpoint queries the channel members and allows the user to paginate through a full list of users in channels with very large member counts. The endpoint supports filtering on numerous criteria to efficiently return member information.

The members are sorted by created_at in ascending order.
Stream Chat does not run MongoDB on the backend, only a subset of the query options are available.

Here’s some example of how you can query the list of members:

// query members by user.name
const {members} = await channel.queryMembers({'name':'tommaso'})

// query members with name containing tom

// autocomplete members by user name

// query member by id

// query multiple members by id

// query channel moderators

// query for banned members in channel

// query members with pending invites

// query all the members 

// paginate channel members
channel.queryMembers({}, {}, {limit:10,offset:10})

// order results by member created at descending
channel.queryMembers({}, {created_at:-1})

Query Parameters

Name Type Description Default Optional
filters object The query filters to use. You can query on any of the custom fields defined above {}
sort object the sort parameters { created_at:1}
options object pagination options { limit:100, offset:0}
By default when query members does not have any filter and it will match all members on your channel.

Member Queryable Built-In Fields

The following channel fields can be used to filter your query results

Name Type Description Example
id string the id of the user tom
name string the name of the user Tommaso
is_moderator boolean the member role true
banned boolean the banned status false
invite string, must be one of these values: (pending, accepted, rejected) the status of the invite pending

Query Options

Name Type Description Default Optional
limit integer The number of members to return (max is 100) 100
offset integer The offset (max is 10000) 0


The result of query Members is a  QueryMembersResponse object which include all the matched members within the limit


Field Name Description
members The list of members, up to 100 ordered by the most recent added