searchAccounts( )


Retrieves a list of accounts, given the provided filters and search capabilities. Search is executed on the account's name and email values.

Authentication
  • When developing websites or building an app with Blocks, this method may require elevated permissions, depending on the identity of the user calling it and the calling user’s permissions.
  • When building apps without Blocks or for headless projects, you can only call this method directly when authenticated as a Wix app or Wix user identity. When authenticated as a different identity, you can call this method using elevation.
  • Elevation permits users to call methods they typically cannot access. Therefore, you should only use it intentionally and securely.
Permissions
Manage Loyalty
Read Loyalty
Learn more about app permissions.
Method Declaration
Copy
function searchAccounts(
  options: SearchAccountsOptions,
): Promise<SearchAccountsResponse>;
Method Parameters
optionsSearchAccountsOptions
Returns
Return Type:Promise<SearchAccountsResponse>
JavaScript
import { accounts } from "@wix/loyalty"; /* Sample options value: * * { * "options": null * } */ export async function searchAccounts(options) { try { const result = await accounts.searchAccounts(options); return result; } catch (error) { console.error(error); // Handle the error } } /* Promise resolves to: * * { * "accounts": [ * { * "_createdDate": "2024-06-10T15:26:12.553Z", * "_id": "12cebdaf-2b05-4224-baea-2e53d4e13b41", * "_updatedDate": "2024-06-10T15:26:46.454Z", * "contact": { * "name": "Lucas Chang", * "email": "lucas.chang@example.com", * "displayName": "Lucas Chang", * "_id": "82f12a1e-cc06-497a-8967-28440510471a" * }, * "contactId": "82f12a1e-cc06-497a-8967-28440510471a", * "lastActivityDate": "2024-06-10T15:26:12.758Z", * "description": "Sign up to the site", * "appId": "SiteMembers", * "idempotencyKey": "82f12a1e-cc06-497a-8967-28440510471a:c138c707-029a-461b-a6b7-9ba796e61fcac96b503d-5af1-4fd1-b224-ae920ede83c3", * "_id": "3eed23eb-9869-48c9-b49b-b1b39bc36d0d", * "_createdDate": "2024-06-10T15:26:12.758Z" * }, * "points": { * "balance": 50, * "earned": 50, * "adjusted": 0, * "redeemed": 0, * "expired": 0 * }, * "pointsExpiration": { * "expirationDate": "2024-09-10T15:26:13.001Z", * "expiringPointsAmount": 50 * }, * "revision": "5", * "rewardAvailable": true, * "tier": { * "points": 50, * "_updatedDate": "2024-06-10T15:26:12.825Z" * }, * "memberId": "82f12a1e-cc06-497a-8967-28440510471a" * }, * { * "_createdDate": "2024-06-10T15:26:16.832Z", * "_id": "5e6e67fd-7cd0-42ae-abc6-3a651f0593c4", * "_updatedDate": "2024-06-10T15:26:50.119Z", * "contact": { * "name": "Amir Khan", * "email": "amir.khan@example.com", * "displayName": "Amir Khan", * "_id": "bb3ed529-4722-440c-8a71-af808ffc12fd" * }, * "contactId": "bb3ed529-4722-440c-8a71-af808ffc12fd", * "lastActivityDate": "2024-06-10T15:26:16.944Z", * "points": { * "balance": 50, * "earned": 50, * "adjusted": 0, * "redeemed": 0, * "expired": 0 * }, * "pointsExpiration": { * "expirationDate": "2024-09-10T15:26:17.186Z", * "expiringPointsAmount": 50 * }, * "revision": "5", * "rewardAvailable": true, * "tier": { * "points": 50, * "_updatedDate": "2024-06-10T15:26:16.996Z" * }, * "memberId": "bb3ed529-4722-440c-8a71-af808ffc12fd" * }, * { * "_createdDate": "2024-06-10T15:17:35.120Z", * "_id": "866bdab0-d192-40f7-8821-fbfca2961c27", * "_updatedDate": "2024-06-10T15:33:29.015Z", * "contact": { * "name": "Elena Rodriguez", * "email": "elena.rodriguez@example.com", * "displayName": "Elena Rodriguez", * "_id": "2bb7d76e-de13-4909-ac12-8ab763d4b233" * }, * "contactId": "2bb7d76e-de13-4909-ac12-8ab763d4b233", * "lastActivityDate": "2024-06-10T15:31:02.699Z", * "points": { * "balance": 230, * "earned": 50, * "adjusted": 180, * "redeemed": 0, * "expired": 0 * }, * "pointsExpiration": { * "expirationDate": "2024-09-10T15:17:35.538Z", * "expiringPointsAmount": 230 * }, * "revision": "8", * "rewardAvailable": true, * "tier": { * "points": 230, * "_id": "b8501f07-a34f-4608-b9b0-168e6c6c505a", * "_updatedDate": "2024-06-10T15:31:02.783Z" * }, * "memberId": "2bb7d76e-de13-4909-ac12-8ab763d4b233" * } * ], * "pagingMetadata": { * "count": 5, * "cursors": {}, * "hasNext": false * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?