> 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`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # QueryPoolItems # Package: benefitPrograms # Namespace: PoolItemService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/benefit-programs/pool-items/query-pool-items.md ## Permission Scopes: SCOPE.BENEFIT_PROGRAMS.READ (PII): SCOPE.BENEFIT_PROGRAMS.READ_LIMITED ## Introduction Retrieves a list of up to 1,000 pool items, based on the specified paging, filtering, and sorting. When called by a logged-in member without an explicit `beneficiary.memberId` filter, the response is automatically scoped to the calling member. App callers must include a `beneficiary.memberId` filter to scope the response to a specific beneficiary. Query Pool Items runs with these defaults, which you can override: - `createdDate` is sorted in `DESC` order - `cursorPaging.limit` is `50` To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md). --- ## REST API ### Schema ``` Method: queryPoolItems Description: Retrieves a list of up to 1,000 pool items, based on the specified paging, filtering, and sorting. When called by a logged-in member without an explicit `beneficiary.memberId` filter, the response is automatically scoped to the calling member. App callers must include a `beneficiary.memberId` filter to scope the response to a specific beneficiary. Query Pool Items runs with these defaults, which you can override: - `createdDate` is sorted in `DESC` order - `cursorPaging.limit` is `50` To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md). URL: https://www.wixapis.com/benefit-programs/v1/pool-items/query Method: POST Method parameters: param name: fields | type: array | description: Optional enrichments to include in the response. - enum: - POOL: Populates the `pool` field with the pool's display name and description. - PROGRAM: Populates the `program` field with the program's display name. - PROGRAM_DEFINITION: Populates the `programDefinition` field with the program definition's display name and description. - ITEM: Populates the `itemInfo` field with the catalog item's display name. - BENEFIT: Populates the `benefitInfo` field with the benefit's credit price, name, and description. param name: query | type: CursorQuery - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains` - name: sort | type: array | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]` - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: QueryPoolItemsResponse - name: poolItems | type: array | description: List of retrieved pool items. - name: id | type: string | description: Pool item GUID. Generated deterministically from `poolId` and `itemId`. - name: revision | type: string | description: Revision number, which increments by 1 each time the pool item is updated. - name: createdDate | type: string | description: Date and time the pool item was created. - name: updatedDate | type: string | description: Date and time the pool item was updated. - name: externalId | type: string | description: External item GUID assigned by the provider of the items. For example, if the items are products, this GUID corresponds to the specific product GUID in the provider's system. - name: category | type: string | description: Item category. Groups benefit items together for organization and management. For example, `classes`, `posts`, or `groups`. - name: providerAppId | type: string | description: GUID of the application that provides the benefit items. Each item's `externalId` is unique within its provider application. - name: namespace | type: string | description: Namespace for your app or site's benefit programs. Namespaces let you distinguish between entities that you created and entities that other apps created. - name: poolId | type: string | description: GUID of the pool that contains this item. A pool is the runtime container of benefits and items provisioned for a beneficiary. - name: programId | type: string | description: GUID of the program that contains this pool item. The program is the runtime instance of a program definition for a specific beneficiary. - name: externalProgramId | type: string | description: External program GUID assigned by the provider. - name: programDefinitionId | type: string | description: GUID of the program definition that's the template for this pool item's program. - name: externalProgramDefinitionId | type: string | description: External program definition GUID assigned by the provider. - name: poolDefinitionId | type: string | description: GUID of the pool definition that's the template for this pool item's pool. - name: itemSetId | type: string | description: Internal grouping identifier for this benefit's item set. Use `poolId` together with `benefitKey` to identify a benefit — `itemSetId` is an implementation detail. - name: beneficiary | type: IdentificationData | description: Beneficiary of the pool — the member, contact, or visitor who holds this pool item. - ONE-OF: - name: anonymousVisitorId | type: string | description: GUID of a site visitor that hasn't logged in to the site. - name: memberId | type: string | description: GUID of a site member. - name: wixUserId | type: string | description: GUID of a Wix user. - name: pool | type: PoolInfo | description: Pool details, including display name and description. Returned only when `POOL` is included in the `fields` request parameter. - name: displayName | type: string | description: Pool's display name. Often matches the name on the associated pool definition. - name: description | type: string | description: Pool description. - name: program | type: ProgramInfo | description: Program details — `id`, `externalId`, and `displayName`. Returned only when `PROGRAM` is included in the `fields` request parameter. - name: id | type: string | description: Program GUID. - name: externalId | type: string | description: External program GUID assigned by the provider. - name: displayName | type: string | description: Program's display name. - name: programDefinition | type: ProgramDefinitionInfo | description: Program definition that includes this item as an accessible benefit. Returned only when `PROGRAM_DEFINITION` is included in the `fields` request parameter. - name: id | type: string | description: Program definition GUID. - name: externalId | type: string | description: External program definition GUID assigned by the provider. - name: displayName | type: string | description: Program definition's display name. - name: description | type: string | description: Program definition description. - name: itemId | type: string | description: Item GUID. - name: itemInfo | type: ItemInfo | description: Display name for the catalog item. Returned only when `ITEM` is included in the `fields` request parameter. - name: displayName | type: string | description: Item's display name. - name: benefitInfo | type: BenefitInfo | description: Pricing and display information for the associated benefit, including credit price, name, and description. Returned only when `BENEFIT` is included in the `fields` request parameter. - name: price | type: string | description: Cost of the benefit in credits. The cost is the same for all items in this benefit. Credits are a configurable unit defined on the parent pool definition. The unit type is set in the pool definition's credit configuration. Absent when no credit-based pricing is configured for this benefit. - name: benefitKey | type: string | description: Unique identifier for this benefit. Same value as `poolItem.benefitKey`. - name: displayName | type: string | description: Benefit's display name. - name: description | type: string | description: Benefit description. - name: benefitKey | type: string | description: Unique identifier for the benefit that grants access to this item. - name: itemSearchKey | type: string | description: Pre-computed search key for the item reference, built by concatenating `providerAppId`, `category`, and `externalId` separated by `/`. Use this field for efficient single-field filtering instead of composing three separate conditions. - name: removed | type: boolean | description: Indicates whether this pool item has been removed - name: metadata | type: CursorPagingMetadata | description: Paging metadata. - name: count | type: integer | description: Number of items returned in the response. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### QueryPoolItems ```curl ~~~cURL curl -X POST "https://www.wixapis.com/benefit-programs/v1/pool-items/query" -H 'Content-type: application/json' \ -H 'Authorization: ' \ -d '{ "query": { "sort": [ { "select_items_by": [], "field_name": "poolId", "order": "ASC" } ], "filter": { "$and": [ { "namespace": { "$eq": "benefit_programs_app" } }, { "externalId": { "$eq": "00000000-0000-0000-0000-000000000000" } } ] }, "cursor_paging": { "limit": 100 } } }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.benefitPrograms.PoolItemService.queryPoolItems(query, options) Description: Retrieves a list of up to 1,000 pool items, based on the specified paging, filtering, and sorting. When called by a logged-in member without an explicit `beneficiary.memberId` filter, the response is automatically scoped to the calling member. App callers must include a `beneficiary.memberId` filter to scope the response to a specific beneficiary. Query Pool Items runs with these defaults, which you can override: - `createdDate` is sorted in `DESC` order - `cursorPaging.limit` is `50` To learn about working with Query methods, see [API Query Language](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-the-wix-api-query-language.md), [Sorting and Paging](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-sorting-and-paging.md), and [Field Projection](https://dev.wix.com/docs/api-reference/articles/work-with-wix-apis/data-retrieval/about-field-projection.md). # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: query Method parameters: param name: options | type: QueryPoolItemsOptions none - name: fields | type: array | description: Optional enrichments to include in the response. - enum: - POOL: Populates the `pool` field with the pool's display name and description. - PROGRAM: Populates the `program` field with the program's display name. - PROGRAM_DEFINITION: Populates the `programDefinition` field with the program definition's display name and description. - ITEM: Populates the `itemInfo` field with the catalog item's display name. - BENEFIT: Populates the `benefitInfo` field with the benefit's credit price, name, and description. param name: query | type: PoolItemQuery | required: true - name: cursorPaging | type: CursorPaging | description: Cursor token pointing to a page of results. Not used in the first request. Following requests use the cursor token and not `filter` or `sort`. - name: limit | type: integer | description: Maximum number of items to return in the results. - name: cursor | type: string | description: Pointer to the next or previous page in the list of results. Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request. - name: filter | type: object | description: Filter object in the following format: `"filter" : { "fieldName1": "value1", "fieldName2":{"$operator":"value2"} }` Example of operators: `$eq`, `$ne`, `$lt`, `$lte`, `$gt`, `$gte`, `$in`, `$hasSome`, `$hasAll`, `$startsWith`, `$contains` - name: sort | type: array | description: Sort object in the following format: `[{"fieldName":"sortField1","order":"ASC"},{"fieldName":"sortField2","order":"DESC"}]` - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: PROMISE - name: poolItems | type: array | description: List of retrieved pool items. - name: _id | type: string | description: Pool item GUID. Generated deterministically from `poolId` and `itemId`. - name: revision | type: string | description: Revision number, which increments by 1 each time the pool item is updated. - name: _createdDate | type: Date | description: Date and time the pool item was created. - name: _updatedDate | type: Date | description: Date and time the pool item was updated. - name: externalId | type: string | description: External item GUID assigned by the provider of the items. For example, if the items are products, this GUID corresponds to the specific product GUID in the provider's system. - name: category | type: string | description: Item category. Groups benefit items together for organization and management. For example, `classes`, `posts`, or `groups`. - name: providerAppId | type: string | description: GUID of the application that provides the benefit items. Each item's `externalId` is unique within its provider application. - name: namespace | type: string | description: Namespace for your app or site's benefit programs. Namespaces let you distinguish between entities that you created and entities that other apps created. - name: poolId | type: string | description: GUID of the pool that contains this item. A pool is the runtime container of benefits and items provisioned for a beneficiary. - name: programId | type: string | description: GUID of the program that contains this pool item. The program is the runtime instance of a program definition for a specific beneficiary. - name: externalProgramId | type: string | description: External program GUID assigned by the provider. - name: programDefinitionId | type: string | description: GUID of the program definition that's the template for this pool item's program. - name: externalProgramDefinitionId | type: string | description: External program definition GUID assigned by the provider. - name: poolDefinitionId | type: string | description: GUID of the pool definition that's the template for this pool item's pool. - name: itemSetId | type: string | description: Internal grouping identifier for this benefit's item set. Use `poolId` together with `benefitKey` to identify a benefit — `itemSetId` is an implementation detail. - name: beneficiary | type: IdentificationData | description: Beneficiary of the pool — the member, contact, or visitor who holds this pool item. - ONE-OF: - name: anonymousVisitorId | type: string | description: GUID of a site visitor that hasn't logged in to the site. - name: memberId | type: string | description: GUID of a site member. - name: wixUserId | type: string | description: GUID of a Wix user. - name: pool | type: PoolInfo | description: Pool details, including display name and description. Returned only when `POOL` is included in the `fields` request parameter. - name: displayName | type: string | description: Pool's display name. Often matches the name on the associated pool definition. - name: description | type: string | description: Pool description. - name: program | type: ProgramInfo | description: Program details — `id`, `externalId`, and `displayName`. Returned only when `PROGRAM` is included in the `fields` request parameter. - name: _id | type: string | description: Program GUID. - name: externalId | type: string | description: External program GUID assigned by the provider. - name: displayName | type: string | description: Program's display name. - name: programDefinition | type: ProgramDefinitionInfo | description: Program definition that includes this item as an accessible benefit. Returned only when `PROGRAM_DEFINITION` is included in the `fields` request parameter. - name: _id | type: string | description: Program definition GUID. - name: externalId | type: string | description: External program definition GUID assigned by the provider. - name: displayName | type: string | description: Program definition's display name. - name: description | type: string | description: Program definition description. - name: itemId | type: string | description: Item GUID. - name: itemInfo | type: ItemInfo | description: Display name for the catalog item. Returned only when `ITEM` is included in the `fields` request parameter. - name: displayName | type: string | description: Item's display name. - name: benefitInfo | type: BenefitInfo | description: Pricing and display information for the associated benefit, including credit price, name, and description. Returned only when `BENEFIT` is included in the `fields` request parameter. - name: price | type: string | description: Cost of the benefit in credits. The cost is the same for all items in this benefit. Credits are a configurable unit defined on the parent pool definition. The unit type is set in the pool definition's credit configuration. Absent when no credit-based pricing is configured for this benefit. - name: benefitKey | type: string | description: Unique identifier for this benefit. Same value as `poolItem.benefitKey`. - name: displayName | type: string | description: Benefit's display name. - name: description | type: string | description: Benefit description. - name: benefitKey | type: string | description: Unique identifier for the benefit that grants access to this item. - name: itemSearchKey | type: string | description: Pre-computed search key for the item reference, built by concatenating `providerAppId`, `category`, and `externalId` separated by `/`. Use this field for efficient single-field filtering instead of composing three separate conditions. - name: removed | type: boolean | description: Indicates whether this pool item has been removed - name: metadata | type: CursorPagingMetadata | description: Paging metadata. - name: count | type: integer | description: Number of items returned in the response. - name: cursors | type: Cursors | description: Cursor strings that point to the next page, previous page, or both. - name: next | type: string | description: Cursor string pointing to the next page in the list of results. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. - name: hasNext | type: boolean | description: Whether there are more pages to retrieve following the current page. + `true`: Another page of results can be retrieved. + `false`: This is the last page. ``` ### Examples ### queryPoolItems ```javascript import { poolItems } from '@wix/benefit-programs'; async function queryPoolItems(query,options) { const response = await poolItems.queryPoolItems(query,options); }; ``` ### queryPoolItems (with elevated permissions) ```javascript import { poolItems } from '@wix/benefit-programs'; import { auth } from '@wix/essentials'; async function myQueryPoolItemsMethod(query,options) { const elevatedQueryPoolItems = auth.elevate(poolItems.queryPoolItems); const response = await elevatedQueryPoolItems(query,options); } ``` ### queryPoolItems (self-hosted) Self-hosted 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 { poolItems } from '@wix/benefit-programs'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { poolItems }, // Include the auth strategy and host as relevant }); async function queryPoolItems(query,options) { const response = await myWixClient.poolItems.queryPoolItems(query,options); }; ``` ---