> ## Documentation Index
> Fetch the complete documentation index at: https://plain-docs-orca-916-agent-docs-restructure.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Customer groups

> Segment customers into named groups you define, separate from companies and tenants.

Customer groups can be used to group and segment your customers. For example you could organize your customers by their tier "Free", "Growth", "Enterprise" or make use of groups to keep track of customers trialing beta features.

<Snippet file="graphql/sdk-note.mdx" />

Customers can belong to one or many groups. You can filter customer threads by group, so you can focus on a subset of them.

You can add customers to groups through the API, or in the Plain app.

This guide assumes you've already created some customer groups in **Settings** → **Customer Groups**.

## Add a customer to groups

A customer can be added to a customer group using the `addCustomerToCustomerGroup` mutation.

When to call this API depends on what your customer groups represent. If you group customers by pricing tier, call it every time their tier changes.

This operation requires the following permissions:

* `customer:create`
* `customer:edit`

<Snippet file="graphql/add-customer-to-group.mdx" />

If you prefer you can also use the customer group id instead of the key. You can do this like so:

<Snippet file="graphql/add-customer-to-group-by-group-id.mdx" />

## Remove a customer from groups

A customer can be removed from a customer group by using the `removeCustomerFromGroup` mutation.

<Snippet file="graphql/remove-customer-from-groups.mdx" />

If you prefer you can also use the customer group id instead of the key. You can do this like so:

<Snippet file="graphql/remove-customer-from-groups-by-group-id.mdx" />
