> ## Documentation Index
> Fetch the complete documentation index at: https://docs.voyantcloud.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Collection Rules

> Update a collection's dynamic rules definition.

## Method

`PATCH` `/v1/collections/:id/rules`

## Path Parameters

<ParamField path="id" type="string" required>Collection ID</ParamField>

## Body Parameters

<ParamField path="definition_json" type="object" required>Rules definition</ParamField>

<ResponseField name="definition_json" type="object">
  <Expandable title="properties" defaultOpen>
    <ResponseField name="includeTags" type="string[]">Tags that must be present</ResponseField>
    <ResponseField name="excludeTags" type="string[]">Tags that must be absent</ResponseField>
    <ResponseField name="taxonomyNodeId" type="string">Taxonomy node identifier</ResponseField>
    <ResponseField name="destinationPlaceIds" type="string[]">Destination place IDs</ResponseField>

    <ResponseField name="price" type="object">
      <Expandable title="price">
        <ResponseField name="min" type="number">Minimum price</ResponseField>
        <ResponseField name="max" type="number">Maximum price</ResponseField>
        <ResponseField name="currency" type="string">ISO currency</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="availability" type="object">
      <Expandable title="availability">
        <ResponseField name="from" type="string">Start date (YYYY-MM-DD)</ResponseField>
        <ResponseField name="to" type="string">End date (YYYY-MM-DD)</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="capacity" type="object">
      <Expandable title="capacity">
        <ResponseField name="min" type="number">Minimum capacity</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="rules" type="Array<Rule>">
      <Expandable title="Rule">
        <ResponseField name="type" type="string">Rule type (e.g., <code>tag</code>, <code>destination</code>, <code>price</code>, <code>date</code>)</ResponseField>
        <ResponseField name="condition" type="string">Operator (e.g., <code>equals</code>, <code>contains</code>, <code>gte</code>, <code>lte</code>)</ResponseField>
        <ResponseField name="value" type="string">Value as string (numbers/dates are coerced)</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="manualProductIds" type="string[]">Explicit product IDs for manual collections</ResponseField>
  </Expandable>
</ResponseField>

<Tip>
  The definition is flexible and keys are optional. Avoid overlapping tags in <code>includeTags</code>
  and <code>excludeTags</code>. For manual collections, prefer <code>manualProductIds</code>; for smart
  collections, use <code>rules</code> and related filter keys.
</Tip>

## Headers

<ParamField header="Authorization" type="string" required>Bearer token (e.g. <code>Authorization: Bearer YOUR\_API\_KEY</code>)</ParamField>
<ParamField header="content-type" type="string">application/json</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X PATCH https://api.voyantcloud.com/v1/collections/col_123/rules \
    -H "Authorization: Bearer YOUR_API_KEY" \
    -H "content-type: application/json" \
    -d '{
      "definition_json": {
        "includeTags": ["summer"],
        "excludeTags": ["archived"],
        "destinationPlaceIds": ["paris"],
        "price": { "min": 100, "max": 500, "currency": "EUR" },
        "availability": { "from": "2025-06-01", "to": "2025-08-31" },
        "rules": [ { "type": "tag", "condition": "equals", "value": "family" } ]
      }
    }'
  ```

  ```javascript Node.js theme={null}
  await fetch("https://api.voyantcloud.com/v1/collections/col_123/rules", {
    method: "PATCH",
    headers: { Authorization: `Bearer ${process.env.VOYANT_API_KEY}`, "content-type": "application/json" },
    body: JSON.stringify({ definition_json: { includeTags: ["summer"], price: { min: 100, max: 500, currency: "EUR" } } }),
  })
  ```

  ```python Python theme={null}
  import os, requests
  requests.patch(
    "https://api.voyantcloud.com/v1/collections/col_123/rules",
    headers={"Authorization": f"Bearer {os.environ['VOYANT_API_KEY']}", "content-type": "application/json"},
    json={"definition_json": {"includeTags": ["summer"], "availability": {"from":"2025-06-01","to":"2025-08-31"}}},
  )
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  { "ok": true }
  ```
</ResponseExample>
