> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: queryLoyaltyAccounts() # Method package: wixLoyaltyV2 # Method menu location: wixLoyaltyV2 --> accounts --> queryLoyaltyAccounts # Method Link: https://dev.wix.com/docs/velo/apis/wix-loyalty-v2/accounts/query-loyalty-accounts.md # Method Description: Creates a query to retrieve a list of accounts. The `queryLoyaltyAccounts()` method builds a query to retrieve a list of events and returns a `LoyaltyAccountsQueryBuilder` object. The returned object contains the query definition, which is typically used to run the query using the `find()` method. You can refine the query by chaining `LoyaltyAccountsQueryBuilder` methods onto the query. `LoyaltyAccountsQueryBuilder` methods enable you to sort, filter, and control the results `queryLoyaltyAccounts()` returns. `queryLoyaltyAccounts()` runs with these `LoyaltyAccountsQueryBuilder` defaults, which you can override: - `skip(0)` - `limit(50)` - `descending("_createdDate")` The methods that are chained to `queryLoyaltyAccounts()` are applied in the order they're called. For example, if you apply `ascending("points.balance")` and then `descending("points.earned")`, the results are sorted first by the balance, and then, if there are multiple results with the same balance, the items are sorted by earned points. |PROPERTY |SUPPORTED FILTERS & SORTING |:---:|:---:| |`_id`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`startsWith()`](/loyalty-accounts-query-builder/starts-with),[`gt()`](/loyalty-accounts-query-builder/gt),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`contactId`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`startsWith()`](/loyalty-accounts-query-builder/starts-with),[`gt()`](/loyalty-accounts-query-builder/gt),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`memberId`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`startsWith()`](/loyalty-accounts-query-builder/starts-with),[`gt()`](/loyalty-accounts-query-builder/gt),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`points.balance`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`gt()`](/loyalty-accounts-query-builder/gt),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`points.earned`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`gt()`](/loyalty-accounts-query-builder/gt),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`points.adjusted`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`gt()`](/loyalty-accounts-query-builder/gt),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`points.redeemed`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`gt()`](/loyalty-accounts-query-builder/gt),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`points.expired`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`gt()`](/loyalty-accounts-query-builder/gt),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`_createdDate`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`gt()`](/loyalty-accounts-query-builder/gt),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`lastActivityDate`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`gt()`](/loyalty-accounts-query-builder/gt),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`tier.id`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`startsWith()`](/loyalty-accounts-query-builder/starts-with),[`gt()`](/loyalty-accounts-query-builder/gt),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`contact.id`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`startsWith()`](/loyalty-accounts-query-builder/starts-with),[`gt()`](/loyalty-accounts-query-builder/gt),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`pointsExpiration.expirationDate`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`gt()`](/loyalty-accounts-query-builder/gt),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| |`pointsExpiration.expiringPointsAmount`|[`eq()`](/loyalty-accounts-query-builder/eq),[`ne()`](/loyalty-accounts-query-builder/ne),[`exists()`](/loyalty-accounts-query-builder/exists),[`in()`](/loyalty-accounts-query-builder/in),[`hasSome()`](/loyalty-accounts-query-builder/has-some),[`lt()`](/loyalty-accounts-query-builder/lt),[`le()`](/loyalty-accounts-query-builder/le),[`gt()`](/loyalty-accounts-query-builder/gt),[`ge()`](/loyalty-accounts-query-builder/ge),[`ascending()`](/loyalty-accounts-query-builder/ascending),[`descending()`](/loyalty-accounts-query-builder/descending)| # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## queryLoyaltyAccounts example for dashboard page code ```javascript import { accounts } from 'wix-loyalty.v2'; async function queryLoyaltyAccounts() { const { items } = accounts.queryLoyaltyAccounts().find(); } ``` ## queryLoyaltyAccounts example for exporting from backend code ```javascript import { accounts } from 'wix-loyalty.v2'; import { webMethod, Permissions } from 'wix-web-module'; import { elevate } from 'wix-auth'; const elevatedQueryLoyaltyAccounts = elevate(accounts.queryLoyaltyAccounts); export const queryLoyaltyAccounts = webMethod( Permissions.Anyone, async (query) => { try { const result = await elevatedQueryLoyaltyAccounts(query); return result; } catch (error) { console.error(error); // Handle the error } } ); ``` ---