> 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

# GetTiersProgram

# Package: loyaltyProgramManagement

# Namespace: LoyaltyTiers

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

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

## Introduction

Retrieves a sites tiers and the site's tier program settings.

If there are no program settings creates and returns the default program settings.

---

## REST API

### Schema

```
 Method: getTiersProgram
 Description: Retrieves a sites tiers and the site's tier program settings.  If there are no program settings creates and returns the default program settings.
 URL: https://www.wixapis.com/loyalty-tiers/v1/tiers/program
 Method: GET
 Return type: GetTiersProgramResponse
  - name: tiers | type: array<Tier> | description: Tiers.  
     - name: id | type: string | description: Tier GUID.  | read-only: true | validation: format GUID
     - name: tierDefinition | type: TierDefinition | description: Information about the tier.  
        - name: icon | type: Image | description: Details about the tier 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: name | type: string | description: Tier name.  | validation: minLength 1, maxLength 50
        - name: description | type: string | description: Tier description.  | validation: maxLength 70
     - name: requiredPoints | type: integer | description: The amount of points required to be in this tier.  | validation: minimum 0, maximum 9999999
     - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tier is updated.  To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tier.  | read-only: true | validation: format uint64
     - name: createdDate | type: string | description: Date and time the tier was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the tier was last updated.  | read-only: true | validation: format date-time
  - name: programSettings | type: TiersProgramSettings | description: Tiers program settings.  
     - ONE-OF: 
        - name: rollingWindow | type: RollingWindow | description: **Required.** Period of time used to calculate loyalty points for tier assignment.  The loyalty points accumulated during this period determine if the account meets a tier's required point threshold.  
           - name: durationInMonths | type: integer | description: Number of months to use for the rolling window period.  Min: `12`  Max: `36`  | validation: minimum 1, maximum 36
     - name: status | type: Status | description: Tiers program status.  
         - enum:
         -     UNKNOWN: Unknown status.
         -     DISABLED: Tiers are disabled.
         -     DRAFT: Tiers are enabled but not yet active.
         -     ACTIVE: Tiers are active.
         -     PAUSED: Tiers are paused.
     - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tiers settings are updated.  To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tiers settings.  | validation: format uint64, immutable
     - name: createdDate | type: string | description: Date and time the loyalty tiers program was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the loyalty tiers program was last updated.  | read-only: true | validation: format date-time
     - name: baseTierDefinition | type: TierDefinition | description: Information about the base loyalty tier.  The base tier is the default tier for any account that's unassigned for not meeting the required points threshold of any other tier.  


```

### Examples

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

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.loyalty.tiers.getTiersProgram()
 Description: Retrieves a sites tiers and the site's tier program settings.  If there are no program settings creates and returns the default program settings.
 Return type: PROMISE<GetTiersProgramResponse>
  - name: tiers | type: array<Tier> | description: Tiers.  
     - name: _id | type: string | description: Tier GUID.  | read-only: true | validation: format GUID
     - name: tierDefinition | type: TierDefinition | description: Information about the tier.  
        - name: icon | type: string | description: Details about the tier icon.  
        - name: name | type: string | description: Tier name.  | validation: minLength 1, maxLength 50
        - name: description | type: string | description: Tier description.  | validation: maxLength 70
     - name: requiredPoints | type: integer | description: The amount of points required to be in this tier.  | validation: minimum 0, maximum 9999999
     - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tier is updated.  To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tier.  | read-only: true | validation: format uint64
     - name: _createdDate | type: Date | description: Date and time the tier was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the tier was last updated.  | read-only: true 
  - name: programSettings | type: TiersProgramSettings | description: Tiers program settings.  
     - ONE-OF: 
        - name: rollingWindow | type: RollingWindow | description: **Required.** Period of time used to calculate loyalty points for tier assignment.  The loyalty points accumulated during this period determine if the account meets a tier's required point threshold.  
           - name: durationInMonths | type: integer | description: Number of months to use for the rolling window period.  Min: `12`  Max: `36`  | validation: minimum 1, maximum 36
     - name: status | type: Status | description: Tiers program status.  
         - enum:
         -     UNKNOWN: Unknown status.
         -     DISABLED: Tiers are disabled.
         -     DRAFT: Tiers are enabled but not yet active.
         -     ACTIVE: Tiers are active.
         -     PAUSED: Tiers are paused.
     - name: revision | type: string | description: Revision number, which increments by 1 each time the loyalty tiers settings are updated.  To prevent conflicting changes, the current `revision` must be passed when updating the loyalty tiers settings.  | validation: format uint64, immutable
     - name: _createdDate | type: Date | description: Date and time the loyalty tiers program was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the loyalty tiers program was last updated.  | read-only: true 
     - name: baseTierDefinition | type: TierDefinition | description: Information about the base loyalty tier.  The base tier is the default tier for any account that's unassigned for not meeting the required points threshold of any other tier.  


```

### Examples

### Get tiers program`
```javascript
import { tiers } from "@wix/loyalty";

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

/* Promise resolves to:
 *
 * {
 *   "programSettings": {
 *     "_createdDate": "2024-06-05T20:27:19.147Z",
 *     "_updatedDate": "2024-06-06T10:30:05.261Z",
 *     "baseTierDefinition": {
 *       "icon": "shapes/11062b_0a8e17936d5b4d46971649be036c781b.svg",
 *       "name": "Basic",
 *       "description": ""
 *     },
 *     "revision": "2",
 *     "status": "ACTIVE",
 *     "rollingWindow": {
 *       "durationInMonths": 12
 *     }
 *   },
 *   "tiers": [
 *     {
 *       "_createdDate": "2024-06-06T10:33:19.121Z",
 *       "_id": "7e26e41b-3bb6-40c9-bb7e-855b9f4f69e2",
 *       "_updatedDate": "2024-06-11T12:17:05.000Z",
 *       "requiredPoints": 100,
 *       "revision": "6",
 *       "tierDefinition": {
 *         "icon": "shapes/11062b_667183149f4c40809fd860a1d7109296.svg",
 *         "name": "Silver Tier",
 *         "description": "Silver Tier Benefits"
 *       }
 *     },
 *     {
 *       "_createdDate": "2024-06-06T10:33:56.430Z",
 *       "_id": "b8501f07-a34f-4608-b9b0-168e6c6c505a",
 *       "_updatedDate": "2024-06-11T12:17:12.382Z",
 *       "requiredPoints": 200,
 *       "revision": "4",
 *       "tierDefinition": {
 *         "icon": "shapes/c0bec42304a6414990bfd882f637ac0a.svg",
 *         "name": "Gold",
 *         "description": "Gold Tier Benefits"
 *       }
 *     },
 *     {
 *       "_createdDate": "2024-06-11T12:14:14.809Z",
 *       "_id": "a9fc3669-1cf4-4dff-8f4c-d6a22c62eadb",
 *       "_updatedDate": "2024-06-11T12:17:24.724Z",
 *       "requiredPoints": 500,
 *       "revision": "2",
 *       "tierDefinition": {
 *         "icon": "shapes/43e4c49bed6b47e8a85bc1dd5fbcfd71.svg",
 *         "name": "Diamond",
 *         "description": "Diamond Tier Benefits"
 *       }
 *     },
 *     {
 *       "_createdDate": "2024-06-11T12:38:35.490Z",
 *       "_id": "8edeea05-2c90-43fa-bd15-b2352620fd51",
 *       "_updatedDate": "2024-06-11T12:38:35.490Z",
 *       "requiredPoints": 1000,
 *       "revision": "1",
 *       "tierDefinition": {
 *         "icon": "shapes/cca51dde12d348379113f2201cbe4e6c.svg",
 *         "name": "Jadeite Tier",
 *         "description": "Jadeite Tier Benefits"
 *       }
 *     }
 *   ]
 * }
 */
```

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

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


async function getTiersProgram() {
  const response = await myWixClient.tiers.getTiersProgram();
};
```

---