# Customer Groups

Create manual or rule-based customer groups and manage their memberships through the Store API.

Customer Groups require customer scopes: reads use `read_customers` and writes use `write_customers`. Manual groups have members you add or remove. Automatic groups select members from their saved rules. A group's type cannot change after creation.

## Spending and order-count thresholds

For `lifetime_spend`, `orders_count` and `rto_count`, use `gte` or `lte` with a non-negative decimal string in `value` and omit `value_id`. Read `GET /customer-groups/limits` before constructing inputs: each numeric operator includes `decimal_places` and `max_value`. Spending operators also include `currency` with the store base currency code, symbol, and display precision. Use `decimal_places` for accepted amount precision; currency display precision can differ.

| Field | Accepted value | Meaning |
| --- | --- | --- |
| `lifetime_spend` | Use the store base currency, no grouping or symbol, at most 12 integral digits, and the currency's amount precision. For example, INR accepts `100.01` but rejects `100.001`; JPY accepts `100`; KWD accepts `100.001`. Extra trailing zeroes that do not change the amount are accepted. Do not send scientific notation. | The customer's total recorded paid value less refunds, in the store base currency. |
| `orders_count` | A whole-number string from `0` through `2147483647`, with no decimal point. | Orders recorded as paid. Refunding an order does not remove it from this count. For retained purchases that exclude fully refunded orders, use the purchase rules below. |
| `rto_count` | A whole-number string from `0` through `2147483647`, with no decimal point. | Orders of the customer that came back undelivered (RTO), cash on delivery or prepaid, each counted once. Pair it with a cash-on-delivery rule on the group to stop cash on delivery for these customers. |

Create, rule updates, and preview use the same validation. Invalid spending precision or bounds return HTTP 400 `GROUP_RULE_MONEY_INVALID`; invalid order counts return `GROUP_RULE_ORDER_COUNT_INVALID`. Malformed numeric values can return `GROUP_RULE_NUMBER_INVALID`, and unrelated references return `GROUP_RULE_VALUE_SHAPE_INVALID`. Saved rule values remain decimal strings; General display preferences do not change their meaning. Existing saved thresholds are not rounded automatically. Correct an invalid older threshold before resubmitting its rules.

## Use purchase rules

Automatic Customer Groups can use `last_purchase_at` and `purchased_product` rules. Before authoring or previewing one, call `GET /customer-groups/purchase-rule-readiness`. This read endpoint requires `read_customers`; the credential determines the store.

```json
{
  "success": true,
  "data": {
    "available": true,
    "status": "ready"
  }
}
```

While purchase history is being prepared, the endpoint returns `available: false`, `status: refreshing`, and `reason: CUSTOMER_PURCHASE_FACTS_REFRESHING`. Requests that create, change, preview, or evaluate purchase rules then return HTTP 409 with the same error code. Metadata-only updates, such as changing a group name without submitting rules, remain available. Retry after readiness becomes `ready`; do not interpret refreshing as no matching customers.

| Field | Operators | Value and behavior |
| --- | --- | --- |
| `last_purchase_at` | `within_last`, `before`, `after`, `is_null`, `is_not_null` | For `within_last`, use `1d` through `365d`, without signs or leading zeroes; each day is a rolling 24-hour period. For `before` and `after`, use a valid `YYYY-MM-DD` date in years 0001–9999. Dates use UTC calendar boundaries and exclude the selected day; `after` starts at the next UTC midnight. Omit `value_id` for every purchase-date rule. Null operators also require `value` to be omitted or null. |
| `purchased_product` | `includes`, `excludes` | Put the positive parent product ID in `value` as a canonical decimal string from `1` through `9223372036854775807`, without whitespace, signs, or leading zeroes, and omit `value_id`. A parent product matches retained eligible quantity from any variant. Do not send a variant, category, or collection ID. |

Purchase conditions count paid and cash-on-delivery orders with item quantity remaining after refunds. Cancelled, test, unpaid non-COD, and fully refunded orders do not count. A full monetary refund excludes the order even when no individual item quantities were marked as refunded. A fully refunded line no longer matches `purchased_product`; a partially refunded line still matches while eligible quantity remains. `last_purchase_at` is the latest order creation time among qualifying purchases, so an order can continue to set the date when another eligible item remains after refunds. Once readiness is complete, an eligible customer with no retained purchase matches `last_purchase_at is_null` and `purchased_product excludes`.

An invalid, deleted, or other-store parent product returns HTTP 400 with `GROUP_RULE_PRODUCT_INVALID`. Invalid dates or day ranges return `GROUP_RULE_DATE_INVALID` or `GROUP_RULE_DURATION_INVALID`; missing required values return `GROUP_RULE_VALUE_REQUIRED`. Extra values on an empty check or a `value_id` on a purchase-date rule return `GROUP_RULE_VALUE_SHAPE_INVALID`. Purchase-rule readiness only states whether these rules can be evaluated; it does not grant marketing consent.

## Synchronize group membership

Use the membership snapshot and change feed together when your integration needs a durable local copy of a Customer Group's membership. Both endpoints require `read_customers`. The credential determines the store, and each item contains only a customer UUID. The feed does not include customer profiles, contact details, or marketing-consent state; treat customer UUIDs as customer data and protect them accordingly.

| Task | Endpoint | First-page query |
| --- | --- | --- |
| Read a complete starting membership | `GET /customer-groups/{id}/membership-snapshot` | Optional `limit` from 1 to 250; default 100. |
| Replay later membership changes | `GET /customer-groups/{id}/membership-changes` | Optional non-negative `after_revision` and optional `limit` from 1 to 250; defaults are 0 and 100. |

### Take the initial snapshot

```json
{
  "success": true,
  "data": {
    "group_id": "58ee109f-64f7-4a51-8d48-b0ca62c4236a",
    "revision": 42,
    "ready": true,
    "last_evaluated_at": "2026-09-12T10:00:00-04:00",
    "customer_ids": ["87964951-2890-4b72-bd8f-78625a76c737"],
    "has_more": true,
    "next_cursor": "opaque"
  }
}
```

Always take this initial snapshot, even if you plan to request changes from `after_revision=0`: revision 0 can already have members but has no change item for each preexisting membership. Keep the returned `revision`. If `has_more` is true, request the next page with `cursor` as the only query parameter. The cursor pins every snapshot page to the same revision and page limit. If membership changes while you paginate, the API returns `CUSTOMER_GROUP_MEMBERSHIP_RESTART_REQUIRED`; discard the partial snapshot and restart without a cursor. An automatic group that is still refreshing returns `CUSTOMER_GROUP_MEMBERSHIP_REFRESHING` and no customer IDs or cursor.

### Replay changes after the snapshot

```json
{
  "success": true,
  "data": {
    "group_id": "58ee109f-64f7-4a51-8d48-b0ca62c4236a",
    "current_revision": 44,
    "history_floor_revision": 12,
    "through_revision": 44,
    "group_deleted": false,
    "changes": [
      {"revision": 43, "operation": "added", "customer_id": "28f97875-549a-4ec3-a074-51b159411f99"},
      {"revision": 44, "operation": "removed", "customer_id": "87964951-2890-4b72-bd8f-78625a76c737"}
    ],
    "revisions": [
      {"revision": 43, "change_kind": "members_changed", "added_count": 1, "removed_count": 0, "recorded_at": "2026-09-12T10:05:00-04:00"},
      {"revision": 44, "change_kind": "members_changed", "added_count": 0, "removed_count": 1, "recorded_at": "2026-09-12T10:06:00-04:00"}
    ],
    "has_more": false
  }
}
```

Apply changes in the returned order: revision ascending, then operation in the fixed order `added`, `removed`, `group_deleted`, then customer UUID. A page contains at most `limit` change items, including a `group_deleted` marker. `revisions` supplies counts and timestamps for exactly the revisions touched by that page; counts can cover items split across more than one page. Persist each operation idempotently. For a page with `has_more`, checkpoint `next_cursor` only after the complete page is durable. For the final page, checkpoint `through_revision` only after the complete traversal is durable. Pagination is pinned to `through_revision`, so changes committed later do not enter the traversal. Begin the next traversal with `after_revision` equal to that checkpointed `through_revision`.

A `removed` operation means that the customer left this group. It does not mean that the customer withdrew marketing consent, and an `added` operation does not grant consent. Read and process marketing consent through the customer contract separately.

Promotional campaign control groups are configured by staff in Store Admin or the mobile app and are not Store API resources. An integration can synchronize a Customer Group with these endpoints and run its own authorized experiment, but it must enforce destination consent, suppression, assignment and deletion rules itself. The membership feed cannot launch a Tringify campaign or place a customer into a Tringify campaign's message or control arm.

### Cursors, retention, and deletion

Cursors are opaque, bound to the credential's store, group, endpoint, page limit, and captured revision, and expire no later than 24 hours after the first page was issued. Continuation requests accept only `cursor`; changing `limit` or `after_revision` requires a new first page. Store cursors exactly as returned and never inspect or modify them.

Change history is retained for at least 30 days. `history_floor_revision` is the highest revision already removed; complete replay is available only when `after_revision` is at or above that floor. `CUSTOMER_GROUP_MEMBERSHIP_CURSOR_EXPIRED` means the cursor's 24-hour lifetime ended or required change history was removed; take a new snapshot instead of treating the result as no changes. The change feed remains readable after group deletion and ends with a `group_deleted` operation without a `customer_id`. After that marker is durable, discard the obsolete local membership mirror. Snapshot requests for a deleted group return `CUSTOMER_GROUP_MEMBERSHIP_DELETED`.

| HTTP | Error code | Recovery |
| --- | --- | --- |
| 400 | `CUSTOMER_GROUP_MEMBERSHIP_CURSOR_INVALID` | Start a new request with valid first-page parameters; do not reuse the cursor for another store, group, or endpoint. |
| 404 | `CUSTOMER_GROUP_NOT_FOUND` | Verify the group belongs to the credential's store. |
| 409 | `CUSTOMER_GROUP_MEMBERSHIP_REFRESHING` | Retry the first snapshot after automatic evaluation completes. |
| 409 | `CUSTOMER_GROUP_MEMBERSHIP_RESTART_REQUIRED` | Discard all partial snapshot pages and begin the snapshot again. |
| 410 | `CUSTOMER_GROUP_MEMBERSHIP_CURSOR_EXPIRED` | Take a new snapshot, then resume replay from that snapshot revision. |
| 410 | `CUSTOMER_GROUP_MEMBERSHIP_DELETED` | Stop snapshot synchronization; use the change feed to observe deletion when retained history permits. |

## Receive membership webhooks

A merchant can connect a saved Customer Group to a webhook endpoint. The endpoint receives `customer_group_membership.snapshot` while a complete membership is synchronized, then `customer_group_membership.changes` for later revisions. These deliveries use the standard webhook JSON envelope and request signature described in Webhook events. Verify the signature against the raw request body, deduplicate by envelope `event_id`, and return a successful response only after durably accepting the batch.

Process batches by `subscription_id`, `generation_number`, and `batch_sequence`. `generation` is the opaque UUID for one synchronization epoch. `generation_number` increases when a fresh synchronization starts, and `batch_sequence` increases within that generation. HTTP requests can complete out of order. Stage a later sequence until earlier sequences in that generation are durable. When a larger generation number appears, discard partial work from older generations and build the replacement membership from the new snapshot.

```json
{
  "subscription_id": "6cb6ffb3-2d41-49cb-bac6-e3229c499cd3",
  "group_id": "bd74fa4d-13c3-4ae8-90ef-c4bed6bc6518",
  "generation": "c010b2a7-dd8b-4b24-8a03-9201becafbdd",
  "generation_number": 2,
  "batch_sequence": 1,
  "final": true,
  "revision": 18,
  "customer_ids": [
    "014f36c2-2469-4cc5-a105-e785d7605416",
    "bf655bea-c683-43e2-8792-16e4411d593d"
  ]
}
```

Collect every snapshot batch for one generation and promote it as the current membership only after all sequences through the batch marked `final: true` are durable. An empty final snapshot is a valid empty group. `final` closes that snapshot or change-page sequence; it does not close the connection.

```json
{
  "subscription_id": "6cb6ffb3-2d41-49cb-bac6-e3229c499cd3",
  "group_id": "bd74fa4d-13c3-4ae8-90ef-c4bed6bc6518",
  "generation": "c010b2a7-dd8b-4b24-8a03-9201becafbdd",
  "generation_number": 2,
  "batch_sequence": 2,
  "final": true,
  "from_revision": 18,
  "through_revision": 20,
  "changes": [
    {"revision": 19, "operation": "added", "customer_id": "8a4d941f-5541-4f54-9a71-29c4dc063987"},
    {"revision": 20, "operation": "removed", "customer_id": "014f36c2-2469-4cc5-a105-e785d7605416"}
  ],
  "revisions": [
    {"revision": 19, "change_kind": "members_changed", "added_count": 1, "removed_count": 0, "recorded_at": "2026-09-12T09:30:00-04:00"},
    {"revision": 20, "change_kind": "members_changed", "added_count": 0, "removed_count": 1, "recorded_at": "2026-09-12T09:31:00-04:00"}
  ],
  "group_deleted": false
}
```

Apply `changes` in their supplied order and make each revision idempotent. `added` inserts a customer UUID and `removed` removes it. `revisions` describes the source revisions represented by the batch and can include a revision with no item changes. Each revision's `recorded_at` is RFC 3339 in the store's timezone with its offset, as everywhere else in webhooks. Use `through_revision` as the durable source checkpoint only after the complete batch is accepted. A checkpoint shown by Tringify means the batch was queued; it does not prove that your endpoint received it.

When `group_deleted` is true, the changes include a terminal `group_deleted` operation without `customer_id`. Apply all earlier operations in the batch before removing the local group. Delivery is at least once, so retries can repeat the same `event_id`. Pausing and reconnecting begins a new generation with sequence 1 and a fresh snapshot. Removing the connection deletes its queued and historical deliveries, although a request already in flight can complete.

> The payload contains customer UUIDs only. Membership in a Customer Group does not authorize contact. If your integration sends marketing, check the customer's current consent and the purpose of the communication when you act.

## Endpoints

## Customer Group limits

`GET /api/2025-01/customer-groups/limits`

Returns field, list, rule, membership, and store limits enforced by Customer Group endpoints. `group_type_options`, `match_type_options` and `customer_status_options` list the group types, rule match types and member statuses as `value` with a `label` worded by the API. `rule_fields` lists each field rules can test with its `label`, and its `operators`, each with a `label` and, for a fixed set of values, `options` (`value` and `label`), all worded by the API.

Scope: `read_customers`

```curl
curl 'https://api-store.tringify.com/api/2025-01/customer-groups/limits' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{"data":{"customer_status_options":[{"label":"Active","value":"active"},{"label":"Disabled","value":"disabled"}],"desc_max_length":5000,"group_type_options":[{"label":"Manual","value":"manual"},{"label":"Automatic","value":"automatic"}],"list_max_limit":500,"list_page_size":50,"match_type_options":[{"label":"All conditions","value":"all"},{"label":"Any condition","value":"any"}],"max_conditions":20,"max_groups_per_store":100,"max_members_batch":200,"name_max_length":100,"page_size_options":[20,50,100,200,500],"rule_fields":[{"field":"status","label":"Status","operators":[{"default_value":"active","label":"is","operator":"equals","options":[{"label":"Active","value":"active"},{"label":"Disabled","value":"disabled"}],"requires_value":true,"value_kind":"status"},{"default_value":"active","label":"is not","operator":"not_equals","options":[{"label":"Active","value":"active"},{"label":"Disabled","value":"disabled"}],"requires_value":true,"value_kind":"status"}],"ops":["equals","not_equals"]}],"search_max_length":200,"sort_columns":["name","member_count","created_at","updated_at"]},"success":true}
```

## Purchase rule readiness

`GET /api/2025-01/customer-groups/purchase-rule-readiness`

Reports whether the store's purchase history is ready for `last_purchase_at` and `purchased_product` rules. While it is refreshing, `available` is false, `status` is `refreshing` and `reason` is CUSTOMER_PURCHASE_FACTS_REFRESHING; creating, updating or previewing a group with purchase rules returns that code with 409 until `status` is `ready`. A refresh starts automatically when needed.

Scope: `read_customers`

```curl
curl 'https://api-store.tringify.com/api/2025-01/customer-groups/purchase-rule-readiness' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{"success":true,"data":{"available":false,"status":"refreshing","reason":"CUSTOMER_PURCHASE_FACTS_REFRESHING"}}
```

## List Customer Groups

`GET /api/2025-01/customer-groups`

Returns a paginated, searchable, sortable list of manual and automatic groups. Pass `exclude_customer_id` to leave out groups that customer already belongs to, for example with `group_type=manual` to list groups a customer can be added to; totals and pages reflect the filter. Each group carries `type_display`, its type worded by the API.

Scope: `read_customers`

```curl
curl 'https://api-store.tringify.com/api/2025-01/customer-groups?exclude_customer_id=f37a970d-5f56-4ca8-9d4d-4ea10190f8a5&group_type=automatic&limit=50&page=1&search=vip&sort_by=name&sort_direction=asc' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{"success":true,"data":{"groups":[{"id":"8eb31980-7f67-453f-bf13-873b62a47b68","store_id":"74e634ea-84ec-43b8-b66b-986214c2c5a3","name":"VIP customers","slug":"vip-customers","description":"Customers eligible for VIP benefits.","type":"automatic","type_display":"Automatic","match_type":"all","rules":[{"id":"3d050cfd-3408-40bf-87a9-22f6eb979146","field":"orders_count","op":"gte","value":"5","created_at":"2026-08-01T09:30:00-04:00"}],"member_count":12,"membership":{"ready":true,"evaluated_at":"2026-08-01T04:00:00-04:00"},"last_evaluated_at":"2026-08-01T09:30:00-04:00","created_at":"2026-08-01T09:30:00-04:00","updated_at":"2026-08-01T09:30:00-04:00"}],"total":1,"page":1,"limit":50,"sort_by":"name","sort_direction":"asc"}}
```

## Get a Customer Group

`GET /api/2025-01/customer-groups/{id}`

Returns the group, its rules, and membership freshness when it belongs to the token's store. `type_display` words the group type. membership.ready is false while membership needs refreshing. within_last uses rolling 24-hour days; date boundaries and birthday rules use UTC. birthday_within includes today through the selected number of days ahead; February 29 maps to February 28 in non-leap years.

Scope: `read_customers`

```curl
curl 'https://api-store.tringify.com/api/2025-01/customer-groups/8eb31980-7f67-453f-bf13-873b62a47b68' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{"success":true,"data":{"group":{"id":"8eb31980-7f67-453f-bf13-873b62a47b68","store_id":"74e634ea-84ec-43b8-b66b-986214c2c5a3","name":"VIP customers","slug":"vip-customers","description":"Customers eligible for VIP benefits.","type":"automatic","type_display":"Automatic","match_type":"all","rules":[{"id":"3d050cfd-3408-40bf-87a9-22f6eb979146","field":"orders_count","op":"gte","value":"5","created_at":"2026-08-01T09:30:00-04:00"}],"member_count":12,"membership":{"ready":true,"evaluated_at":"2026-08-01T04:00:00-04:00"},"last_evaluated_at":"2026-08-01T09:30:00-04:00","created_at":"2026-08-01T09:30:00-04:00","updated_at":"2026-08-01T09:30:00-04:00"}}}
```

## Create a Customer Group

`POST /api/2025-01/customer-groups`

Creates a manual group or an automatic group whose members are selected by its rules. Activity rules (`last_visit_at`, `visits_30_days`, `viewed_product`, `viewed_collection`, `viewed_category`, `viewed_not_bought`, `carted_not_bought`) test what customers did on the storefront while signed in, recorded only with their analytics consent, as returned by `GET /customers/{id}/activity`. `visits_30_days`, `viewed_product`, `viewed_collection`, `viewed_category`, `viewed_not_bought` and `carted_not_bought` look at the rule's last `window_days` days (1 to 30); `viewed_collection` and `viewed_category` match a customer who viewed any product that is in the collection, or assigned to the category, now; a product counts as bought once the customer buys it after viewing it or adding it to the cart. Groups with activity rules are refreshed every few minutes.

Scope: `write_customers`

```curl
curl -X POST 'https://api-store.tringify.com/api/2025-01/customer-groups' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "description": "Customers eligible for VIP benefits.",
  "match_type": "all",
  "name": "VIP customers",
  "rules": [
    {
      "field": "orders_count",
      "op": "gte",
      "value": "5"
    }
  ],
  "slug": "vip-customers",
  "type": "automatic"
}'
```

Response:

```json
{"success":true,"data":{"group":{"id":"8eb31980-7f67-453f-bf13-873b62a47b68","store_id":"74e634ea-84ec-43b8-b66b-986214c2c5a3","name":"VIP customers","slug":"vip-customers","description":"Customers eligible for VIP benefits.","type":"automatic","type_display":"Automatic","match_type":"all","rules":[{"id":"3d050cfd-3408-40bf-87a9-22f6eb979146","field":"orders_count","op":"gte","value":"5","created_at":"2026-08-01T09:30:00-04:00"}],"member_count":12,"membership":{"ready":true,"evaluated_at":"2026-08-01T04:00:00-04:00"},"last_evaluated_at":"2026-08-01T09:30:00-04:00","created_at":"2026-08-01T09:30:00-04:00","updated_at":"2026-08-01T09:30:00-04:00"}}}
```

## Update a Customer Group

`PUT /api/2025-01/customer-groups/{id}`

Updates supplied fields. Supplying rules replaces an automatic group's existing rules and refreshes its membership.

Scope: `write_customers`

```curl
curl -X PUT 'https://api-store.tringify.com/api/2025-01/customer-groups/8eb31980-7f67-453f-bf13-873b62a47b68' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "description": "Customers eligible for VIP benefits.",
  "match_type": "all",
  "name": "VIP customers",
  "rules": [
    {
      "field": "orders_count",
      "op": "gte",
      "value": "5"
    }
  ],
  "slug": "vip-customers",
  "type": "automatic"
}'
```

Response:

```json
{"success":true,"data":{"group":{"id":"8eb31980-7f67-453f-bf13-873b62a47b68","store_id":"74e634ea-84ec-43b8-b66b-986214c2c5a3","name":"VIP customers","slug":"vip-customers","description":"Customers eligible for VIP benefits.","type":"automatic","type_display":"Automatic","match_type":"all","rules":[{"id":"3d050cfd-3408-40bf-87a9-22f6eb979146","field":"orders_count","op":"gte","value":"5","created_at":"2026-08-01T09:30:00-04:00"}],"member_count":12,"membership":{"ready":true,"evaluated_at":"2026-08-01T04:00:00-04:00"},"last_evaluated_at":"2026-08-01T09:30:00-04:00","created_at":"2026-08-01T09:30:00-04:00","updated_at":"2026-08-01T09:30:00-04:00"}}}
```

## Delete a Customer Group

`DELETE /api/2025-01/customer-groups/{id}`

Deletes the group and its memberships without deleting customer profiles. The group's own versions of storefront sections and blocks are removed from every theme with their translations, in the same step; `removed_versions` counts them. Read `GET /customer-groups/{id}/impact` first to show where they are. A section or block whose Everyone version showed nothing is turned off, since nobody saw it once the group is gone. A group that a discount targets is refused with 409 CUSTOMER_GROUP_USED_BY_DISCOUNTS, naming those discounts, and one that a cash on delivery rule names with 409 CUSTOMER_GROUP_USED_BY_COD_RULES, naming those markets; remove the group from them first.

Scope: `write_customers`

```curl
curl -X DELETE 'https://api-store.tringify.com/api/2025-01/customer-groups/8eb31980-7f67-453f-bf13-873b62a47b68' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{"success":true,"data":{"deleted":true,"removed_versions":2}}
```

## Get a Customer Group's delete impact

`GET /api/2025-01/customer-groups/{id}/impact`

Read-only. Lists the group's own versions of sections and blocks on storefront theme pages, which deleting the group removes. Each entry names the `storefront_name`, the `theme_name` (`theme_live` is true for the theme shoppers see), the `page` (`page_type`, with `label_key`, `handle` and `template_label_key` naming it the way the theme editor does), the `section_name` and, for a block, the `block_name`, all worded by the theme in English, and `shows_nothing` when the version hides the section or block from the group. `published` is true when the version is on the published page, not only its draft. `versions_count` counts every version; at most 100 are listed and `truncated` is true when there are more. Discounts and cash on delivery rules that name the group are not listed: `DELETE` refuses while they do, naming them.

Scope: `read_customers`

```curl
curl 'https://api-store.tringify.com/api/2025-01/customer-groups/8eb31980-7f67-453f-bf13-873b62a47b68/impact' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{"success":true,"data":{"versions_count":1,"versions":[{"storefront_id":"6f1e8a2b-4c3d-4e5f-8a9b-0c1d2e3f4a5b","storefront_name":"Online Store","theme_id":"0a256864-9d5a-4cfa-b14d-6b7773993880","theme_name":"Haul","theme_live":true,"page":{"page_type":"home","label_key":"detail.editor.surface.home"},"published":true,"section_id":"5593756f-5ecc-4c07-8473-4d84ed240490","section_name":"Product grid","version_id":"3f2b1c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d","shows_nothing":false}],"truncated":false}}
```

## Preview automatic rules

`POST /api/2025-01/customer-groups/preview-rules`

Returns the matching customer count and a sample without saving a group. Each sample customer carries `status_display`, its status worded by the API.

Scope: `read_customers`

```curl
curl -X POST 'https://api-store.tringify.com/api/2025-01/customer-groups/preview-rules' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "match_type": "all",
  "rules": [
    {
      "field": "orders_count",
      "op": "gte",
      "value": "5"
    }
  ]
}'
```

Response:

```json
{"success":true,"data":{"count":1,"sample":[{"customer_id":"f37a970d-5f56-4ca8-9d4d-4ea10190f8a5","email":"lee@example.com","first_name":"Lee","last_name":"Kim","status":"active","status_display":"Active","added_at":"2026-08-01T09:30:00-04:00"}]}}
```

## List group members

`GET /api/2025-01/customer-groups/{id}/members`

Returns store-scoped members with pagination, literal name/email search, and sorting. Each member carries `status_display`, its customer status worded by the API. Each page and its membership metadata use one snapshot. Check membership.ready before reuse; evaluated_at and valid_until are RFC 3339 in the store's timezone with its offset. A rolling-date selection expires after five minutes; birthday selections expire at the next UTC midnight. Dirty or never-evaluated automatic groups are not ready. Pages from separate requests are not a frozen export. Membership does not grant marketing consent.

Scope: `read_customers`

```curl
curl 'https://api-store.tringify.com/api/2025-01/customer-groups/8eb31980-7f67-453f-bf13-873b62a47b68/members?limit=50&page=1&search=lee&sort_by=added_at&sort_direction=desc' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{"success":true,"data":{"membership":{"ready":true,"evaluated_at":"2026-08-01T04:00:00-04:00"},"members":[{"customer_id":"f37a970d-5f56-4ca8-9d4d-4ea10190f8a5","email":"lee@example.com","first_name":"Lee","last_name":"Kim","status":"active","status_display":"Active","added_at":"2026-08-01T09:30:00-04:00"}],"total":1,"page":1,"limit":50,"sort_by":"added_at","sort_direction":"desc"}}
```

## List candidate members

`GET /api/2025-01/customer-groups/{id}/candidate-members`

Returns active customers in the token's store that are not already members. Each carries `status_display`, its status worded by the API.

Scope: `read_customers`

```curl
curl 'https://api-store.tringify.com/api/2025-01/customer-groups/8eb31980-7f67-453f-bf13-873b62a47b68/candidate-members?limit=50&page=1&search=lee&sort_by=email&sort_direction=asc' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{"success":true,"data":{"customers":[{"id":"f37a970d-5f56-4ca8-9d4d-4ea10190f8a5","email":"lee@example.com","first_name":"Lee","last_name":"Kim","status":"active","status_display":"Active"}],"total":1,"page":1,"limit":50,"sort_by":"email","sort_direction":"asc"}}
```

## Membership snapshot

`GET /api/2025-01/customer-groups/{id}/membership-snapshot`

Returns member customer ids sorted ascending, all from the same membership `revision`. Follow `next_cursor` while `has_more` is true. If membership changes before you finish, a continuation page returns CUSTOMER_GROUP_MEMBERSHIP_RESTART_REQUIRED: start again from the first page. Then call membership-changes with `after_revision` set to that revision to keep in sync. Returns CUSTOMER_GROUP_MEMBERSHIP_REFRESHING while an automatic group's membership is being refreshed; try again shortly. Membership does not grant marketing consent.

Scope: `read_customers`

```curl
curl 'https://api-store.tringify.com/api/2025-01/customer-groups/8eb31980-7f67-453f-bf13-873b62a47b68/membership-snapshot?limit=100' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{"success":true,"data":{"group_id":"8eb31980-7f67-453f-bf13-873b62a47b68","revision":42,"ready":true,"last_evaluated_at":"2026-08-01T04:00:00-04:00","customer_ids":["0b6a2f8e-3c1d-4e5f-9a7b-8c9d0e1f2a3b","f37a970d-5f56-4ca8-9d4d-4ea10190f8a5"],"has_more":false}}
```

## Membership changes

`GET /api/2025-01/customer-groups/{id}/membership-changes`

Returns members added and removed after `after_revision`, ordered by revision, through `through_revision`. `revisions` summarises each revision on the page. Follow `next_cursor` while `has_more` is true, then store `through_revision` as your next `after_revision`. If `after_revision` is older than `history_floor_revision`, that history is gone and the call returns CUSTOMER_GROUP_MEMBERSHIP_CURSOR_EXPIRED: read a new membership-snapshot. When the group is deleted, `group_deleted` is true and the last change has operation `group_deleted`.

Scope: `read_customers`

```curl
curl 'https://api-store.tringify.com/api/2025-01/customer-groups/8eb31980-7f67-453f-bf13-873b62a47b68/membership-changes?after_revision=41&limit=100' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN"
```

Response:

```json
{"success":true,"data":{"group_id":"8eb31980-7f67-453f-bf13-873b62a47b68","current_revision":43,"history_floor_revision":0,"through_revision":43,"group_deleted":false,"changes":[{"revision":42,"operation":"added","customer_id":"0b6a2f8e-3c1d-4e5f-9a7b-8c9d0e1f2a3b"},{"revision":43,"operation":"removed","customer_id":"f37a970d-5f56-4ca8-9d4d-4ea10190f8a5"}],"revisions":[{"revision":42,"change_kind":"members_changed","added_count":1,"removed_count":0,"recorded_at":"2026-08-01T04:00:00-04:00"},{"revision":43,"change_kind":"members_changed","added_count":0,"removed_count":1,"recorded_at":"2026-08-01T05:15:00-04:00"}],"has_more":false}}
```

## Add group members

`POST /api/2025-01/customer-groups/{id}/members`

Adds customers from the token's store. `added` is the number newly added; `already_members` lists ids already in the group and `not_found` lists ids that are not customers of this store, so one bad id does not fail the batch. The code is CUSTOMER_GROUP_MEMBERS_ADDED_PARTIAL, with the three counts in the message, when any id is in `not_found`; otherwise it is CUSTOMER_GROUP_MEMBERS_ADDED, and the message says how many were already in the group. Duplicate ids in the request count once.

Scope: `write_customers`

```curl
curl -X POST 'https://api-store.tringify.com/api/2025-01/customer-groups/8eb31980-7f67-453f-bf13-873b62a47b68/members' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "customer_ids": [
    "f37a970d-5f56-4ca8-9d4d-4ea10190f8a5"
  ]
}'
```

Response:

```json
{"success":true,"data":{"added":2,"already_members":[],"not_found":["0b6a2f8e-3c1d-4e5f-9a7b-8c9d0e1f2a3b"]},"code":"CUSTOMER_GROUP_MEMBERS_ADDED_PARTIAL","message":"Members added: 2, already in the group: 0, not found: 1."}
```

## Remove group members

`POST /api/2025-01/customer-groups/{id}/members/remove`

Removes the listed customers from the group. `removed` is the number of memberships removed and `not_members` lists ids that were not in the group. The code is always CUSTOMER_GROUP_MEMBERS_REMOVED; ids that were not members are left as they were, and the message says how many. Duplicate ids in the request count once.

Scope: `write_customers`

```curl
curl -X POST 'https://api-store.tringify.com/api/2025-01/customer-groups/8eb31980-7f67-453f-bf13-873b62a47b68/members/remove' \
  -H "Authorization: Bearer YOUR_STORE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "customer_ids": [
    "f37a970d-5f56-4ca8-9d4d-4ea10190f8a5"
  ]
}'
```

Response:

```json
{"success":true,"data":{"removed":2,"not_members":[]},"code":"CUSTOMER_GROUP_MEMBERS_REMOVED","message":"2 members removed."}
```

## Fields

| Field | Type | Create | Update | Required | Translatable |
| --- | --- | --- | --- | --- | --- |
| `name` | text | Yes | Yes | create | No |
| `slug` | slug | Yes | Yes | - | No |
| `description` | textarea | Yes | Yes | - | No |
| `type` | select | Yes | Yes | - | No |
| `match_type` | select | Yes | Yes | - | No |
| `member_count` | integer | No | No | - | No |
| `last_evaluated_at` | datetime | No | No | - | No |
| `created_at` | datetime | No | No | - | No |
| `updated_at` | datetime | No | No | - | No |

## Webhook events

Subscribe to these events to keep your integration in sync with customer groups. Each event shows the required Store API scope and store permission, the available payload fields, and an example payload. Subscription setup is validated against those permissions; delivery is always restricted to the subscription's store.

## Customer group created

Event: `customer_groups/create` · App scope: `read_customers` · Staff permission: `customers:write`

Fired when a customer group is created.

```json
{
  "group": {
    "created_at": "2026-06-09T12:00:00-04:00",
    "description": "Customers with lifetime spend over $500.",
    "id": "5d2e8b1a-6c3f-4e2a-9b1d-2f8c7a4e6b10",
    "match_type": "all",
    "member_count": 128,
    "name": "VIP customers",
    "rules": [
      {
        "field": "lifetime_spend",
        "op": "gte",
        "value": "500"
      },
      {
        "field": "tags",
        "op": "includes",
        "value_id": "6c1f3b52-8e0d-4a57-9b1e-2f4d7a9c0e18"
      }
    ],
    "slug": "vip-customers",
    "type": "automatic",
    "updated_at": "2026-06-09T12:00:00-04:00"
  }
}
```

## Customer group updated

Event: `customer_groups/update` · App scope: `read_customers` · Staff permission: `customers:write`

Fired when a customer group's definition changes, including when deleting a customer tag removes one of its rules. Customers joining or leaving the group send no per-customer events; connect the group to a webhook endpoint to receive its membership.

```json
{
  "changed_fields": [
    "name",
    "rules"
  ],
  "current": {
    "created_at": "2026-06-09T12:00:00-04:00",
    "description": "Customers with lifetime spend over $500.",
    "id": "5d2e8b1a-6c3f-4e2a-9b1d-2f8c7a4e6b10",
    "match_type": "all",
    "member_count": 128,
    "name": "VIP customers",
    "rules": [
      {
        "field": "lifetime_spend",
        "op": "gte",
        "value": "500"
      },
      {
        "field": "tags",
        "op": "includes",
        "value_id": "6c1f3b52-8e0d-4a57-9b1e-2f4d7a9c0e18"
      }
    ],
    "slug": "vip-customers",
    "type": "automatic",
    "updated_at": "2026-06-09T12:00:00-04:00"
  },
  "previous": {
    "created_at": "2026-06-09T12:00:00-04:00",
    "description": "Customers with lifetime spend over $500.",
    "id": "5d2e8b1a-6c3f-4e2a-9b1d-2f8c7a4e6b10",
    "match_type": "all",
    "member_count": 128,
    "name": "VIP customers",
    "rules": [
      {
        "field": "lifetime_spend",
        "op": "gte",
        "value": "250"
      },
      {
        "field": "tags",
        "op": "includes",
        "value_id": "6c1f3b52-8e0d-4a57-9b1e-2f4d7a9c0e18"
      }
    ],
    "slug": "vip-customers",
    "type": "automatic",
    "updated_at": "2026-06-09T12:00:00-04:00"
  }
}
```

## Customer group deleted

Event: `customer_groups/delete` · App scope: `read_customers` · Staff permission: `customers:write`

Fired when a customer group is deleted.

```json
{
  "group": {
    "created_at": "2026-06-09T12:00:00-04:00",
    "description": "Customers with lifetime spend over $500.",
    "id": "5d2e8b1a-6c3f-4e2a-9b1d-2f8c7a4e6b10",
    "match_type": "all",
    "member_count": 128,
    "name": "VIP customers",
    "rules": [
      {
        "field": "lifetime_spend",
        "op": "gte",
        "value": "500"
      },
      {
        "field": "tags",
        "op": "includes",
        "value_id": "6c1f3b52-8e0d-4a57-9b1e-2f4d7a9c0e18"
      }
    ],
    "slug": "vip-customers",
    "type": "automatic",
    "updated_at": "2026-06-09T12:00:00-04:00"
  }
}
```

