**Version: 202201**

# Update Collection

**PUT** `/openapi/2022-01/collections/:id`

Allows users to update details of an existing collection by providing the collection ID and the desired updates in the request body.

## Request

**Path Parameters**

- `id` string (required)

  Collection's ID

**application/json**

**Body | Example**

**Body**

- `collection` object

  - `title` string

    The title of the collection.
  - `handle` string

    The SEO link, the C-end album link is https://{subdomain}.myshoplaza.com/collections/{handle}.
  - `seo_title` string

    SEO title.
  - `seo_keywords` string

    SEO keywords, separated by English commas.
  - `seo_description` string

    SEO description.
  - `description` string

    The description of the collection, supports rich text.
  - `image` object

    The image for the collection. This image is added to the collection's page in the Shoplazza admin.

    - `src` string (required)

      Image's URL
    - `width` int32

      Image's width in px
    - `height` int32

      Image's height in px
    - `alt` string

      Image's alt
  - `sort_order` string

    Collection merchandise sorting rules:

    - `alpha-asc`: merchandise title dictionary in ascending order
    - `alpha-desc`: merchandise title dictionary in reverse order
    - `price-asc`: merchandise price in ascending order
    - `price-desc`: merchandise price in reverse order
    - `created-desc`: merchandise creation time in ascending order
    - `manual` manual sorting, sorted in the order of the product_ids field.
  - `product_ids` string

    Product IDs inside this collection, separated by comma, for example: `0097cfc8-6ec3-40ed-ab9f-6f2231b705a6,0097cfc8-6ec3-40ed-ab9f-6f2231b705a6`
  - `is_clear_all_product_ids` boolean

    Whether to clear the collection

```json
{
  "collection": {
    "title": "string",
    "handle": "string",
    "seo_title": "string",
    "seo_keywords": "string",
    "seo_description": "string",
    "description": "string",
    "image": {
      "src": "string",
      "width": 0,
      "height": 0,
      "alt": "string"
    },
    "sort_order": "string",
    "product_ids": "string",
    "is_clear_all_product_ids": true
  }
}
```

## Responses

**200 | 404 | 422**

200

**application/json**

**Schema | Example | Result**

**Schema**

- `collection` object

  - `id` string

    **Example:** `a60fe556-43ad-4e07-9125-507ac1bf71f7`
  - `title` string

    **Example:** `Test-Collection`
  - `description` string

    **Example:** `Desc`
  - `handle` string

    **Example:** `test-collection`
  - `smart` boolean

    **Default value:** `true`

    **Example:** `false`
  - `image` object

    - `src` string

      **Example:** `//cdn.shoplazza.com/9de53f9726576696b318a8d95c0946cb.jpeg`
    - `width` integer

      **Default value:** `0`

      **Example:** `1920`
    - `height` integer

      **Default value:** `0`

      **Example:** `1080`
    - `alt` string

      **Example:**
    - `path` string

      **Example:** `9de53f9726576696b318a8d95c0946cb.jpeg`
  - `seo_title` string

    **Example:** `seo_title`
  - `seo_description` string

    **Example:** `Desc`
  - `seo_keywords` string

    **Example:** `test`
  - `sort_order` string

    **Example:** `title-desc`
  - `created_at` string

    **Example:** `2024-04-16T10:31:13Z`
  - `updated_at` string

    **Example:** `2024-04-16T11:29:32Z`

```json
{
  "collection": {
    "id": "a60fe556-43ad-4e07-9125-507ac1bf71f7",
    "title": "Test-Collection",
    "description": "Desc",
    "handle": "test-collection",
    "smart": false,
    "image": {
      "src": "//cdn.shoplazza.com/9de53f9726576696b318a8d95c0946cb.jpeg",
      "width": 1920,
      "height": 1080,
      "alt": "",
      "path": "9de53f9726576696b318a8d95c0946cb.jpeg"
    },
    "seo_title": "seo_title",
    "seo_description": "Desc",
    "seo_keywords": "test",
    "sort_order": "title-desc",
    "created_at": "2024-04-16T10:31:13Z",
    "updated_at": "2024-04-16T11:29:32Z"
  }
}
```

```json
{
    "collection": {
        "id": "a60fe556-43ad-4e07-9125-507ac1bf71f7",
        "title": "Test-Collection",
        "description": "Desc",
        "handle": "test-collection",
        "smart": false,
        "image": {
            "src": "//cdn.shoplazza.com/9de53f9726576696b318a8d95c0946cb.jpeg",
            "width": 1920,
            "height": 1080,
            "alt": "",
            "path": "9de53f9726576696b318a8d95c0946cb.jpeg"
        },
        "seo_title": "seo_title",
        "seo_description": "Desc",
        "seo_keywords": "test",
        "sort_order": "title-desc",
        "created_at": "2024-04-16T10:31:13Z",
        "updated_at": "2024-04-16T11:29:32Z"
    }
}
```

404

**application/json**

**Schema | Example | Result**

**Schema**

- `errors` string[]

```json
{
  "errors": [
    "Collection not found"
  ]
}
```

```json
{
  "errors": [
    "Collection not found"
  ]
}
```

422

**application/json**

**Schema | Example | Result**

**Schema**

- `errors` string[]

```json
{
  "errors": [
    "productIds has an invalid UUID"
  ]
}
```

```json
{
  "errors": [
    "productIds has an invalid UUID"
  ]
}
```
