> 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

# UpdateCollection

# Package: catalogV1

# Namespace: CatalogWriteApi

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/update-collection-properties.md

## Permission Scopes:
Manage Products: SCOPE.DC-STORES.MANAGE-PRODUCTS

## Introduction

Updates specified properties of a collection.
To add products to a collection, call the [Add Products to Collection](https://dev.wix.com/api/rest/wix-stores/catalog/collections/add-products-to-collection) endpoint.

---

## REST API

### Schema

```
 Method: updateCollection
 Description: Updates specified properties of a collection. To add products to a collection, call the [Add Products to Collection](https://dev.wix.com/api/rest/wix-stores/catalog/collections/add-products-to-collection) endpoint.
 URL: https://www.wixapis.com/stores/v1/collections/{collection.id}
 Method: PATCH
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  collection, collection.id
 Method parameters: 
   param name: collection | type: Collection   | required: true 
        - name: id | type: string | description: Collection GUID (generated automatically by the catalog). | required: true | read-only: true | validation: minLength 35, maxLength 36
        - name: name | type: string | description: Collection name.  | validation: minLength 1, maxLength 50
        - name: description | type: string | description: Collection description.  | validation: minLength 0, maxLength 600
        - name: slug | type: string | description: Collection slug.  | validation: minLength 1, maxLength 100
        - name: visible | type: boolean | description: Collection visibility. Only impacts dynamic pages, no impact on static pages. Default: `true`.  
 Return type: UpdateCollectionResponse
  - name: collection | type: Collection | description: Updated collection.  
     - name: id | type: string | description: Collection GUID (generated automatically by the catalog).  | read-only: true | validation: minLength 35, maxLength 36
     - name: name | type: string | description: Collection name.  | validation: minLength 1, maxLength 50
     - name: media | type: Media | description: Media items (images, videos etc) associated with this collection. Read only.  | read-only: true 
        - name: mainMedia | type: MediaItem | description: Primary media (image, video etc) associated with this product.  
           - ONE-OF: 
              - name: image | type: MediaItemUrlAndSize | description: Image data (URL, size).  
                 - name: url | type: string | description: Media item URL.  | validation: format WEB_URL
                 - name: width | type: integer | description: Media item width.  | validation: minimum 0
                 - name: height | type: integer | description: Media item height.  | validation: minimum 0
                 - name: format | type: string | description: Media format (mp4, png, etc.).  
                 - name: altText | type: string | description: Alt text. This text will be shown in case the image is not available.  
              - name: video | type: MediaItemVideo | description: Video data (URL, size).  
                 - name: files | type: array<MediaItemUrlAndSize> | description: Data (URL, size) about each resolution for which this video is available.  
                 - name: stillFrameMediaId | type: string | description: GUID of an image taken from the video. Used primarily for Wix Search indexing. For example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`.  
           - name: thumbnail | type: MediaItemUrlAndSize | description: Media item thumbnail details.  
           - name: mediaType | type: MediaItemType | description: Media item type (image, video, etc.).  
                 - enum:
                 -     unspecified_media_item_type: 
                 -     image: Image media type.
                 -     video: Video media type.
                 -     audio: Audio media type.
                 -     document: Document media type.
                 -     zip: Zip media type.
           - name: title | type: string | description: Media item title.  
           - name: id | type: string | description: Media GUID (for example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`).  
        - name: items | type: array<MediaItem> | description: Media (images, videos etc) associated with this product.  
     - name: numberOfProducts | type: integer | description: Number of products in the collection. Read only.  | read-only: true 
     - name: description | type: string | description: Collection description.  | validation: minLength 0, maxLength 600
     - name: slug | type: string | description: Collection slug.  | validation: minLength 1, maxLength 100
     - name: visible | type: boolean | description: Collection visibility. Only impacts dynamic pages, no impact on static pages. Default: `true`.  


```

### Examples

### UpdateCollection
```curl
~~~cURL
curl -X PATCH \
   'https://www.wixapis.com/stores/v1/collections/81093e7d-a251-4a22-a238-df3aa816f3dc' \
    --data-binary '{
                   	"collection": {
                   		"name": "Updated name"
                   	}
                   }' \
   -H 'Content-Type: application/json' \
   -H 'Authorization: <AUTH>'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.stores.products.updateCollection(_id, collection)
 Description: Updates specified properties of a collection. To add products to a collection, call the [Add Products to Collection](https://dev.wix.com/api/rest/wix-stores/catalog/collections/add-products-to-collection) endpoint.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  collection, _id
 Method parameters: 
   param name: _id | type: string | description: Collection GUID (generated automatically by the catalog). | required: true | validation: minLength 35, maxLength 36
   param name: collection | type: Collection   | required: true 
        - name: name | type: string | description: Collection name.  | validation: minLength 1, maxLength 50
        - name: description | type: string | description: Collection description.  | validation: minLength 0, maxLength 600
        - name: slug | type: string | description: Collection slug.  | validation: minLength 1, maxLength 100
        - name: visible | type: boolean | description: Collection visibility. Only impacts dynamic pages, no impact on static pages. Default: `true`.  
 Return type: PROMISE<UpdateCollectionResponse>
  - name: collection | type: Collection | description: Updated collection.  
     - name: _id | type: string | description: Collection GUID (generated automatically by the catalog).  | read-only: true | validation: minLength 35, maxLength 36
     - name: name | type: string | description: Collection name.  | validation: minLength 1, maxLength 50
     - name: media | type: Media | description: Media items (images, videos etc) associated with this collection. Read only.  | read-only: true 
        - name: mainMedia | type: MediaItem | description: Primary media (image, video etc) associated with this product.  
           - ONE-OF: 
              - name: image | type: MediaItemUrlAndSize | description: Image data (URL, size).  
                 - name: url | type: string | description: Media item URL.  | validation: format WEB_URL
                 - name: width | type: integer | description: Media item width.  | validation: minimum 0
                 - name: height | type: integer | description: Media item height.  | validation: minimum 0
                 - name: format | type: string | description: Media format (mp4, png, etc.).  
                 - name: altText | type: string | description: Alt text. This text will be shown in case the image is not available.  
              - name: video | type: MediaItemVideo | description: Video data (URL, size).  
                 - name: files | type: array<MediaItemUrlAndSize> | description: Data (URL, size) about each resolution for which this video is available.  
                 - name: stillFrameMediaId | type: string | description: GUID of an image taken from the video. Used primarily for Wix Search indexing. For example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`.  
           - name: thumbnail | type: MediaItemUrlAndSize | description: Media item thumbnail details.  
           - name: mediaType | type: MediaItemType | description: Media item type (image, video, etc.).  
                 - enum:
                 -     unspecified_media_item_type: 
                 -     image: Image media type.
                 -     video: Video media type.
                 -     audio: Audio media type.
                 -     document: Document media type.
                 -     zip: Zip media type.
           - name: title | type: string | description: Media item title.  
           - name: _id | type: string | description: Media GUID (for example, `"nsplsh_306d666a123a4a74306459~mv2_d_4517_2992_s_4_2.jpg"`).  
        - name: items | type: array<MediaItem> | description: Media (images, videos etc) associated with this product.  
     - name: numberOfProducts | type: integer | description: Number of products in the collection. Read only.  | read-only: true 
     - name: description | type: string | description: Collection description.  | validation: minLength 0, maxLength 600
     - name: slug | type: string | description: Collection slug.  | validation: minLength 1, maxLength 100
     - name: visible | type: boolean | description: Collection visibility. Only impacts dynamic pages, no impact on static pages. Default: `true`.  


```

### Examples

### Update a collection
```javascript
import { products } from "@wix/stores";

const collection = {
  _id: "81093e7d-a251-4a22-a238-df3aa816f3dc",
  name: "Updated name"
};

async function updateCollection() {
  const response = await products.updateCollection(collection);
}

```

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

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


async function updateCollection(_id,collection) {
  const response = await myWixClient.products.updateCollection(_id,collection);
};
```

---