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

# Update Sync Rules

> Replace the company's sync rules

Replaces the full sync rule set, or resets to the platform defaults when
`null` is sent. This is not a partial update - fetch the current rules with
[Get Sync Rules](/api-reference/sync-rules/get), edit them, and send the
whole set back.

## Request

<ParamField body="syncRules" type="array | null" required>
  Full replacement rule set, or `null` to reset to the platform defaults.
  Each rule has `triggerEvent`, `actions.addTags`, `actions.removeTags`, and
  optional `conditions` (`requiresTags`, `requiresNotTags`, and
  `purchasedProduct` with `tags`, `collectionIds`, `productTypes`, or
  `vendors` for commerce events that carry products).
</ParamField>

Tag buyers of a product tag:

```bash theme={null}
curl -X PUT "https://api.sequenzy.com/api/v1/sync-rules" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "syncRules": [
      {
        "triggerEvent": "ecommerce.order_placed",
        "actions": { "addTags": ["vinyl-collector"], "removeTags": [] },
        "conditions": {
          "purchasedProduct": { "tags": ["Vinyl"] }
        }
      }
    ]
  }'
```

Reset to the platform defaults:

```bash theme={null}
curl -X PUT "https://api.sequenzy.com/api/v1/sync-rules" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"syncRules": null}'
```

## Responses

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "message": "Saved 1 sync rule.",
    "syncRules": [
      {
        "triggerEvent": "ecommerce.order_placed",
        "actions": { "addTags": ["vinyl-collector"], "removeTags": [] },
        "conditions": {
          "purchasedProduct": { "tags": ["Vinyl"] }
        }
      }
    ],
    "isDefault": false
  }
  ```

  ```json 400 theme={null}
  {
    "success": false,
    "error": "syncRules.0.triggerEvent: String must contain at least 1 character(s)"
  }
  ```

  ```json 401 theme={null}
  {
    "success": false,
    "error": "Unauthorized"
  }
  ```
</ResponseExample>
