> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> 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`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# GetCurrentMemberAccount

# Package: accounts

# Namespace: LoyaltyAccounts

# Method link: https://dev.wix.com/docs/api-reference/crm/loyalty-program/accounts/accounts/get-current-member-account?apiView=SDK.md

## Permission Scopes:
Read Loyalty: SCOPE.DC-LOYALTY.READ-LOYALTY

## Introduction

Retrieves the current member's loyalty account.

---

## REST API

### Schema

```
 Method: getCurrentMemberAccount
 Description: Retrieves the current member's loyalty account.
 URL: https://www.wixapis.com/loyalty-accounts/v1/accounts/my-account
 Method: GET
 Return type: GetCurrentMemberAccountResponse
  - name: account | type: LoyaltyAccount | description: Loyalty account.  
     - name: id | type: string | description: Account GUID.  | read-only: true | validation: format GUID
     - name: contactId | type: string | description: Account owner's contact GUID. See the Contacts API to learn more about a site's contacts.  | read-only: true | validation: format GUID
     - name: memberId | type: string | description: Member GUID of the account owner. See the Members API to learn more about a site's members.  | read-only: true | validation: format GUID
     - name: points | type: Points | description: Details of the account's point totals.  | read-only: true 
        - name: balance | type: integer | description: Current points balance.  Equal to the sum of `earned` and `adjusted` points, minus `redeemed` points.  | read-only: true | validation: minimum 0
        - name: earned | type: integer | description: Total earned points.  | read-only: true | validation: minimum 0
        - name: adjusted | type: integer | description: Total adjusted points.  | read-only: true | validation: minimum 0
        - name: redeemed | type: integer | description: Total redeemed points.  | read-only: true | validation: minimum 0
        - name: expired | type: integer | description: Total expired points.  | read-only: true | validation: minimum 0
     - name: rewardAvailable | type: boolean | description: Whether the account has enough points in `points.balance` to redeem for a reward.  | read-only: true 
     - name: createdDate | type: string | description: Date and time the account was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the account was last updated.  | read-only: true | validation: format date-time
     - name: lastActivityDate | type: string | description: Date and time of the account's last activity.  | read-only: true | validation: format date-time
     - name: revision | type: number | description: Revision number, which increments by 1 each time the loyalty account is updated.  To prevent conflicting changes, the current `revision` must be passed when updating the loyalty account.  Ignored when creating an account.  
     - name: tier | type: Tier | description: Tier information.  See the Tiers API for more information.  | read-only: true 
        - name: id | type: string | description: Tier GUID.  This field will not be returned if the account belongs to the base tier.  | read-only: true | validation: format GUID
        - name: updatedDate | type: string | description: Date and time the tier information was last recalculated.  | read-only: true | validation: format date-time
        - name: points | type: integer | description: Points earned and adjusted over the tier's current rolling window.  | read-only: true | validation: minimum 0
     - name: contact | type: Contact | description: Contact information.  | read-only: true 
        - name: id | type: string | description: Contact GUID.  | read-only: true | validation: format GUID
        - name: name | type: string | description: Contact's first and last name.  | read-only: true 
        - name: picture | type: Image | description: Contact's profile picture.  | read-only: true 
           - name: id | type: string | description: WixMedia image GUID.  
           - name: url | type: string | description: Image URL.  
           - name: height | type: integer | description: Original image height.  | read-only: true 
           - name: width | type: integer | description: Original image width.  | read-only: true 
        - name: email | type: string | description: Contact's email address.  | read-only: true | validation: format EMAIL
        - name: displayName | type: string | description: Contact's first and last name. If no name is provided, uses contact's email.  | read-only: true 
     - name: pointsExpiration | type: PointsExpiration | description: Points expiration information.  | read-only: true 
        - name: expirationDate | type: string | description: Date and time at which points are expiring.  | read-only: true | validation: format date-time
        - name: expiringPointsAmount | type: integer | description: Amount of points that are going to expire at that date.  | read-only: true 


```

### Examples

### Get currently logged-in member account
```curl
curl -X GET \
  'https://www.wixapis.com/loyalty-accounts/v1/accounts/my-account' \
  -H 'Authorization: <AUTH>'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.loyalty.accounts.getCurrentMemberAccount()
 Description: Retrieves the current member's loyalty account.
 Return type: PROMISE<GetCurrentMemberAccountResponse>
  - name: account | type: LoyaltyAccount | description: Loyalty account.  
     - name: _id | type: string | description: Account GUID.  | read-only: true | validation: format GUID
     - name: contactId | type: string | description: Account owner's contact GUID. See the Contacts API to learn more about a site's contacts.  | read-only: true | validation: format GUID
     - name: memberId | type: string | description: Member GUID of the account owner. See the Members API to learn more about a site's members.  | read-only: true | validation: format GUID
     - name: points | type: Points | description: Details of the account's point totals.  | read-only: true 
        - name: balance | type: integer | description: Current points balance.  Equal to the sum of `earned` and `adjusted` points, minus `redeemed` points.  | read-only: true | validation: minimum 0
        - name: earned | type: integer | description: Total earned points.  | read-only: true | validation: minimum 0
        - name: adjusted | type: integer | description: Total adjusted points.  | read-only: true | validation: minimum 0
        - name: redeemed | type: integer | description: Total redeemed points.  | read-only: true | validation: minimum 0
        - name: expired | type: integer | description: Total expired points.  | read-only: true | validation: minimum 0
     - name: rewardAvailable | type: boolean | description: Whether the account has enough points in `points.balance` to redeem for a reward.  | read-only: true 
     - name: _createdDate | type: Date | description: Date and time the account was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the account was last updated.  | read-only: true 
     - name: lastActivityDate | type: Date | description: Date and time of the account's last activity.  | read-only: true 
     - name: revision | type: number | description: Revision number, which increments by 1 each time the loyalty account is updated.  To prevent conflicting changes, the current `revision` must be passed when updating the loyalty account.  Ignored when creating an account.  
     - name: tier | type: Tier | description: Tier information.  See the Tiers API for more information.  | read-only: true 
        - name: _id | type: string | description: Tier GUID.  This field will not be returned if the account belongs to the base tier.  | read-only: true | validation: format GUID
        - name: _updatedDate | type: Date | description: Date and time the tier information was last recalculated.  | read-only: true 
        - name: points | type: integer | description: Points earned and adjusted over the tier's current rolling window.  | read-only: true | validation: minimum 0
     - name: contact | type: Contact | description: Contact information.  | read-only: true 
        - name: _id | type: string | description: Contact GUID.  | read-only: true | validation: format GUID
        - name: name | type: string | description: Contact's first and last name.  | read-only: true 
        - name: picture | type: Image | description: Contact's profile picture.  | read-only: true 
           - name: _id | type: string | description: WixMedia image GUID.  
           - name: url | type: string | description: Image URL.  
           - name: height | type: integer | description: Original image height.  | read-only: true 
           - name: width | type: integer | description: Original image width.  | read-only: true 
        - name: email | type: string | description: Contact's email address.  | read-only: true | validation: format EMAIL
        - name: displayName | type: string | description: Contact's first and last name. If no name is provided, uses contact's email.  | read-only: true 
     - name: pointsExpiration | type: PointsExpiration | description: Points expiration information.  | read-only: true 
        - name: expirationDate | type: Date | description: Date and time at which points are expiring.  | read-only: true 
        - name: expiringPointsAmount | type: integer | description: Amount of points that are going to expire at that date.  | read-only: true 


```

### Examples

### Get current member account
```javascript
import { accounts } from "@wix/loyalty";

async function getCurrentMemberAccount() {
  try {
    const result = await accounts.getCurrentMemberAccount();
    return result;
  } catch (error) {
    console.error(error);
    // Handle the error
  }
}

/*
 * Promise resolves to:
 *
 * {
 *     "account": {
 *         "_createdDate": "2024-06-06T12:46:55.496Z",
 *         "_id": "d0dc5ba3-4a10-4cfc-b304-c976d8ac7303",
 *         "_updatedDate": "2024-06-10T15:27:33.039Z",
 *         "contact": {
 *             "name": "Elena Rodriguez",
 *             "picture": {
 *                 "url": "https://lh3.googleusercontent.com/a/ACg8ocIYi6J3Jd-V88AyFM27n-LU_-WZmmZy04kU_UfYODaSDwipBgQ%3Ds96-c",
 *                 "height": 0,
 *                 "width": 0,
 *                 "_id": ""
 *             },
 *             "email": "elena.rodriguez@example.com",
 *             "displayName": "Elena Rodriguez",
 *             "_id": "6ef3fe0f-9e33-42d3-8abe-61d5560338b2"
 *         },
 *         "contactId": "6ef3fe0f-9e33-42d3-8abe-61d5560338b2",
 *         "lastActivityDate": "2024-06-10T15:27:30.954Z",
 *         "memberId": "7d368843-6f0c-4037-8d0e-b7e36a8a0c32",
 *         "points": {
 *             "balance": 50,
 *             "earned": 0,
 *             "adjusted": 70,
 *             "redeemed": 20,
 *             "expired": 0
 *         },
 *         "pointsExpiration": {
 *             "expirationDate": "2024-09-10T15:27:31.268Z",
 *             "expiringPointsAmount": 50
 *         },
 *         "revision": "21",
 *         "rewardAvailable": true,
 *         "tier": {
 *             "points": 70,
 *             "_updatedDate": "2024-06-10T15:27:31.041Z"
 *         }
 *     }
 * }
 */
```

### getCurrentMemberAccount (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { accounts } from '@wix/loyalty';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { accounts },
  // Include the auth strategy and host as relevant
});


async function getCurrentMemberAccount() {
  const response = await myWixClient.accounts.getCurrentMemberAccount();
};
```

---