> 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

# GetLoyaltyProgram

# Package: loyaltyProgramManagement

# Namespace: LoyaltyPrograms

# Method link: https://dev.wix.com/docs/api-reference/crm/loyalty-program/loyalty-program-management/program/get-loyalty-program.md

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

## Introduction

Retrieves the loyalty program.

---

## REST API

### Schema

```
 Method: getLoyaltyProgram
 Description: Retrieves the loyalty program.
 URL: https://www.wixapis.com/loyalty-programs/v1/program
 Method: GET
 Return type: GetLoyaltyProgramResponse
  - name: loyaltyProgram | type: LoyaltyProgram | description: Retrieved loyalty program.  
     - name: name | type: string | description: Program name.  | validation: minLength 2, maxLength 50
     - name: pointDefinition | type: PointDefinition | description: Details about the program's collectible unit.  
        - name: customName | type: string | description: Display name for the program's collectible unit.  It's recommended to use a plural, for example `"Stars"`.  In contrast to a custom name, the default `"Points"` name is translated and adjusted to singular based on circumstances.  Default: `"Points"`.  | validation: maxLength 20
        - name: icon | type: Image | description: Details about the points icon.  
           - 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: altText | type: string | description: Image alt text.  
           - name: filename | type: string | description: Image filename.  | read-only: true 
     - name: status | type: ProgramStatus | description: Program status. Customers can only earn or redeem points while the program is `"ACTIVE"`.  Default: `"DRAFT"`  | read-only: true 
         - enum:
         -     UNKNOWN: Unknown program status.
         -     DRAFT: Program is in draft mode. Customers can't earn or redeem points.
         -     ACTIVE: Program is active. Customers can earn and redeem points.
         -     PAUSED: Program is paused. Customers can't earn or redeem points while the program is paused.  Set the program to `"ACTIVE"` to resume earning and redeeming points.
     - name: createdDate | type: string | description: Date and time the program was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the program was updated.  | read-only: true | validation: format date-time
     - name: pointsExpiration | type: PointsExpiration | description: Configuration for the points expiration feature.  
        - name: status | type: Status | description: Status of the points expiration feature.  | read-only: true 
             - enum:
             -     DISABLED: Points expiration feature is disabled.
             -     ENABLED: Points expiration feature is enabled.
        - name: monthsOfInactivity | type: integer | description: How many months a member should be inactive to lose the collected points.  | validation: minimum 1, maximum 12
        - name: expiringPointsPercentage | type: integer | description: Percentage of points that a member loses after being inactive.  | validation: minimum 1, maximum 100
     - name: premiumFeatures | type: PremiumFeatures | description: Information about the available program premium features.  | read-only: true 
        - name: loyaltyProgram | type: boolean | description: Whether there are any loyalty program premium features.  | read-only: true 
        - name: tiers | type: boolean | description: Whether this loyalty program includes tiers.  | read-only: true 
        - name: pointsExpiration | type: boolean | description: Whether this loyalty program includes point expiration.  | read-only: true 
     - name: assignPointsForOldOrders | type: boolean | description: Whether to assign points for orders that were created more than 30 days before they were updated or paid.  By default (`false`), points are not assigned to such orders. This guards against retroactively awarding points for orders that predate an earning rule. Enable this (`true`) for sites where customers legitimately order far in advance and pay later (for example, bookings paid on the day of the session or manual payments).  Default: `false`  


```

### Examples

### Get loyalty program
```curl
curl -X GET \
  'https://www.wixapis.com/loyalty-programs/v1/program' \
  -H 'Authorization: <AUTH>'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.loyalty.programs.getLoyaltyProgram()
 Description: Retrieves the loyalty program.
 Return type: PROMISE<GetLoyaltyProgramResponse>
  - name: loyaltyProgram | type: LoyaltyProgram | description: Retrieved loyalty program.  
     - name: name | type: string | description: Program name.  | validation: minLength 2, maxLength 50
     - name: pointDefinition | type: PointDefinition | description: Details about the program's collectible unit.  
        - name: customName | type: string | description: Display name for the program's collectible unit.  It's recommended to use a plural, for example `"Stars"`.  In contrast to a custom name, the default `"Points"` name is translated and adjusted to singular based on circumstances.  Default: `"Points"`.  | validation: maxLength 20
        - name: icon | type: string | description: Details about the points icon.  
     - name: status | type: ProgramStatus | description: Program status. Customers can only earn or redeem points while the program is `"ACTIVE"`.  Default: `"DRAFT"`  | read-only: true 
         - enum:
         -     UNKNOWN: Unknown program status.
         -     DRAFT: Program is in draft mode. Customers can't earn or redeem points.
         -     ACTIVE: Program is active. Customers can earn and redeem points.
         -     PAUSED: Program is paused. Customers can't earn or redeem points while the program is paused.  Set the program to `"ACTIVE"` to resume earning and redeeming points.
     - name: _createdDate | type: Date | description: Date and time the program was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the program was updated.  | read-only: true 
     - name: pointsExpiration | type: PointsExpiration | description: Configuration for the points expiration feature.  
        - name: status | type: Status | description: Status of the points expiration feature.  | read-only: true 
             - enum:
             -     DISABLED: Points expiration feature is disabled.
             -     ENABLED: Points expiration feature is enabled.
        - name: monthsOfInactivity | type: integer | description: How many months a member should be inactive to lose the collected points.  | validation: minimum 1, maximum 12
        - name: expiringPointsPercentage | type: integer | description: Percentage of points that a member loses after being inactive.  | validation: minimum 1, maximum 100
     - name: premiumFeatures | type: PremiumFeatures | description: Information about the available program premium features.  | read-only: true 
        - name: loyaltyProgram | type: boolean | description: Whether there are any loyalty program premium features.  | read-only: true 
        - name: tiers | type: boolean | description: Whether this loyalty program includes tiers.  | read-only: true 
        - name: pointsExpiration | type: boolean | description: Whether this loyalty program includes point expiration.  | read-only: true 
     - name: assignPointsForOldOrders | type: boolean | description: Whether to assign points for orders that were created more than 30 days before they were updated or paid.  By default (`false`), points are not assigned to such orders. This guards against retroactively awarding points for orders that predate an earning rule. Enable this (`true`) for sites where customers legitimately order far in advance and pay later (for example, bookings paid on the day of the session or manual payments).  Default: `false`  


```

### Examples

### Get loyalty program
```javascript
import { programs } from '@wix/loyalty';

export async function myGetLoyaltyProgramFunction() {
  try {
    const myLoyaltyProgram = await programs.getLoyaltyProgram();

    const name = myLoyaltyProgram.loyaltyProgram.name;
    const status = myLoyaltyProgram.loyaltyProgram.status;

    console.log('Success! The status of your loyalty program is:', status);
    return myLoyaltyProgram;
  } catch (error) {
    console.error(error);
  }
}

/* Promise resolves to:
 * {  
 *   "loyaltyProgram": {
 *     "name": "Frequent Flower Program",
 *     "pointDefinition": {
 *       "customName": "Petals",
 *       "icon": "shapes/8de38e8fe76f4e9f937ae23e9ba1eb04.svg"
 *     },
 *     "status": "ACTIVE",
 *     "_createdDate": "2022-11-07T15:26:12.798Z",
 *     "_updatedDate": "2022-11-09T10:00:42.018Z"
 *   }
 * }
 */

```

### getLoyaltyProgram (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 { programs } from '@wix/loyalty';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function getLoyaltyProgram() {
  const response = await myWixClient.programs.getLoyaltyProgram();
};
```

---