> 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

# GetRecommendations

# Package: recommendations

# Namespace: RecommendationsProvider

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/other-services/recommendations/recommendations-service-plugin/get-recommendations?apiView=SDK.md

## Permission Scopes:
## Method Code Examples

--- Code Example: getRecommendations ---

## Introduction

This method retrieves an array containing the lists of recommended items returned by each algorithm. Items must be selected from catalogs in Wix apps installed on the site.

If a requested recommendation algorithm's type is `RELATED_ITEMS` then the `items` field is included in the request. The response should contain items related to those submitted.
How the related items are selected depends on the recommendation algorithms used. For example, items can be in the same category, or can be frequently bought or watched together.

---

## REST API

### Schema

```
 Method: getRecommendations
 Description: This method retrieves an array containing the lists of recommended items returned by each algorithm. Items must be selected from catalogs in Wix apps installed on the site.  If a requested recommendation algorithm's type is `RELATED_ITEMS` then the `items` field is included in the request. The response should contain items related to those submitted. How the related items are selected depends on the recommendation algorithms used. For example, items can be in the same category, or can be frequently bought or watched together.
 URL: {DEPLOYMENT-URI}/v1/get-recommendations
 Method: POST
 Method parameters:
   param name: algorithmIds | type: array<algorithmIds> | description: List of algorithms used to find recommended items. Items will be returned in a separate object for each algorithm  | validation: minItems 1, maxItems 10, format GUID
   param name: items | type: array<items> | description: The set of items used by algorithms with the `RELATED_ITEMS` `algorithmType` to determine related item recommendations.  | validation: maxItems 300
              - name: catalogItemId | type: string | description: GUID of the item within the catalog it belongs to. For a Wix Stores product, this is the product GUID, including when the product has variants.  | validation: minLength 1, maxLength 36
              - name: appId | type: string | description: GUID of the app providing the catalog.  You can get your app's GUID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).  For items from Wix catalogs, the following values always apply: + Wix Stores: `"215238eb-22a5-4c36-9e7b-e7c08025e04e"` + Wix Bookings: `"13d21c63-b5ec-5912-8397-c3a5ddb27a97"` + Wix Restaurants: `"9a5d83fd-8570-482e-81ab-cfa88942ee60"`  | validation: minLength 1
              - name: options | type: object | description: Additional item details in `key:value` pairs.  Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.  For a Wix Stores product with variants, specify the variant GUID in `options.variantId` and the product GUID in `catalogItemId`.  For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md) or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration.md), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction.md).  
 Return type: GetRecommendationsResponse
  - name: recommendationPerAlgorithm | type: array<RecommendationForAlgorithm> | description: Related items returned by each algorithm.  Each object in the array contains an `algorithmId` and a list of the item recommendations provided by that algorithm.  | validation: maxItems 10
     - name: algorithmId | type: string | description: Id of the algorithm that provided the recommendation.  | validation: format GUID
     - name: recommendedItems | type: array<CatalogReference> | description: Item recommendations provided by the algorithm. Depending on the algorithm, these recommendations may be influenced by the items provided in the request.  | validation: maxItems 100
        - name: catalogItemId | type: string | description: GUID of the item within the catalog it belongs to. For a Wix Stores product, this is the product GUID, including when the product has variants.  | validation: minLength 1, maxLength 36
        - name: appId | type: string | description: GUID of the app providing the catalog.  You can get your app's GUID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).  For items from Wix catalogs, the following values always apply: + Wix Stores: `"215238eb-22a5-4c36-9e7b-e7c08025e04e"` + Wix Bookings: `"13d21c63-b5ec-5912-8397-c3a5ddb27a97"` + Wix Restaurants: `"9a5d83fd-8570-482e-81ab-cfa88942ee60"`  | validation: minLength 1
        - name: options | type: object | description: Additional item details in `key:value` pairs.  Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.  For a Wix Stores product with variants, specify the variant GUID in `options.variantId` and the product GUID in `catalogItemId`.  For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md) or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration.md), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction.md).  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: ITEM_APP_ID_NOT_SUPPORTED | Description: One or more items are from catalogs that aren't supported by the provider. Only provide items from catalogs listed in the provider's `catalog_app_ids` configuration.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: ALGORITHM_NOT_SUPPORTED | Description: One or more of the requested `algorithm_ids` aren't supported by the provider. Check the provider's `supported_algorithms` configuration for valid algorithm GUIDs.


```

### Examples

### GetRecommendations
```curl
~~~cURL
curl POST 'www.wixapis.com/stores/recommendations/v1/get-recommendations' \
-H 'Content-Type: application/json;charset=UTF-8' \
-H 'Authorization: <AUTH>' \
--data-binary '{
     "items": [
         {
             "catalogItemId": "ec7914e8-208b-0069-5850-1a965643508d",
             "appId": "f29c9b39-1090-4d9b-8e3a-a3a681a57970"
         }
     ],
    "algorithmIds": ["4197e48af4324989be1aa691fe37c53a", "09dc98e8-8696-49f7-833a-bab57f516f88"]
}'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.ecom.recommendationsProvider.getRecommendations(request, metadata)
 Description: This method retrieves an array containing the lists of recommended items returned by each algorithm. Items must be selected from catalogs in Wix apps installed on the site.  If a requested recommendation algorithm's type is `RELATED_ITEMS` then the `items` field is included in the request. The response should contain items related to those submitted. How the related items are selected depends on the recommendation algorithms used. For example, items can be in the same category, or can be frequently bought or watched together.
 Method parameters:
   param name: request | type: GetRecommendationsRequest | description: additional information can be passed via aspects, for example GEO  
        - name: items | type: array<CatalogReference> | description: The set of items used by algorithms with the `RELATED_ITEMS` `algorithmType` to determine related item recommendations.  | validation: maxItems 300
           - name: catalogItemId | type: string | description: GUID of the item within the catalog it belongs to. For a Wix Stores product, this is the product GUID, including when the product has variants.  | validation: minLength 1, maxLength 36
           - name: appId | type: string | description: GUID of the app providing the catalog.  You can get your app's GUID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).  For items from Wix catalogs, the following values always apply: + Wix Stores: `"215238eb-22a5-4c36-9e7b-e7c08025e04e"` + Wix Bookings: `"13d21c63-b5ec-5912-8397-c3a5ddb27a97"` + Wix Restaurants: `"9a5d83fd-8570-482e-81ab-cfa88942ee60"`  | validation: minLength 1
           - name: options | type: object | description: Additional item details in `key:value` pairs.  Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.  For a Wix Stores product with variants, specify the variant GUID in `options.variantId` and the product GUID in `catalogItemId`.  For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md) or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration.md), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction.md).  
        - name: algorithmIds | type: array<string> | description: List of algorithms used to find recommended items. Items will be returned in a separate object for each algorithm  | validation: minItems 1, maxItems 10, format GUID
   param name: metadata | type: Context | description: this message is not directly used by any service, it exists to describe the expected parameters that SHOULD be provided to invoked Velo methods as part of open-platform. e.g. SPIs, event-handlers, etc.. NOTE: this context object MUST be provided as the last argument in each Velo method signature.  Example: ```typescript export function wixStores_onOrderCanceled({ event, metadata }: OrderCanceledEvent) { ... } ```  
        - name: requestId | type: string | description: A unique identifier of the request. You may print this GUID to your logs to help with future debugging and easier correlation with Wix's logs.  
        - name: currency | type: string | description: [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) 3-letter currency code.  | validation: format CURRENCY
        - name: identity | type: IdentificationData | description: An object that describes the identity that triggered this request.  
           - ONE-OF: 
              - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.  | validation: format GUID
              - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.  | validation: format GUID
              - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).  | validation: format GUID
              - name: appId | type: string | description: GUID of an app.  | validation: format GUID
        - name: languages | type: array<string> | description: A string representing a language and region in the format of `"xx-XX"`. First 2 letters represent the language code according to ISO 639-1. This is followed by a dash "-", and then a by 2 capital letters representing the region according to ISO 3166-2. For example, `"en-US"`.  
        - name: instanceId | type: string | description: The service provider app's instance GUID.  | validation: format GUID
 Return type: PROMISE<GetRecommendationsResponse>
  - name: recommendationPerAlgorithm | type: array<RecommendationForAlgorithm> | description: Related items returned by each algorithm.  Each object in the array contains an `algorithmId` and a list of the item recommendations provided by that algorithm.  | validation: maxItems 10
     - name: algorithmId | type: string | description: Id of the algorithm that provided the recommendation.  | validation: format GUID
     - name: recommendedItems | type: array<CatalogReference> | description: Item recommendations provided by the algorithm. Depending on the algorithm, these recommendations may be influenced by the items provided in the request.  | validation: maxItems 100
        - name: catalogItemId | type: string | description: GUID of the item within the catalog it belongs to. For a Wix Stores product, this is the product GUID, including when the product has variants.  | validation: minLength 1, maxLength 36
        - name: appId | type: string | description: GUID of the app providing the catalog.  You can get your app's GUID from its page in the [app dashboard](https://dev.wix.com/dc3/my-apps/).  For items from Wix catalogs, the following values always apply: + Wix Stores: `"215238eb-22a5-4c36-9e7b-e7c08025e04e"` + Wix Bookings: `"13d21c63-b5ec-5912-8397-c3a5ddb27a97"` + Wix Restaurants: `"9a5d83fd-8570-482e-81ab-cfa88942ee60"`  | validation: minLength 1
        - name: options | type: object | description: Additional item details in `key:value` pairs.  Use this optional field for more specificity with item selection. The values of the `options` field differ depending on which catalog is providing the items.  For a Wix Stores product with variants, specify the variant GUID in `options.variantId` and the product GUID in `catalogItemId`.  For Wix Stores products, learn more about integrating with [Catalog V3](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md) or [Catalog V1](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/e-commerce-integration.md), depending on [the version the site uses](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-versioning/introduction.md).  

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: ITEM_APP_ID_NOT_SUPPORTED | Description: One or more items are from catalogs that aren't supported by the provider. Only provide items from catalogs listed in the provider's `catalog_app_ids` configuration.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: ALGORITHM_NOT_SUPPORTED | Description: One or more of the requested `algorithm_ids` aren't supported by the provider. Check the provider's `supported_algorithms` configuration for valid algorithm GUIDs.


```

### Examples

### getRecommendations
```javascript
import { recommendationsProvider } from '@wix/ecom/service-plugins';

async function getRecommendations(request,metadata) {
  const response = await recommendationsProvider.getRecommendations(request,metadata);
};
```

### getRecommendations (with elevated permissions)
```javascript
import { recommendationsProvider } from '@wix/ecom/service-plugins';
import { auth } from '@wix/essentials';

async function myGetRecommendationsMethod(request,metadata) {
  const elevatedGetRecommendations = auth.elevate(recommendationsProvider.getRecommendations);
  const response = await elevatedGetRecommendations(request,metadata);
}
```

### getRecommendations (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 { recommendationsProvider } from '@wix/ecom/service-plugins';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function getRecommendations(request,metadata) {
  const response = await myWixClient.recommendationsProvider.getRecommendations(request,metadata);
};
```

---