**Version: 202701**

# Asynchronously update smart collection rules

**PATCH** `/openapi/2027-01/collections/:id/smart-rule/async`

Initiates an asynchronous update of a smart collection's match rules. Returns an async task ID immediately; use GetCollectionAsyncTask to poll the result.

## Request

**Path Parameters**

- `id` string (required)

  Collection ID

**application/json**

**Body | Example**

**Body (required)**

- `match_rules` object

  Smart collection match rules

  - `disjunctive` boolean

    Logical relationship between rule modules:

    *   `true`: any rule module matched is sufficient (OR)
    *   `false`: all rule modules must be matched (AND, default)
  - `rule_modules` object[]

    List of rule modules

    *   Array \[

    - `disjunctive` boolean

      Logical relationship between rules in this module:

      *   `true`: any rule matched is sufficient (OR)
      *   `false`: all rules must be matched (AND, default)
    - `rules` object[]

      List of rules in this module

      *   Array \[

      - `column` string

        Target field to apply the rule on. Supported values:

        *   `title`: product title
        *   `product_status`: product status
        *   `tags`: product tags
        *   `vendor`: vendor / supplier
        *   `variant_price`: SKU price
        *   `variant_weight`: SKU weight
        *   `inventory_quantity`: inventory quantity
        *   `product_note`: product note
        *   `sales`: sales volume
        *   `real_sales`: actual sales volume
        *   `views`: view count
        *   `add_to_cart_count`: add-to-cart count
        *   `created_at`: product creation time
        *   `spu`: SPU identifier
        *   `spus_match`: SPU match status
        *   `published_at`: publish time
        *   `category_id`: category ID
        *   `brand`: brand
      - `relation` string

        Comparison operator used for matching. Supported values:

        *   `equals`: equals
        *   `not_equals`: not equals
        *   `starts_with`: starts with
        *   `ends_with`: ends with
        *   `contains`: contains
        *   `not_contains`: does not contain
        *   `greater_than`: greater than
        *   `less_than`: less than
        *   `top`: top N results (usually used with sortable fields)
      - `condition` string

        Condition value for the rule

        *   Text fields: plain string
        *   Numeric fields: string convertible to a number
        *   Time fields: timestamp or agreed time format
        *   `top` relation: represents the value of N
      *   \]
    *   \]

```json
{
  "match_rules": {
    "disjunctive": true,
    "rule_modules": [
      {
        "disjunctive": true,
        "rules": [
          {
            "column": "string",
            "relation": "string",
            "condition": "string"
          }
        ]
      }
    ]
  }
}
```

## Responses

**200**

OK

**application/json**

**Schema | Example**

**Schema**

- `code` string

  error code
- `message` string

  error message
- `data` object

  - `async_task_id` string

    Async task ID. Use GetCollectionAsyncTask to poll for completion
  - `collection` object

    Collection

    - `id` string

      Collection ID
    - `title` string

      Title
    - `description` string

      Description
    - `handle` string

      URL-friendly identifier (handle)
    - `smart` boolean

      Smart
    - `image` object

      Image

      - `src` string

        The source URL of the image
      - `width` int32

        The width of the image in pixels
      - `height` int32

        The height of the image in pixels
      - `alt` string

        Alt text for the image
    - `seo_title` string

      SEO title
    - `seo_keywords` string[]

      SEO keywords
    - `seo_description` string

      SEO description
    - `sort_order` string

      Sort order
    - `created_at` string

      Creation timestamp, in ISO-8601 format
    - `updated_at` string

      Last update timestamp, in ISO-8601 format
    - `match_rules` object

      Smart collection match rules

      - `disjunctive` boolean

        Whether conditions are disjunctive (OR)
      - `rule_modules` object[]

        List of rule modules

        *   Array \[

        - `disjunctive` boolean

          Whether conditions are disjunctive (OR)
        - `rules` object[]

          List of rules in this module

          *   Array \[

          - `column` string

            Column
          - `relation` string

            Relation
          - `condition` string

            Condition
          *   \]
        *   \]
    - `tags` string[]

      List of tags for the collection
    - `product_count` int64

      Number of products in the collection

```json
{
  "code": "string",
  "message": "string",
  "data": {
    "async_task_id": "string",
    "collection": {
      "id": "string",
      "title": "string",
      "description": "string",
      "handle": "string",
      "smart": true,
      "image": {
        "src": "string",
        "width": 0,
        "height": 0,
        "alt": "string"
      },
      "seo_title": "string",
      "seo_keywords": [
        "string"
      ],
      "seo_description": "string",
      "sort_order": "string",
      "created_at": "string",
      "updated_at": "string",
      "match_rules": {
        "disjunctive": true,
        "rule_modules": [
          {
            "disjunctive": true,
            "rules": [
              {
                "column": "string",
                "relation": "string",
                "condition": "string"
              }
            ]
          }
        ]
      },
      "tags": [
        "string"
      ],
      "product_count": 0
    }
  }
}
```
