About the Members API
The Members API allows you to create and manage a site's members.
With the Members API, you can:
- Create, update, and delete site members.
- Retrieve member's information from your site.
- Add the currently logged in member to your site's community, or remove the member from your site's community.
- Clear a member's contact information such as their addresses, phone numbers, and emails.
Before you begin
It’s important to note that you must have a site with a members area.
Terminology
- Members: Site visitors who have signed up as members through your site's Member Signup Form. Members have their own profiles and can interact with other members of the site community.
- Site Community: A platform on your site where members can interact with eachother.
Setup
To use the Members API, install the @wix/members
package using npm or Yarn:
1npm install @wix/members
or
1yarn add @wix/members
Then import { members }
from @wix/members
:
1import { members } from '@wix/members'
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Creates a site member.
After creation, you can use the sendSetPasswordEmail()
function in the Members Authentication API to email the member with a link to set their password.
The member can log in to the site once they set their password for the first time.
Note: When creating multiple members, set your requests at least 1 second apart to keep below rate limits.
Permission Scopes
For app development, you must have one of the following permission scopes:function createMember(member: Member): Promise<Member>
Deletes a member.
The deleteMember()
function returns a Promise that resolves to a member object when the specified member is deleted.
Note: This function permanently deletes a member. Once deleted, a member cannot be restored.
Permission Scopes
For app development, you must have one of the following permission scopes:function deleteMember(_id: string): Promise<void>
Deletes a member's street addresses.
The deleteMemberAddresses()
function clears the addresses
array under the contact
property.
Note: Only logged-in members can call this function without elevated permissions. To call this function as a different identity, elevated permissions are required.
Permission Scopes
For app development, you must have one of the following permission scopes:function deleteMemberAddresses(_id: string): Promise<DeleteMemberAddressesResponse>
Clears a member's email addresses.
The deleteMemberEmails()
function clears the emails
array under the contact
property.
Notes:
A member can still log in with their loginEmail
,
which is not cleared when this function is called.
Only logged-in members can call this function without elevated permissions. To call this function as a different identity, elevated permissions are required.
Permission Scopes
For app development, you must have one of the following permission scopes:function deleteMemberEmails(_id: string): Promise<DeleteMemberEmailsResponse>
Clears a member's phone numbers.
The deleteMemberPhones()
function clears the phones
array under the contact
property.
Note: Only logged-in members can call this function without elevated permissions. To call this function as a different identity, elevated permissions are required.
Permission Scopes
For app development, you must have one of the following permission scopes:function deleteMemberPhones(_id: string): Promise<DeleteMemberPhonesResponse>
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves the currently logged-in member.
Permission Scopes
For app development, you must have one of the following permission scopes:function getCurrentMember(options: GetCurrentMemberOptions): Promise<GetMyMemberResponse>
Retrieves a member by ID.
Note: The returned Member object contains only the fields that were explicitly added to the Member object. Custom Contact fields are not automatically added to the Member object. They must be added to the Member object by the site owner.
Permission Scopes
For app development, you must have one of the following permission scopes:function getMember(_id: string, options: GetMemberOptions): Promise<Member>
Joins the currently logged-in member to the site community and sets their profile to public.
When a member's profile is public, they have access to the site's Members Area features — such as chat, forum, and followers — and their profile is visible to other members and site visitors.
Note: Only logged-in members can call this function without elevated permissions. To call this function as a different identity, elevated permissions are required.
Permission Scopes
For app development, you must have one of the following permission scopes:function joinCommunity(): Promise<JoinCommunityResponse>
Removes the currently logged-in member from the site community and sets their profile to private.
When a member's profile is private, they do not have access to the site's Members Area features — such as chat, forum, and followers — and their profile is hidden from other members and site visitors.
Notes:
- If a member leaves the site's community, their content (such as forum posts and blog comments) remain publicly visible.
- Only logged-in members can call this function without elevated permissions.
- To call this function as a different identity, elevated permissions are required.
Permission Scopes
For app development, you must have one of the following permission scopes:function leaveCommunity(): Promise<LeaveCommunityResponse>
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Lists site members, given the provided paging and fieldsets.
PUBLIC
fieldset returnsid
andprofile
object.status
,privacyStatus
andactivityStatus
are returned asUNKNOWN
.FULL
fieldset returns all fields.
Permission Scopes
For app development, you must have one of the following permission scopes:function listMembers(options: ListMembersOptions): Promise<ListMembersResponse>
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Retrieves a list of up to 100 members, given the provided filters, fieldsets, sorting and paging, and returns a MembersQueryBuilder
object.
The returned object contains the query definition which is typically used to run the query using the find()
function.
You can refine the query by chaining MembersQueryBuilder
functions onto the query. MembersQueryBuilder
functions enable you to sort, filter, and control the results that queryMembers()
returns. The functions that are chained to queryMembers()
are applied in the order they are called.
queryMembers()
runs with the following MembersQueryBuilder
defaults that you can override:
skip
:0
limit
:50
Currently supported fields for sorting:
profile.nickname
contact.firstName
contact.lastName
createdDate
lastLoginDate
The following MembersQueryBuilder
functions are supported for the queryMembers()
function. For a full description of the Locations object, see the returned for the items
property in MembersQueryResult
.
PROPERTY | SUPPORTED FILTERS & SORTING |
---|---|
_id | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() |
loginEmail | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() |
contact.firstName | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() |
contact.lastName | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() |
profile.nickname | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() |
profile.slug | eq() ,ne() ,exists() ,in() ,hasSome() ,startsWith() |
privacyStatus | eq() ,ne() ,exists() ,in() ,hasSome() |
Permission Scopes
For app development, you must have one of the following permission scopes:function queryMembers(options: QueryMembersOptions): MembersQueryBuilder
This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Updates the currently logged in member's slug.
The slug
is the end of a member's URL that refers to a specific logged-in member. For example, if a member's URL is https://example.com/member/{my-member-slug}
, the slug is my-member-slug
. The slug is case-sensitive and is generally derived from the member's nickname
; otherwise, it's derived from the loginEmail
.
Note: Only logged-in members can call this function without elevated permissions. To call this function as a different identity, elevated permissions are required.
Permission Scopes
For app development, you must have one of the following permission scopes:function updateCurrentMemberSlug(slug: string): Promise<UpdateMySlugResponse>
Updates a member's properties.
Only the requested fields are updated.
To clear a field's value, set an empty value with an empty string ""
.
Note:
Updating the contact.addresses
, contact.emails
, or contact.phones
array overwrites the entire array, so any existing values you want to retain must be passed in the updateMember()
call along with the new values to add.
However, passing an empty array will have no effect, and these functions must be used to clear all data from the respective array:
- To clear
contact.addresses
, usedeleteMemberAddresses()
. - To clear
contact.emails
, usedeleteMemberEmails()
. - To clear
contact.phones
, usedeleteMemberPhones()
.
Note: Only logged-in members can call this function without elevated permissions. To call this function as a different identity, elevated permissions are required.
Permission Scopes
For app development, you must have one of the following permission scopes:function updateMember(_id: string, member: UpdateMember): Promise<Member>