> 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

# GetEligibleBenefits

# Package: benefitPrograms

# Namespace: PoolService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pools/get-eligible-benefits.md

## Permission Scopes:
SCOPE.BENEFIT_PROGRAMS.READ (PII): SCOPE.BENEFIT_PROGRAMS.READ_LIMITED

## Introduction

Retrieves benefits that can be redeemed for a specific benefit item.

Each benefit item can only be linked to 1 benefit in 1 pool definition. However, each pool created from that pool definition contains the same benefits.
This method checks each pool containing a benefit with this benefit item, and returns the benefits that can be redeemed.

---

## REST API

### Schema

```
 Method: getEligibleBenefits
 Description: Retrieves benefits that can be redeemed for a specific benefit item.  Each benefit item can only be linked to 1 benefit in 1 pool definition. However, each pool created from that pool definition contains the same benefits. This method checks each pool containing a benefit with this benefit item, and returns the benefits that can be redeemed.
 URL: https://www.wixapis.com/benefit-programs/v1/pools/eligible-pools
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  itemReference, itemReference.externalId, itemReference.providerAppId, namespace
 Method parameters: 
   param name: additionalData | type: additionalData | description: Additional information.  
   param name: beneficiary | type: IdentificationData    
    - ONE-OF: 
     - name: anonymousVisitorId | type: string | description: GUID of a site visitor that hasn't logged in to the site.  | validation: format GUID
     - name: memberId | type: string | description: GUID of a site member.  | validation: format GUID
     - name: wixUserId | type: string | description: GUID of a Wix user.  | validation: format GUID
   param name: count | type: count | description: Amount of items to check. This ensures the balance is high enough to redeem this many items.  | validation: minimum 1
   param name: itemReference | type: ItemReference   | required: true 
        - name: externalId | type: string | description: External GUID of the item. | required: true | validation: format GUID
        - name: category | type: string | description: Item category.  | validation: maxLength 20
        - name: providerAppId | type: string | description: GUID of the app providing the item. | required: true | validation: format GUID
   param name: namespace | type: namespace | description: Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created. | required: true | validation: minLength 1, maxLength 20
   param name: targetDate | type: targetDate | description: Date that the item will be provided to the beneficiary.  This parameter should be used to manage the potential logistics of providing the item.  | validation: format date-time
 Return type: GetEligibleBenefitsResponse
  - name: eligibleBenefits | type: array<EligibleBenefit> | description: Retrieved benefits that can be redeemed.  
     - name: poolId | type: string | description: Pool GUID.  | read-only: true | validation: format GUID
     - name: benefitKey | type: string | description: Benefit key.  | validation: maxLength 64
     - name: itemReference | type: ItemReference | description: Item reference.  
        - name: externalId | type: string | description: External GUID of the item.  | validation: format GUID
        - name: category | type: string | description: Item category.  | validation: maxLength 20
        - name: providerAppId | type: string | description: GUID of the app providing the item.  | validation: format GUID
     - name: price | type: string | description: Price of the benefit in credits.  | validation: decimalValue {"gte":"0","maxScale":4}
     - name: poolInfo | type: PoolInfo | description: Pool information.  
        - name: balance | type: BalanceAmount | description: Current pool balance  
           - name: available | type: string | description: number of available credits.  | read-only: true | validation: decimalValue {"maxScale":4}
           - name: reserved | type: string | description: number of reserved credits.  | read-only: true | validation: decimalValue {"maxScale":4}
        - name: creditAmount | type: string | description: Initial available amount for associated balances.  | validation: decimalValue {"gte":"0","maxScale":4}
        - name: displayName | type: string | description: Pool name  | validation: maxLength 64
        - name: description | type: string | description: Pool description  | validation: maxLength 450
        - name: poolDefinitionId | type: string | description: Pool definition id  | validation: format GUID
        - name: creditUnitType | type: string | description: Credit unit type.  | validation: maxLength 16
     - name: benefitInfo | type: BenefitInfo | description: Benefit information.  
        - name: displayName | type: string | description: Benefit name  | validation: maxLength 64
        - name: description | type: string | description: Benefit description  | validation: maxLength 256
        - name: benefitKey | type: string | description: Benefit key.  | validation: maxLength 64
        - name: price | type: string | description: Price of the benefit in credits.  | validation: decimalValue {"gte":"0","maxScale":4}
     - name: programDefinitionInfo | type: ProgramDefinitionInfo | description: Program definition information.  
        - name: id | type: string | description: Program definition GUID.  | read-only: true | validation: format GUID
        - name: externalId | type: string | description: Program definition external GUID.  | read-only: true | validation: format GUID
        - name: displayName | type: string | description: Display name of the program definition.  | read-only: true | validation: maxLength 64
        - name: description | type: string | description: Description of the program definition.  | read-only: true | validation: maxLength 450
     - name: programInfo | type: ProgramInfo | description: Program information.  
        - name: id | type: string | description: Program GUID.  | read-only: true | validation: format GUID
        - name: externalId | type: string | description: Program external GUID.  | read-only: true | validation: format GUID
        - name: displayName | type: string | description: Display name of the program.  | read-only: true | validation: maxLength 64

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_ITEM_REFERENCE | Description: Invalid item reference values.


```

### Examples

### GetEligibleBenefits
```curl
~~~cURL
curl --request POST https://www.wixapis.com/benefit-programs/v1/pools/eligible-pools \
  -H "Authorization: <AUTH>" \
  -H "Content-Type: application/json" \
  --data '{
    "itemReference": {
      "externalId": "57273802-b873-495c-8eba-b8f054452e6c",
      "providerAppId": "00000000-0000-0000-0000-000000000000"
    },
    "count": 3,
    "beneficiary": {
      "memberId": "00000000-0000-0000-0000-000000000000"
    },
    "namespace": "benefit_programs_app"
  }'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.benefitPrograms.pools.getEligibleBenefits(itemReference, options)
 Description: Retrieves benefits that can be redeemed for a specific benefit item.  Each benefit item can only be linked to 1 benefit in 1 pool definition. However, each pool created from that pool definition contains the same benefits. This method checks each pool containing a benefit with this benefit item, and returns the benefits that can be redeemed.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  itemReference, itemReference.externalId, itemReference.providerAppId, options.namespace, options
 Method parameters: 
   param name: itemReference | type: ItemReference   | required: true 
        - name: externalId | type: string | description: External GUID of the item. | required: true | validation: format GUID
        - name: category | type: string | description: Item category.  | validation: maxLength 20
        - name: providerAppId | type: string | description: GUID of the app providing the item. | required: true | validation: format GUID
   param name: options | type: GetEligibleBenefitsOptions  none | required: true 
        - name: count | type: integer | description: Amount of items to check. This ensures the balance is high enough to redeem this many items.  | validation: minimum 1
        - name: targetDate | type: Date | description: Date that the item will be provided to the beneficiary.  This parameter should be used to manage the potential logistics of providing the item.  
        - name: additionalData | type: object | description: Additional information.  
        - name: beneficiary | type: IdentificationData | description: Filter request by beneficiary.  
           - ONE-OF: 
              - name: anonymousVisitorId | type: string | description: GUID of a site visitor that hasn't logged in to the site.  | validation: format GUID
              - name: memberId | type: string | description: GUID of a site member.  | validation: format GUID
              - name: wixUserId | type: string | description: GUID of a Wix user.  | validation: format GUID
        - name: namespace | type: string | description: Namespace for your app or site's benefit programs. Namespaces allow you to distinguish between entities that you created and entities that other apps created. | required: true | validation: minLength 1, maxLength 20
 Return type: PROMISE<GetEligibleBenefitsResponse>
  - name: eligibleBenefits | type: array<EligibleBenefit> | description: Retrieved benefits that can be redeemed.  
     - name: poolId | type: string | description: Pool GUID.  | read-only: true | validation: format GUID
     - name: benefitKey | type: string | description: Benefit key.  | validation: maxLength 64
     - name: itemReference | type: ItemReference | description: Item reference.  
        - name: externalId | type: string | description: External GUID of the item.  | validation: format GUID
        - name: category | type: string | description: Item category.  | validation: maxLength 20
        - name: providerAppId | type: string | description: GUID of the app providing the item.  | validation: format GUID
     - name: price | type: string | description: Price of the benefit in credits.  | validation: decimalValue {"gte":"0","maxScale":4}
     - name: poolInfo | type: PoolInfo | description: Pool information.  
        - name: balance | type: BalanceAmount | description: Current pool balance  
           - name: available | type: string | description: number of available credits.  | read-only: true | validation: decimalValue {"maxScale":4}
           - name: reserved | type: string | description: number of reserved credits.  | read-only: true | validation: decimalValue {"maxScale":4}
        - name: creditAmount | type: string | description: Initial available amount for associated balances.  | validation: decimalValue {"gte":"0","maxScale":4}
        - name: displayName | type: string | description: Pool name  | validation: maxLength 64
        - name: description | type: string | description: Pool description  | validation: maxLength 450
        - name: poolDefinitionId | type: string | description: Pool definition id  | validation: format GUID
        - name: creditUnitType | type: string | description: Credit unit type.  | validation: maxLength 16
     - name: benefitInfo | type: BenefitInfo | description: Benefit information.  
        - name: displayName | type: string | description: Benefit name  | validation: maxLength 64
        - name: description | type: string | description: Benefit description  | validation: maxLength 256
        - name: benefitKey | type: string | description: Benefit key.  | validation: maxLength 64
        - name: price | type: string | description: Price of the benefit in credits.  | validation: decimalValue {"gte":"0","maxScale":4}
     - name: programDefinitionInfo | type: ProgramDefinitionInfo | description: Program definition information.  
        - name: _id | type: string | description: Program definition GUID.  | read-only: true | validation: format GUID
        - name: externalId | type: string | description: Program definition external GUID.  | read-only: true | validation: format GUID
        - name: displayName | type: string | description: Display name of the program definition.  | read-only: true | validation: maxLength 64
        - name: description | type: string | description: Description of the program definition.  | read-only: true | validation: maxLength 450
     - name: programInfo | type: ProgramInfo | description: Program information.  
        - name: _id | type: string | description: Program GUID.  | read-only: true | validation: format GUID
        - name: externalId | type: string | description: Program external GUID.  | read-only: true | validation: format GUID
        - name: displayName | type: string | description: Display name of the program.  | read-only: true | validation: maxLength 64

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_ITEM_REFERENCE | Description: Invalid item reference values.


```

### Examples

### getEligibleBenefits
```javascript
import { pools } from '@wix/benefit-programs';

async function getEligibleBenefits(itemReference,options) {
  const response = await pools.getEligibleBenefits(itemReference,options);
};
```

### getEligibleBenefits (with elevated permissions)
```javascript
import { pools } from '@wix/benefit-programs';
import { auth } from '@wix/essentials';

async function myGetEligibleBenefitsMethod(itemReference,options) {
  const elevatedGetEligibleBenefits = auth.elevate(pools.getEligibleBenefits);
  const response = await elevatedGetEligibleBenefits(itemReference,options);
}
```

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

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


async function getEligibleBenefits(itemReference,options) {
  const response = await myWixClient.pools.getEligibleBenefits(itemReference,options);
};
```

---