---
displayed_sidebar: jsClientSidebar
slug: /references/js-client/AdminCustomerGroupsResource
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# AdminCustomerGroupsResource

This class is used to send requests to [Admin Customer Group API Routes](https://docs.medusajs.com/api/admin#customer-groups). All its method
are available in the JS Client under the `medusa.admin.customerGroups` property.

All methods in this class require [user authentication](js_client.AdminAuthResource.mdx#createsession).

Customer Groups can be used to organize customers that share similar data or attributes into dedicated groups.
This can be useful for different purposes such as setting a different price for a specific customer group.

Related Guide: [How to manage customer groups](https://docs.medusajs.com/modules/customers/admin/manage-customer-groups).

## Methods

### addCustomers

Add a list of customers to a customer group.

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The ID of the customer group.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "payload",
    "type": "[AdminPostCustomerGroupsGroupCustomersBatchReq](../../medusa/classes/medusa.AdminPostCustomerGroupsGroupCustomersBatchReq.mdx)",
    "description": "The customers to add to the customer group.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "customer_ids",
        "type": "[CustomerGroupsBatchCustomer](../../medusa/classes/medusa.CustomerGroupsBatchCustomer.mdx)[]",
        "description": "The ids of the customers to add",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "id",
            "type": "`string`",
            "description": "ID of the customer",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminCustomerGroupsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the customer group's details.",
    "expandable": false,
    "children": [
      {
        "name": "customer_group",
        "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)",
        "description": "Customer group details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "customers",
            "type": "[Customer](../../entities/classes/entities.Customer.mdx)[]",
            "description": "The details of the customers that belong to the customer group.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "billing_address",
                "type": "[Address](../../entities/classes/entities.Address.mdx)",
                "description": "The details of the billing address associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "billing_address_id",
                "type": "`null` \\| `string`",
                "description": "The customer's billing address ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "email",
                "type": "`string`",
                "description": "The customer's email",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "first_name",
                "type": "`string`",
                "description": "The customer's first name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "groups",
                "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
                "description": "The customer groups the customer belongs to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "has_account",
                "type": "`boolean`",
                "description": "Whether the customer has an account or not",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The customer's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "last_name",
                "type": "`string`",
                "description": "The customer's last name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "orders",
                "type": "[Order](../../entities/classes/entities.Order.mdx)[]",
                "description": "The details of the orders this customer placed.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "password_hash",
                "type": "`string`",
                "description": "",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "phone",
                "type": "`string`",
                "description": "The customer's phone number",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "shipping_addresses",
                "type": "[Address](../../entities/classes/entities.Address.mdx)[]",
                "description": "The details of the shipping addresses associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The customer group's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "name",
            "type": "`string`",
            "description": "The name of the customer group",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "price_lists",
            "type": "[PriceList](../../entities/classes/entities.PriceList.mdx)[]",
            "description": "The price lists that are associated with the customer group.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "customer_groups",
                "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
                "description": "The details of the customer groups that the Price List can apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "The price list's description",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone that the Price List stops being valid.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The price list's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the price list prices include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The price list's name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "prices",
                "type": "[MoneyAmount](../../entities/classes/entities.MoneyAmount.mdx)[]",
                "description": "The prices that belong to the price list, represented as a Money Amount.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone that the Price List starts being valid.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "status",
                "type": "[PriceListStatus](../../medusa/enums/medusa.PriceListStatus-1.mdx)",
                "description": "The status of the Price List",
                "optional": false,
                "defaultValue": "draft",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[PriceListType](../../medusa/enums/medusa.PriceListType-1.mdx)",
                "description": "The type of Price List. This can be one of either `sale` or `override`.",
                "optional": false,
                "defaultValue": "sale",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### create

Create a customer group.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.customerGroups.create({
  name: "VIP"
})
.then(({ customer_group }) => {
  console.log(customer_group.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "payload",
    "type": "[AdminPostCustomerGroupsReq](../../medusa/classes/medusa.AdminPostCustomerGroupsReq.mdx)",
    "description": "The data of the customer group to create.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "metadata",
        "type": "`Record<string, unknown>`",
        "description": "Metadata of the customer group.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "name",
        "type": "`string`",
        "description": "Name of the customer group",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminCustomerGroupsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the customer group's details.",
    "expandable": false,
    "children": [
      {
        "name": "customer_group",
        "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)",
        "description": "Customer group details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "customers",
            "type": "[Customer](../../entities/classes/entities.Customer.mdx)[]",
            "description": "The details of the customers that belong to the customer group.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "billing_address",
                "type": "[Address](../../entities/classes/entities.Address.mdx)",
                "description": "The details of the billing address associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "billing_address_id",
                "type": "`null` \\| `string`",
                "description": "The customer's billing address ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "email",
                "type": "`string`",
                "description": "The customer's email",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "first_name",
                "type": "`string`",
                "description": "The customer's first name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "groups",
                "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
                "description": "The customer groups the customer belongs to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "has_account",
                "type": "`boolean`",
                "description": "Whether the customer has an account or not",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The customer's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "last_name",
                "type": "`string`",
                "description": "The customer's last name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "orders",
                "type": "[Order](../../entities/classes/entities.Order.mdx)[]",
                "description": "The details of the orders this customer placed.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "password_hash",
                "type": "`string`",
                "description": "",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "phone",
                "type": "`string`",
                "description": "The customer's phone number",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "shipping_addresses",
                "type": "[Address](../../entities/classes/entities.Address.mdx)[]",
                "description": "The details of the shipping addresses associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The customer group's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "name",
            "type": "`string`",
            "description": "The name of the customer group",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "price_lists",
            "type": "[PriceList](../../entities/classes/entities.PriceList.mdx)[]",
            "description": "The price lists that are associated with the customer group.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "customer_groups",
                "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
                "description": "The details of the customer groups that the Price List can apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "The price list's description",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone that the Price List stops being valid.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The price list's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the price list prices include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The price list's name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "prices",
                "type": "[MoneyAmount](../../entities/classes/entities.MoneyAmount.mdx)[]",
                "description": "The prices that belong to the price list, represented as a Money Amount.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone that the Price List starts being valid.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "status",
                "type": "[PriceListStatus](../../medusa/enums/medusa.PriceListStatus-1.mdx)",
                "description": "The status of the Price List",
                "optional": false,
                "defaultValue": "draft",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[PriceListType](../../medusa/enums/medusa.PriceListType-1.mdx)",
                "description": "The type of Price List. This can be one of either `sale` or `override`.",
                "optional": false,
                "defaultValue": "sale",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### delete

Delete a customer group. This doesn't delete the customers associated with the customer group.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.customerGroups.delete(customerGroupId)
.then(({ id, object, deleted }) => {
  console.log(id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The ID of the customer group.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;DeleteResponse&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the deletion operation details.",
    "expandable": false,
    "children": [
      {
        "name": "deleted",
        "type": "`boolean`",
        "description": "Whether the item was deleted successfully.",
        "optional": false,
        "defaultValue": "true",
        "expandable": false,
        "children": []
      },
      {
        "name": "id",
        "type": "`string`",
        "description": "The ID of the deleted item.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "object",
        "type": "`string`",
        "description": "The type of the deleted item.",
        "optional": false,
        "defaultValue": "product-collection",
        "expandable": false,
        "children": []
      }
    ]
  }
]} />

___

### list

Retrieve a list of customer groups. The customer groups can be filtered by fields such as `name` or `id`. The customer groups can also be sorted or paginated.

#### Example

To list customer groups:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.customerGroups.list()
.then(({ customer_groups, limit, offset, count }) => {
  console.log(customer_groups.length);
})
```

To specify relations that should be retrieved within the customer groups:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.customerGroups.list({
  expand: "customers"
})
.then(({ customer_groups, limit, offset, count }) => {
  console.log(customer_groups.length);
})
```

By default, only the first `10` records are retrieved. You can control pagination by specifying the `limit` and `offset` properties:

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.customerGroups.list({
  "expand": "customers",
  limit,
  offset
})
.then(({ customer_groups, limit, offset, count }) => {
  console.log(customer_groups.length);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "query",
    "type": "[AdminGetCustomerGroupsParams](../../medusa/classes/medusa.AdminGetCustomerGroupsParams.mdx)",
    "description": "Filters and pagination configurations to apply on the retrieved customer groups.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "created_at",
        "type": "[DateComparisonOperator](../../medusa/classes/medusa.DateComparisonOperator.mdx)",
        "description": "Date filters to apply on the customer groups' `created_at` date.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "gt",
            "type": "`Date`",
            "description": "The filtered date must be greater than this value.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "gte",
            "type": "`Date`",
            "description": "The filtered date must be greater than or equal to this value.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "lt",
            "type": "`Date`",
            "description": "The filtered date must be less than this value.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "lte",
            "type": "`Date`",
            "description": "The filtered date must be less than or equal to this value.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      },
      {
        "name": "discount_condition_id",
        "type": "`string`",
        "description": "Filter customer groups by their associated discount condition's ID.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "expand",
        "type": "`string`",
        "description": "Comma-separated relations that should be expanded in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "id",
        "type": "`string` \\| `string`[] \\| [StringComparisonOperator](../../medusa/classes/medusa.StringComparisonOperator.mdx)",
        "description": "IDs to filter customer groups by.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "limit",
        "type": "`number`",
        "description": "Limit the number of items returned in the list.",
        "optional": true,
        "defaultValue": "10",
        "expandable": false,
        "children": []
      },
      {
        "name": "name",
        "type": "`string`[]",
        "description": "Names to filter customer groups by.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "offset",
        "type": "`number`",
        "description": "The number of items to skip when retrieving a list.",
        "optional": true,
        "defaultValue": "0",
        "expandable": false,
        "children": []
      },
      {
        "name": "order",
        "type": "`string`",
        "description": "The field to sort the data by. By default, the sort order is ascending. To change the order to descending, prefix the field name with `-`.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "q",
        "type": "`string`",
        "description": "Search term to search customer groups by their name.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "updated_at",
        "type": "[DateComparisonOperator](../../medusa/classes/medusa.DateComparisonOperator.mdx)",
        "description": "Date filters to apply on the customer groups' `update_at` date.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "gt",
            "type": "`Date`",
            "description": "The filtered date must be greater than this value.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "gte",
            "type": "`Date`",
            "description": "The filtered date must be greater than or equal to this value.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "lt",
            "type": "`Date`",
            "description": "The filtered date must be less than this value.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "lte",
            "type": "`Date`",
            "description": "The filtered date must be less than or equal to this value.",
            "optional": true,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminCustomerGroupsListRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the list of customer groups with pagination fields.",
    "expandable": false,
    "children": [
      {
        "name": "AdminCustomerGroupsListRes",
        "type": "[PaginatedResponse](../../medusa/interfaces/medusa.PaginatedResponse.mdx) & `object`",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "count",
            "type": "`number`",
            "description": "The total number of items available.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "limit",
            "type": "`number`",
            "description": "The maximum number of items that can be returned in the list.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "offset",
            "type": "`number`",
            "description": "The number of items skipped before the returned items in the list.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "customer_groups",
            "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
            "description": "An array of customer group details.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "customers",
                "type": "[Customer](../../entities/classes/entities.Customer.mdx)[]",
                "description": "The details of the customers that belong to the customer group.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The customer group's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The name of the customer group",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "price_lists",
                "type": "[PriceList](../../entities/classes/entities.PriceList.mdx)[]",
                "description": "The price lists that are associated with the customer group.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          }
        ]
      }
    ]
  }
]} />

___

### listCustomers

Retrieve a list of customers in a customer group. The customers can be filtered by the `q` field. The customers can also be paginated.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.customerGroups.listCustomers(customerGroupId)
.then(({ customers }) => {
  console.log(customers.length);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The ID of the customer group.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "query",
    "type": "[AdminGetCustomersParams](../../medusa/classes/medusa.AdminGetCustomersParams.mdx)",
    "description": "Filters and pagination configurations to apply on the retrieved customers.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "expand",
        "type": "`string`",
        "description": "Comma-separated relations that should be expanded in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "groups",
        "type": "`string`[]",
        "description": "Filter customers by the customer's customer groups.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "has_account",
        "type": "`boolean`",
        "description": "Filter customers by whether they have an account.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "limit",
        "type": "`number`",
        "description": "Limit the number of items returned in the list.",
        "optional": false,
        "defaultValue": "50",
        "expandable": false,
        "children": []
      },
      {
        "name": "offset",
        "type": "`number`",
        "description": "The number of items to skip when retrieving a list.",
        "optional": false,
        "defaultValue": "0",
        "expandable": false,
        "children": []
      },
      {
        "name": "q",
        "type": "`string`",
        "description": "Search term used to search customers' email, first name, last name.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminCustomersListRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the list of customers with pagination fields.",
    "expandable": false,
    "children": [
      {
        "name": "AdminCustomersListRes",
        "type": "[PaginatedResponse](../../medusa/interfaces/medusa.PaginatedResponse.mdx) & `object`",
        "description": "The list of customers with pagination fields.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "count",
            "type": "`number`",
            "description": "The total number of items available.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "limit",
            "type": "`number`",
            "description": "The maximum number of items that can be returned in the list.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "offset",
            "type": "`number`",
            "description": "The number of items skipped before the returned items in the list.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "customers",
            "type": "[Customer](../../entities/classes/entities.Customer.mdx)[]",
            "description": "An array of customer details.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": [
              {
                "name": "billing_address",
                "type": "[Address](../../entities/classes/entities.Address.mdx)",
                "description": "The details of the billing address associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "billing_address_id",
                "type": "`null` \\| `string`",
                "description": "The customer's billing address ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "email",
                "type": "`string`",
                "description": "The customer's email",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "first_name",
                "type": "`string`",
                "description": "The customer's first name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "groups",
                "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
                "description": "The customer groups the customer belongs to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "has_account",
                "type": "`boolean`",
                "description": "Whether the customer has an account or not",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The customer's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "last_name",
                "type": "`string`",
                "description": "The customer's last name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "orders",
                "type": "[Order](../../entities/classes/entities.Order.mdx)[]",
                "description": "The details of the orders this customer placed.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "password_hash",
                "type": "`string`",
                "description": "",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "phone",
                "type": "`string`",
                "description": "The customer's phone number",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "shipping_addresses",
                "type": "[Address](../../entities/classes/entities.Address.mdx)[]",
                "description": "The details of the shipping addresses associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          }
        ]
      }
    ]
  }
]} />

___

### removeCustomers

Remove a list of customers from a customer group. This doesn't delete the customer, only the association between the customer and the customer group.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.customerGroups.removeCustomers(customerGroupId, {
  customer_ids: [
    {
      id: customerId
    }
  ]
})
.then(({ customer_group }) => {
  console.log(customer_group.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The ID of the customer group.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "payload",
    "type": "[AdminDeleteCustomerGroupsGroupCustomerBatchReq](../../medusa/classes/medusa.AdminDeleteCustomerGroupsGroupCustomerBatchReq.mdx)",
    "description": "The customers to remove from the customer group.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "customer_ids",
        "type": "[CustomerGroupsBatchCustomer](../../medusa/classes/medusa.CustomerGroupsBatchCustomer.mdx)[]",
        "description": "The ids of the customers to remove",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "id",
            "type": "`string`",
            "description": "ID of the customer",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminCustomerGroupsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the customer group's details.",
    "expandable": false,
    "children": [
      {
        "name": "customer_group",
        "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)",
        "description": "Customer group details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "customers",
            "type": "[Customer](../../entities/classes/entities.Customer.mdx)[]",
            "description": "The details of the customers that belong to the customer group.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "billing_address",
                "type": "[Address](../../entities/classes/entities.Address.mdx)",
                "description": "The details of the billing address associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "billing_address_id",
                "type": "`null` \\| `string`",
                "description": "The customer's billing address ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "email",
                "type": "`string`",
                "description": "The customer's email",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "first_name",
                "type": "`string`",
                "description": "The customer's first name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "groups",
                "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
                "description": "The customer groups the customer belongs to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "has_account",
                "type": "`boolean`",
                "description": "Whether the customer has an account or not",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The customer's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "last_name",
                "type": "`string`",
                "description": "The customer's last name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "orders",
                "type": "[Order](../../entities/classes/entities.Order.mdx)[]",
                "description": "The details of the orders this customer placed.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "password_hash",
                "type": "`string`",
                "description": "",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "phone",
                "type": "`string`",
                "description": "The customer's phone number",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "shipping_addresses",
                "type": "[Address](../../entities/classes/entities.Address.mdx)[]",
                "description": "The details of the shipping addresses associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The customer group's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "name",
            "type": "`string`",
            "description": "The name of the customer group",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "price_lists",
            "type": "[PriceList](../../entities/classes/entities.PriceList.mdx)[]",
            "description": "The price lists that are associated with the customer group.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "customer_groups",
                "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
                "description": "The details of the customer groups that the Price List can apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "The price list's description",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone that the Price List stops being valid.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The price list's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the price list prices include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The price list's name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "prices",
                "type": "[MoneyAmount](../../entities/classes/entities.MoneyAmount.mdx)[]",
                "description": "The prices that belong to the price list, represented as a Money Amount.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone that the Price List starts being valid.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "status",
                "type": "[PriceListStatus](../../medusa/enums/medusa.PriceListStatus-1.mdx)",
                "description": "The status of the Price List",
                "optional": false,
                "defaultValue": "draft",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[PriceListType](../../medusa/enums/medusa.PriceListType-1.mdx)",
                "description": "The type of Price List. This can be one of either `sale` or `override`.",
                "optional": false,
                "defaultValue": "sale",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### retrieve

Retrieve a customer group by its ID. You can expand the customer group's relations or select the fields that should be returned.

#### Example

```ts
import Medusa from "@medusajs/medusa-js"
const medusa = new Medusa({ baseUrl: MEDUSA_BACKEND_URL, maxRetries: 3 })
// must be previously logged in or use api token
medusa.admin.customerGroups.retrieve(customerGroupId)
.then(({ customer_group }) => {
  console.log(customer_group.id);
})
```

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The ID of the customer group.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "query",
    "type": "[AdminGetCustomerGroupsGroupParams](../../medusa/classes/medusa.AdminGetCustomerGroupsGroupParams.mdx)",
    "description": "Configurations to apply on the retrieved customer group.",
    "optional": true,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "expand",
        "type": "`string`",
        "description": "Comma-separated relations that should be expanded in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "fields",
        "type": "`string`",
        "description": "Comma-separated fields that should be included in the returned data.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminCustomerGroupsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the customer group's details.",
    "expandable": false,
    "children": [
      {
        "name": "customer_group",
        "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)",
        "description": "Customer group details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "customers",
            "type": "[Customer](../../entities/classes/entities.Customer.mdx)[]",
            "description": "The details of the customers that belong to the customer group.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "billing_address",
                "type": "[Address](../../entities/classes/entities.Address.mdx)",
                "description": "The details of the billing address associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "billing_address_id",
                "type": "`null` \\| `string`",
                "description": "The customer's billing address ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "email",
                "type": "`string`",
                "description": "The customer's email",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "first_name",
                "type": "`string`",
                "description": "The customer's first name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "groups",
                "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
                "description": "The customer groups the customer belongs to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "has_account",
                "type": "`boolean`",
                "description": "Whether the customer has an account or not",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The customer's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "last_name",
                "type": "`string`",
                "description": "The customer's last name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "orders",
                "type": "[Order](../../entities/classes/entities.Order.mdx)[]",
                "description": "The details of the orders this customer placed.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "password_hash",
                "type": "`string`",
                "description": "",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "phone",
                "type": "`string`",
                "description": "The customer's phone number",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "shipping_addresses",
                "type": "[Address](../../entities/classes/entities.Address.mdx)[]",
                "description": "The details of the shipping addresses associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The customer group's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "name",
            "type": "`string`",
            "description": "The name of the customer group",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "price_lists",
            "type": "[PriceList](../../entities/classes/entities.PriceList.mdx)[]",
            "description": "The price lists that are associated with the customer group.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "customer_groups",
                "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
                "description": "The details of the customer groups that the Price List can apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "The price list's description",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone that the Price List stops being valid.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The price list's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the price list prices include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The price list's name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "prices",
                "type": "[MoneyAmount](../../entities/classes/entities.MoneyAmount.mdx)[]",
                "description": "The prices that belong to the price list, represented as a Money Amount.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone that the Price List starts being valid.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "status",
                "type": "[PriceListStatus](../../medusa/enums/medusa.PriceListStatus-1.mdx)",
                "description": "The status of the Price List",
                "optional": false,
                "defaultValue": "draft",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[PriceListType](../../medusa/enums/medusa.PriceListType-1.mdx)",
                "description": "The type of Price List. This can be one of either `sale` or `override`.",
                "optional": false,
                "defaultValue": "sale",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />

___

### update

Update a customer group's details.

#### Parameters

<ParameterTypes parameters={[
  {
    "name": "id",
    "type": "`string`",
    "description": "The ID of the customer group.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "payload",
    "type": "[AdminPostCustomerGroupsGroupReq](../../medusa/classes/medusa.AdminPostCustomerGroupsGroupReq.mdx)",
    "description": "The attributes to update in the customer group.",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "metadata",
        "type": "`Record<string, unknown>`",
        "description": "Metadata of the customer group.",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "name",
        "type": "`string`",
        "description": "Name of the customer group",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "customHeaders",
    "type": "`Record<string, any>`",
    "description": "Custom headers to attach to the request.",
    "optional": false,
    "defaultValue": "{}",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/js-client/overview#expanding-fields"/>

#### Returns

<ParameterTypes parameters={[
  {
    "name": "ResponsePromise",
    "type": "ResponsePromise&#60;AdminCustomerGroupsRes&#62;",
    "optional": false,
    "defaultValue": "",
    "description": "Resolves to the customer group's details.",
    "expandable": false,
    "children": [
      {
        "name": "customer_group",
        "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)",
        "description": "Customer group details.",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": [
          {
            "name": "created_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was created.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "customers",
            "type": "[Customer](../../entities/classes/entities.Customer.mdx)[]",
            "description": "The details of the customers that belong to the customer group.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "billing_address",
                "type": "[Address](../../entities/classes/entities.Address.mdx)",
                "description": "The details of the billing address associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "billing_address_id",
                "type": "`null` \\| `string`",
                "description": "The customer's billing address ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "email",
                "type": "`string`",
                "description": "The customer's email",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "first_name",
                "type": "`string`",
                "description": "The customer's first name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "groups",
                "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
                "description": "The customer groups the customer belongs to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "has_account",
                "type": "`boolean`",
                "description": "Whether the customer has an account or not",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The customer's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "last_name",
                "type": "`string`",
                "description": "The customer's last name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "metadata",
                "type": "`Record<string, unknown>`",
                "description": "An optional key-value map with additional details",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "orders",
                "type": "[Order](../../entities/classes/entities.Order.mdx)[]",
                "description": "The details of the orders this customer placed.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "password_hash",
                "type": "`string`",
                "description": "",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "phone",
                "type": "`string`",
                "description": "The customer's phone number",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "shipping_addresses",
                "type": "[Address](../../entities/classes/entities.Address.mdx)[]",
                "description": "The details of the shipping addresses associated with the customer.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "deleted_at",
            "type": "`null` \\| `Date`",
            "description": "The date with timezone at which the resource was deleted.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "id",
            "type": "`string`",
            "description": "The customer group's ID",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "metadata",
            "type": "`Record<string, unknown>`",
            "description": "An optional key-value map with additional details",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "name",
            "type": "`string`",
            "description": "The name of the customer group",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          },
          {
            "name": "price_lists",
            "type": "[PriceList](../../entities/classes/entities.PriceList.mdx)[]",
            "description": "The price lists that are associated with the customer group.",
            "optional": false,
            "defaultValue": "",
            "expandable": true,
            "children": [
              {
                "name": "created_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was created.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "customer_groups",
                "type": "[CustomerGroup](../../entities/classes/entities.CustomerGroup.mdx)[]",
                "description": "The details of the customer groups that the Price List can apply to.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "deleted_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone at which the resource was deleted.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "description",
                "type": "`string`",
                "description": "The price list's description",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "ends_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone that the Price List stops being valid.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "id",
                "type": "`string`",
                "description": "The price list's ID",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "includes_tax",
                "type": "`boolean`",
                "description": "Whether the price list prices include tax",
                "optional": false,
                "defaultValue": "false",
                "expandable": false,
                "featureFlag": "tax_inclusive_pricing",
                "children": []
              },
              {
                "name": "name",
                "type": "`string`",
                "description": "The price list's name",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "prices",
                "type": "[MoneyAmount](../../entities/classes/entities.MoneyAmount.mdx)[]",
                "description": "The prices that belong to the price list, represented as a Money Amount.",
                "optional": false,
                "defaultValue": "",
                "expandable": true,
                "children": []
              },
              {
                "name": "starts_at",
                "type": "`null` \\| `Date`",
                "description": "The date with timezone that the Price List starts being valid.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              },
              {
                "name": "status",
                "type": "[PriceListStatus](../../medusa/enums/medusa.PriceListStatus-1.mdx)",
                "description": "The status of the Price List",
                "optional": false,
                "defaultValue": "draft",
                "expandable": false,
                "children": []
              },
              {
                "name": "type",
                "type": "[PriceListType](../../medusa/enums/medusa.PriceListType-1.mdx)",
                "description": "The type of Price List. This can be one of either `sale` or `override`.",
                "optional": false,
                "defaultValue": "sale",
                "expandable": false,
                "children": []
              },
              {
                "name": "updated_at",
                "type": "`Date`",
                "description": "The date with timezone at which the resource was updated.",
                "optional": false,
                "defaultValue": "",
                "expandable": false,
                "children": []
              }
            ]
          },
          {
            "name": "updated_at",
            "type": "`Date`",
            "description": "The date with timezone at which the resource was updated.",
            "optional": false,
            "defaultValue": "",
            "expandable": false,
            "children": []
          }
        ]
      }
    ]
  }
]} />
