# CustomerGroup

CustomerGroup

## List customer groups

> List customer groups

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerGroup","description":"CustomerGroup"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"CustomerGroupListResponse":{"description":"Example response","content":{"application/json":{"schema":{"type":"object","required":["items","paging"],"properties":{"items":{"type":"array","items":{"$ref":"#/components/schemas/CustomerGroupResponseSchema"}},"paging":{"$ref":"#/components/schemas/Paging"}}}}}}},"schemas":{"CustomerGroupResponseSchema":{"title":"CustomerGroupResponseSchema","allOf":[{"type":"object","required":["customerGroupUid","name"],"properties":{"customerGroupUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"}}},{"$ref":"#/components/schemas/CreatedModifiedSchema"}]},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"CreatedModifiedSchema":{"title":"CreatedModifiedSchema","type":"object","required":["createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"},"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"}},"parameters":{"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"}}},"paths":{"/tenants/{tenantUid}/customer-groups":{"get":{"summary":"List customer groups","tags":["CustomerGroup"],"responses":{"200":{"$ref":"#/components/responses/CustomerGroupListResponse"}},"operationId":"get-customer-groups","description":"List customer groups","parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}]}}}}
```

## Create customer group

> Create customer group\
> \
> Required permissions: CUSTOMER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerGroup","description":"CustomerGroup"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"CustomerGroupResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroupResponseSchema"}}}}},"schemas":{"CustomerGroupResponseSchema":{"title":"CustomerGroupResponseSchema","allOf":[{"type":"object","required":["customerGroupUid","name"],"properties":{"customerGroupUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"}}},{"$ref":"#/components/schemas/CreatedModifiedSchema"}]},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"CreatedModifiedSchema":{"title":"CreatedModifiedSchema","type":"object","required":["createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"}},"requestBodies":{"CustomerGroupCreateRequest":{"content":{"application/json":{"schema":{"type":"object","required":["name"],"properties":{"name":{"type":"string"},"customerGroupUid":{"$ref":"#/components/schemas/OptionalUID"}}}}}}}},"paths":{"/tenants/{tenantUid}/customer-groups":{"post":{"summary":"Create customer group","tags":["CustomerGroup"],"responses":{"201":{"$ref":"#/components/responses/CustomerGroupResponse"}},"operationId":"post-customer-groups","description":"Create customer group\n\nRequired permissions: CUSTOMER","requestBody":{"$ref":"#/components/requestBodies/CustomerGroupCreateRequest"}}}}}
```

## Get customer group

> Get customer group for UID.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerGroup","description":"CustomerGroup"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"CustomerGroupResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroupResponseSchema"}}}}},"schemas":{"CustomerGroupResponseSchema":{"title":"CustomerGroupResponseSchema","allOf":[{"type":"object","required":["customerGroupUid","name"],"properties":{"customerGroupUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"}}},{"$ref":"#/components/schemas/CreatedModifiedSchema"}]},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"CreatedModifiedSchema":{"title":"CreatedModifiedSchema","type":"object","required":["createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}}}},"paths":{"/tenants/{tenantUid}/customer-groups/{customerGroupUid}":{"get":{"summary":"Get customer group","tags":["CustomerGroup"],"responses":{"200":{"$ref":"#/components/responses/CustomerGroupResponse"}},"operationId":"get-customer-groups-by-uid","description":"Get customer group for UID."}}}}
```

## Update customer group

> Update customer group\
> \
> Required permissions: CUSTOMER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerGroup","description":"CustomerGroup"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"CustomerGroupResponse":{"description":"Example response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerGroupResponseSchema"}}}}},"schemas":{"CustomerGroupResponseSchema":{"title":"CustomerGroupResponseSchema","allOf":[{"type":"object","required":["customerGroupUid","name"],"properties":{"customerGroupUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"}}},{"$ref":"#/components/schemas/CreatedModifiedSchema"}]},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"CreatedModifiedSchema":{"title":"CreatedModifiedSchema","type":"object","required":["createdBy","createdAt","lastModifiedBy","lastModifiedAt"],"properties":{"createdBy":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedBy":{"type":"string"},"lastModifiedAt":{"type":"string","format":"date-time"}}}},"requestBodies":{"CustomerGroupUpdateRequest":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"}}}}}}}},"paths":{"/tenants/{tenantUid}/customer-groups/{customerGroupUid}":{"put":{"summary":"Update customer group","tags":["CustomerGroup"],"responses":{"200":{"$ref":"#/components/responses/CustomerGroupResponse"}},"operationId":"put-customer-groups","description":"Update customer group\n\nRequired permissions: CUSTOMER","requestBody":{"$ref":"#/components/requestBodies/CustomerGroupUpdateRequest"}}}}}
```

## Delete customer group

> Delete customer group\
> \
> Required permissions: CUSTOMER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerGroup","description":"CustomerGroup"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}}},"paths":{"/tenants/{tenantUid}/customer-groups/{customerGroupUid}":{"delete":{"summary":"Delete customer group","tags":["CustomerGroup"],"responses":{"204":{"description":"No Content"}},"operationId":"delete-customer-groups","description":"Delete customer group\n\nRequired permissions: CUSTOMER"}}}}
```

## Get customer group with customers

> Get customer group with list of customers.

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerGroup","description":"CustomerGroup"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"responses":{"CustomerListResponse":{"content":{"application/json":{"schema":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CustomerResponseSchema"},"type":"array"},"paging":{"$ref":"#/components/schemas/Paging"}},"required":["items","paging"],"type":"object"}}},"description":"CustomerListResponse"}},"schemas":{"CustomerResponseSchema":{"title":"CustomerResponseSchema","type":"object","description":"CustomerResponseSchema","required":["address","city","companyName","countryCode","createdAt","customerUid","customerParentUid","customerType","email","externalId","firstname","lastModifiedAt","lastname","mobile","postalCode","pricelistUid","vatNumber","origin","addresses","contacts","extensions","consents","loyaltyId","displayName","credit","paymentTerms","internalNote","accountManager","ehf","customerGroupUids","defaultStore","relevance"],"properties":{"address":{"type":"string"},"city":{"type":"string"},"companyName":{"type":"string"},"countryCode":{"description":"ISO 3166-1: 2 characters representation of country","type":"string"},"createdAt":{"format":"date-time","type":"string"},"customerUid":{"$ref":"#/components/schemas/UID"},"customerParentUid":{"description":"References another customer, establishing it as a department under the main customer. Only applicable when customerType is COMPANY.","$ref":"#/components/schemas/OptionalUID"},"customerType":{"$ref":"#/components/schemas/CustomerTypeENUM"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"externalId":{"type":"string"},"firstname":{"type":"string"},"lastModifiedAt":{"format":"date-time","type":"string"},"lastname":{"type":"string"},"ledgerNumber":{"type":"string","deprecated":true,"description":"Deprecated. Use ledgerNumber in accountingConfigs instead"},"mobile":{"type":"string"},"postalCode":{"type":"string"},"pricelistUid":{"$ref":"#/components/schemas/OptionalUID"},"vatNumber":{"$ref":"#/components/schemas/VatNumberTYPE"},"origin":{"type":"string"},"addresses":{"type":"array","items":{"$ref":"#/components/schemas/CustomerAddressResponseSchema"}},"contacts":{"type":"array","items":{"$ref":"#/components/schemas/CustomerContactResponseSchema"}},"extensions":{"type":"array","items":{"$ref":"#/components/schemas/CustomerExtensionResponseSchema"}},"consents":{"type":"array","items":{"$ref":"#/components/schemas/CustomerConsentStatusSchema"}},"loyaltyId":{"type":"string"},"displayName":{"type":"string"},"credit":{"$ref":"#/components/schemas/CustomerCreditResponseSchema"},"paymentTerms":{"type":"integer"},"internalNote":{"type":"string"},"accountManager":{"$ref":"#/components/schemas/AccountManagerResponseSchema"},"ehfEnabled":{"type":"boolean","description":"Deprecated: Use ehf -> enabled instead"},"ehf":{"$ref":"#/components/schemas/CustomerEhfResponseSchema"},"customerGroupUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"defaultStore":{"$ref":"#/components/schemas/CustomerStoreResponseSchema"},"relevance":{"type":"number"}}},"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"},"OptionalUID":{"title":"OptionalUID","type":"string","pattern":"^[A-Za-z0-9-_]*"},"CustomerTypeENUM":{"enum":["COMPANY","PERSON","B2B"],"title":"CustomerTypeENUM","type":"string"},"EmailTYPE":{"title":"Email","type":"string"},"VatNumberTYPE":{"description":"VAT identification number for value added tax reporting purposes.","title":"VatNumber","type":"string"},"CustomerAddressResponseSchema":{"title":"CustomerAddressResponseSchema","type":"object","required":["address","city","companyName","firstname","lastname","countryCode","email","phone","postalCode","type","customerAddressUid","displayName"],"properties":{"address":{"type":"string"},"city":{"type":"string"},"companyName":{"type":"string"},"firstname":{"type":"string"},"lastname":{"type":"string"},"countryCode":{"type":"string"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"phone":{"type":"string"},"postalCode":{"type":"string"},"type":{"$ref":"#/components/schemas/CustomerAddressTypeENUM"},"customerAddressUid":{"type":"string"},"displayName":{"type":"string"}}},"CustomerAddressTypeENUM":{"enum":["DELIVERY_ADDRESS","INVOICE_ADDRESS"],"title":"CustomerAddressTypeENUM","type":"string"},"CustomerContactResponseSchema":{"title":"CustomerContactResponseSchema","type":"object","description":"CustomerContactResponseSchema","required":["firstname","lastname","email","mobile","createdAt","lastModifiedAt","customerContactUid","extensions","displayName","role"],"properties":{"firstname":{"type":"string"},"lastname":{"type":"string"},"email":{"$ref":"#/components/schemas/EmailTYPE"},"mobile":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"lastModifiedAt":{"type":"string","format":"date-time"},"customerContactUid":{"type":"string"},"extensions":{"type":"array","items":{"$ref":"#/components/schemas/CustomerContactExtensionResponseSchema"}},"displayName":{"type":"string"},"role":{"$ref":"#/components/schemas/CustomerContactRoleENUM"}}},"CustomerContactExtensionResponseSchema":{"description":"CustomerContactExtensionResponseSchema","title":"CustomerContactExtensionResponseSchema","type":"object","properties":{"extensionCode":{"$ref":"#/components/schemas/CustomerExtensionCodeENUM"},"organizationUid":{"$ref":"#/components/schemas/UID"}},"required":["extensionCode","organizationUid"]},"CustomerExtensionCodeENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| TWO_INVOICE | The Two Invoice extension.|","enum":["TWO_INVOICE"],"title":"CustomerExtensionCodeENUM","type":"string"},"CustomerContactRoleENUM":{"title":"CustomerContactRoleENUM","type":"string","enum":["ADMIN","PURCHASER","ACCOUNTING","NONE"]},"CustomerExtensionResponseSchema":{"title":"CustomerExtensionResponseSchema","description":"CustomerExtensionResponseSchema","type":"object","properties":{"extensionCode":{"$ref":"#/components/schemas/CustomerExtensionCodeENUM"},"organizationUid":{"$ref":"#/components/schemas/UID"}},"required":["extensionCode","organizationUid"]},"CustomerConsentStatusSchema":{"title":"CustomerConsentStatusSchema","type":"object","required":["consentUid","name","status","source","createdAt"],"properties":{"consentUid":{"$ref":"#/components/schemas/UID"},"name":{"type":"string"},"status":{"type":"boolean"},"source":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}},"CustomerCreditResponseSchema":{"title":"CustomerCreditResponseSchema","required":["limit","balance"],"properties":{"limit":{"type":"integer"},"balance":{"type":"integer"}},"type":"object"},"AccountManagerResponseSchema":{"title":"AccountManagerResponseSchema","type":"object","required":["tenantUserUid","displayName","userCode"],"properties":{"tenantUserUid":{"$ref":"#/components/schemas/OptionalUID"},"displayName":{"type":"string"},"userCode":{"type":"string"}}},"CustomerEhfResponseSchema":{"title":"CustomerEhfResponseSchema","type":"object","required":["enabled","address"],"properties":{"enabled":{"type":"boolean","description":"EHF is enabled for this customer"},"address":{"type":"string","description":"EHF address"}}},"CustomerStoreResponseSchema":{"title":"CustomerStoreResponseSchema","type":"object","nullable":true,"required":["name","storeUid"],"properties":{"name":{"type":"string"},"storeUid":{"$ref":"#/components/schemas/UID"}}},"Paging":{"description":"totalCount The total number of items in the result set.\n\npageSize The number of items per page.\n\npageNumber The current page in the result set.","properties":{"pageNumber":{"type":"integer"},"pageSize":{"type":"integer"},"totalCount":{"type":"integer"}},"required":["totalCount","pageSize","pageNumber"],"title":"Paging","type":"object"},"SortDirectionENUM":{"description":"|ENUM      | Description |\n| ---------------- | ------------ |\n| ASC | Sort in ascending order|\n| DESC | Sort in descending order|\n","enum":["ASC","DESC"],"title":"SortDirectionENUM","type":"string"}},"parameters":{"pageNumberQuery":{"description":"Reference to a specific page in a result set.","in":"query","name":"pageNumber","required":false,"schema":{"type":"integer"}},"pageSizeQuery":{"description":"The number of items per page in a result set.","in":"query","name":"pageSize","required":false,"schema":{"type":"integer"}},"sortByQuery":{"description":"Defines which field the resource list is sorted by.","in":"query","name":"sortBy","required":false,"schema":{"type":"string"}},"sortDirectionQuery":{"description":"Reference to a sort direction","explode":false,"in":"query","name":"sortDirection","schema":{"$ref":"#/components/schemas/SortDirectionENUM"},"style":"form"}}},"paths":{"/tenants/{tenantUid}/customer-groups/{customerGroupUid}/customers":{"get":{"summary":"Get customer group with customers","tags":["CustomerGroup"],"responses":{"200":{"$ref":"#/components/responses/CustomerListResponse"}},"operationId":"get-customer-groups-customers","description":"Get customer group with list of customers.","parameters":[{"$ref":"#/components/parameters/pageNumberQuery"},{"$ref":"#/components/parameters/pageSizeQuery"},{"$ref":"#/components/parameters/sortByQuery"},{"$ref":"#/components/parameters/sortDirectionQuery"}]}}}}
```

## Add or remove customer group customers

> Add and/or remove customer group customers.\
> \
> Required permissions: CUSTOMER

```json
{"openapi":"3.0.2","info":{"title":"Flow Retail API version 2","version":"2.0.0"},"tags":[{"name":"CustomerGroup","description":"CustomerGroup"}],"servers":[{"description":"Flow Retail Production","url":"https://api.flowretail.com/v2"},{"description":"Flow Retail Stage","url":"https://api.stage.flowretail.com/v2"}],"security":[{"accessToken":[]},{"authToken":[]},{"integrationToken":[]}],"components":{"securitySchemes":{"accessToken":{"description":"Access token recevied after user login with a deviceToken","scheme":"bearer","type":"http"},"authToken":{"description":"Token received from the auth service","scheme":"bearer","type":"http"},"integrationToken":{"scheme":"bearer","type":"http"}},"requestBodies":{"CustomerGroupCustomersUpdateRequest":{"content":{"application/json":{"schema":{"type":"object","properties":{"addCustomerUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}},"removeCustomerUids":{"type":"array","items":{"$ref":"#/components/schemas/UID"}}}}}}}},"schemas":{"UID":{"title":"UID","type":"string","pattern":"^[A-Za-z0-9-_]+"}}},"paths":{"/tenants/{tenantUid}/customer-groups/{customerGroupUid}/customers":{"put":{"summary":"Add or remove customer group customers","tags":["CustomerGroup"],"responses":{"204":{"description":"No Content"}},"operationId":"put-customer-groups-customers","description":"Add and/or remove customer group customers.\n\nRequired permissions: CUSTOMER","requestBody":{"$ref":"#/components/requestBodies/CustomerGroupCustomersUpdateRequest"}}}}}
```
