# Customer Group Relations

Manage shipping customer groups

## Retrieving customer-group relations

> Retrieves a list of customer-group relations for the specified site.

```json
{"openapi":"3.0.0","info":{"title":"Shipping Service","version":"0.0.1"},"tags":[{"name":"Customer Group Relations","description":"Manage shipping customer groups"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"oAuth2":[]}],"components":{"securitySchemes":{"oAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"shipping.shipping_manage":"Needed to manage shipping settings.","shipping.shipping_read":"Needed to read shipping settings."}}}}},"parameters":{"tenant":{"name":"tenant","in":"path","required":true,"description":"Your Emporix tenant name.\n\n**Note**: The tenant should always be written in lowercase.\n","schema":{"pattern":"^[a-z][a-z0-9]+$","minLength":3,"maxLength":16,"type":"string"}},"site":{"description":"Site unique identifier. A site is a specific shop.\n\nIf the tenant owns only one shop, the value should be set to `main`.\n","name":"site","in":"path","required":true,"schema":{"type":"string"}}},"schemas":{"CGRelationList":{"title":"Collection of customer-group relation","type":"array","items":{"$ref":"#/components/schemas/CGRelation"}},"CGRelation":{"title":"Customer-group relation","description":"Customer-group relation allows to assign user for specific group.","type":"object","properties":{"customerId":{"description":"Customer unique identifier.","type":"string"},"groupId":{"description":"Group's unique identifier.","type":"string"}}},"errorMessage":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"status":{"minimum":100,"maximum":599,"description":"original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"type":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error type, lower case with underscore eg validation_failure","type":"string"},"message":{"description":"descriptive error message for debugging","type":"string"},"moreInfo":{"type":"string","description":"link to documentation to investigate further and finding support"},"errorCode":{"type":"string","description":"The error code which specify the problem"},"details":{"description":"list of problems causing this error","type":"array","items":{"title":"errorDetail","description":"schema for specific error cause","anyOf":[{"type":"string"},{"type":"object","properties":{"field":{"description":"a bean notation expression specifying the element in request data causing the error, eg shipTo[0].country, this can be empty if violation was not field specific","type":"string"},"type":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error detail type, lower case with underscore eg missing_value, this value must be always interpreted in context of the general error type.","type":"string"},"message":{"description":"descriptive error detail message for debugging","type":"string"},"moreInfo":{"type":"string","description":"link to documentation to investigate further and finding support for error detail"}}}]}}},"required":["status","type"]}},"responses":{"unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"internalError_500":{"description":"Some server side error occurred.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}}},"paths":{"/shipping/{tenant}/{site}/cgrelations":{"get":{"tags":["Customer Group Relations"],"summary":"Retrieving customer-group relations","operationId":"GET-shipping-list-customer-group-relations","description":"Retrieves a list of customer-group relations for the specified site.","parameters":[{"$ref":"#/components/parameters/tenant"},{"$ref":"#/components/parameters/site"}],"responses":{"200":{"description":"Resource successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CGRelationList"}}}},"401":{"$ref":"#/components/responses/unauthorized_401"},"500":{"$ref":"#/components/responses/internalError_500"}}}}}}
```

## Creating a customer-group relation

> Creates a new customer-group relation for the specified site.

```json
{"openapi":"3.0.0","info":{"title":"Shipping Service","version":"0.0.1"},"tags":[{"name":"Customer Group Relations","description":"Manage shipping customer groups"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"oAuth2":["shipping.shipping_manage"]}],"components":{"securitySchemes":{"oAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"shipping.shipping_manage":"Needed to manage shipping settings.","shipping.shipping_read":"Needed to read shipping settings."}}}}},"parameters":{"tenant":{"name":"tenant","in":"path","required":true,"description":"Your Emporix tenant name.\n\n**Note**: The tenant should always be written in lowercase.\n","schema":{"pattern":"^[a-z][a-z0-9]+$","minLength":3,"maxLength":16,"type":"string"}},"site":{"description":"Site unique identifier. A site is a specific shop.\n\nIf the tenant owns only one shop, the value should be set to `main`.\n","name":"site","in":"path","required":true,"schema":{"type":"string"}}},"schemas":{"CGRelation":{"title":"Customer-group relation","description":"Customer-group relation allows to assign user for specific group.","type":"object","properties":{"customerId":{"description":"Customer unique identifier.","type":"string"},"groupId":{"description":"Group's unique identifier.","type":"string"}}},"ResourceCreatedResponse":{"title":"Resource created","description":"Link to created resource with unique resource identifier.","type":"object","properties":{"id":{"type":"string","description":"Created resource’s unique identifier."}}},"errorMessage":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"status":{"minimum":100,"maximum":599,"description":"original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"type":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error type, lower case with underscore eg validation_failure","type":"string"},"message":{"description":"descriptive error message for debugging","type":"string"},"moreInfo":{"type":"string","description":"link to documentation to investigate further and finding support"},"errorCode":{"type":"string","description":"The error code which specify the problem"},"details":{"description":"list of problems causing this error","type":"array","items":{"title":"errorDetail","description":"schema for specific error cause","anyOf":[{"type":"string"},{"type":"object","properties":{"field":{"description":"a bean notation expression specifying the element in request data causing the error, eg shipTo[0].country, this can be empty if violation was not field specific","type":"string"},"type":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error detail type, lower case with underscore eg missing_value, this value must be always interpreted in context of the general error type.","type":"string"},"message":{"description":"descriptive error detail message for debugging","type":"string"},"moreInfo":{"type":"string","description":"link to documentation to investigate further and finding support for error detail"}}}]}}},"required":["status","type"]}},"responses":{"yaasAware_400":{"description":"Request syntactically incorrect. Details of the error are included in the response payload.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"yaasAware_403":{"description":"Given authorization scopes are not sufficient and do not match required scopes.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"notFound_404":{"description":"The requested resource does not exist.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"resourceConflict_409":{"description":"Creation failed because there was a conflict with another resource. Details of the error are included in the response payload.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"internalError_500":{"description":"Some server side error occurred.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}}},"paths":{"/shipping/{tenant}/{site}/cgrelations":{"post":{"tags":["Customer Group Relations"],"summary":"Creating a customer-group relation","operationId":"POST-shipping-create-customer-group-relation","description":"Creates a new customer-group relation for the specified site.","parameters":[{"$ref":"#/components/parameters/tenant"},{"$ref":"#/components/parameters/site"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CGRelation"}}}},"responses":{"201":{"description":"Resource successfully created.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResourceCreatedResponse"}}}},"400":{"$ref":"#/components/responses/yaasAware_400"},"401":{"$ref":"#/components/responses/unauthorized_401"},"403":{"$ref":"#/components/responses/yaasAware_403"},"404":{"$ref":"#/components/responses/notFound_404"},"409":{"$ref":"#/components/responses/resourceConflict_409"},"500":{"$ref":"#/components/responses/internalError_500"}}}}}}
```

## Retrieving a customer's customer-group relations

> Retrieves customer-group relations for the specified customer.

```json
{"openapi":"3.0.0","info":{"title":"Shipping Service","version":"0.0.1"},"tags":[{"name":"Customer Group Relations","description":"Manage shipping customer groups"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"oAuth2":[]}],"components":{"securitySchemes":{"oAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"shipping.shipping_manage":"Needed to manage shipping settings.","shipping.shipping_read":"Needed to read shipping settings."}}}}},"parameters":{"tenant":{"name":"tenant","in":"path","required":true,"description":"Your Emporix tenant name.\n\n**Note**: The tenant should always be written in lowercase.\n","schema":{"pattern":"^[a-z][a-z0-9]+$","minLength":3,"maxLength":16,"type":"string"}},"site":{"description":"Site unique identifier. A site is a specific shop.\n\nIf the tenant owns only one shop, the value should be set to `main`.\n","name":"site","in":"path","required":true,"schema":{"type":"string"}},"customerId":{"description":"Customer unique identifier generated when the customer's account is created through the Customer Service.","name":"customerId","in":"path","required":true,"schema":{"type":"string"}}},"schemas":{"CGRelation":{"title":"Customer-group relation","description":"Customer-group relation allows to assign user for specific group.","type":"object","properties":{"customerId":{"description":"Customer unique identifier.","type":"string"},"groupId":{"description":"Group's unique identifier.","type":"string"}}},"errorMessage":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"status":{"minimum":100,"maximum":599,"description":"original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"type":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error type, lower case with underscore eg validation_failure","type":"string"},"message":{"description":"descriptive error message for debugging","type":"string"},"moreInfo":{"type":"string","description":"link to documentation to investigate further and finding support"},"errorCode":{"type":"string","description":"The error code which specify the problem"},"details":{"description":"list of problems causing this error","type":"array","items":{"title":"errorDetail","description":"schema for specific error cause","anyOf":[{"type":"string"},{"type":"object","properties":{"field":{"description":"a bean notation expression specifying the element in request data causing the error, eg shipTo[0].country, this can be empty if violation was not field specific","type":"string"},"type":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error detail type, lower case with underscore eg missing_value, this value must be always interpreted in context of the general error type.","type":"string"},"message":{"description":"descriptive error detail message for debugging","type":"string"},"moreInfo":{"type":"string","description":"link to documentation to investigate further and finding support for error detail"}}}]}}},"required":["status","type"]}},"responses":{"unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"internalError_500":{"description":"Some server side error occurred.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}}},"paths":{"/shipping/{tenant}/{site}/cgrelations/{customerId}":{"get":{"tags":["Customer Group Relations"],"summary":"Retrieving a customer's customer-group relations","operationId":"GET-shipping-retrieve-customer-group-relations","description":"Retrieves customer-group relations for the specified customer.","parameters":[{"$ref":"#/components/parameters/tenant"},{"$ref":"#/components/parameters/site"},{"$ref":"#/components/parameters/customerId"}],"responses":{"200":{"description":"Resource successfully retrieved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CGRelation"}}}},"401":{"$ref":"#/components/responses/unauthorized_401"},"500":{"$ref":"#/components/responses/internalError_500"}}}}}}
```

## Updating a customer's customer-group relations

> Updates the customer-group relation for the specified customer.

```json
{"openapi":"3.0.0","info":{"title":"Shipping Service","version":"0.0.1"},"tags":[{"name":"Customer Group Relations","description":"Manage shipping customer groups"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"oAuth2":["shipping.shipping_manage"]}],"components":{"securitySchemes":{"oAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"shipping.shipping_manage":"Needed to manage shipping settings.","shipping.shipping_read":"Needed to read shipping settings."}}}}},"parameters":{"tenant":{"name":"tenant","in":"path","required":true,"description":"Your Emporix tenant name.\n\n**Note**: The tenant should always be written in lowercase.\n","schema":{"pattern":"^[a-z][a-z0-9]+$","minLength":3,"maxLength":16,"type":"string"}},"site":{"description":"Site unique identifier. A site is a specific shop.\n\nIf the tenant owns only one shop, the value should be set to `main`.\n","name":"site","in":"path","required":true,"schema":{"type":"string"}},"customerId":{"description":"Customer unique identifier generated when the customer's account is created through the Customer Service.","name":"customerId","in":"path","required":true,"schema":{"type":"string"}}},"schemas":{"CGRelation":{"title":"Customer-group relation","description":"Customer-group relation allows to assign user for specific group.","type":"object","properties":{"customerId":{"description":"Customer unique identifier.","type":"string"},"groupId":{"description":"Group's unique identifier.","type":"string"}}},"errorMessage":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"status":{"minimum":100,"maximum":599,"description":"original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"type":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error type, lower case with underscore eg validation_failure","type":"string"},"message":{"description":"descriptive error message for debugging","type":"string"},"moreInfo":{"type":"string","description":"link to documentation to investigate further and finding support"},"errorCode":{"type":"string","description":"The error code which specify the problem"},"details":{"description":"list of problems causing this error","type":"array","items":{"title":"errorDetail","description":"schema for specific error cause","anyOf":[{"type":"string"},{"type":"object","properties":{"field":{"description":"a bean notation expression specifying the element in request data causing the error, eg shipTo[0].country, this can be empty if violation was not field specific","type":"string"},"type":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error detail type, lower case with underscore eg missing_value, this value must be always interpreted in context of the general error type.","type":"string"},"message":{"description":"descriptive error detail message for debugging","type":"string"},"moreInfo":{"type":"string","description":"link to documentation to investigate further and finding support for error detail"}}}]}}},"required":["status","type"]}},"responses":{"unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"yaasAware_403":{"description":"Given authorization scopes are not sufficient and do not match required scopes.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"resourceConflict_409":{"description":"Creation failed because there was a conflict with another resource. Details of the error are included in the response payload.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"internalError_500":{"description":"Some server side error occurred.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}}},"paths":{"/shipping/{tenant}/{site}/cgrelations/{customerId}":{"put":{"tags":["Customer Group Relations"],"summary":"Updating a customer's customer-group relations","operationId":"PUT-shipping-update-customer-group-relations","description":"Updates the customer-group relation for the specified customer.","parameters":[{"$ref":"#/components/parameters/tenant"},{"$ref":"#/components/parameters/site"},{"$ref":"#/components/parameters/customerId"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CGRelation"}}}},"responses":{"200":{"description":"Resource successfully updated."},"401":{"$ref":"#/components/responses/unauthorized_401"},"403":{"$ref":"#/components/responses/yaasAware_403"},"409":{"$ref":"#/components/responses/resourceConflict_409"},"500":{"$ref":"#/components/responses/internalError_500"}}}}}}
```

## Deleting a customer's customer-group relation

> Deletes the customer-group relation for the specified customer.

```json
{"openapi":"3.0.0","info":{"title":"Shipping Service","version":"0.0.1"},"tags":[{"name":"Customer Group Relations","description":"Manage shipping customer groups"}],"servers":[{"url":"https://api.emporix.io"}],"security":[{"oAuth2":["shipping.shipping_manage"]}],"components":{"securitySchemes":{"oAuth2":{"type":"oauth2","flows":{"clientCredentials":{"tokenUrl":"https://api.emporix.io/oauth/token","scopes":{"shipping.shipping_manage":"Needed to manage shipping settings.","shipping.shipping_read":"Needed to read shipping settings."}}}}},"parameters":{"tenant":{"name":"tenant","in":"path","required":true,"description":"Your Emporix tenant name.\n\n**Note**: The tenant should always be written in lowercase.\n","schema":{"pattern":"^[a-z][a-z0-9]+$","minLength":3,"maxLength":16,"type":"string"}},"site":{"description":"Site unique identifier. A site is a specific shop.\n\nIf the tenant owns only one shop, the value should be set to `main`.\n","name":"site","in":"path","required":true,"schema":{"type":"string"}},"customerId":{"description":"Customer unique identifier generated when the customer's account is created through the Customer Service.","name":"customerId","in":"path","required":true,"schema":{"type":"string"}}},"responses":{"unauthorized_401":{"description":"Unauthorized","content":{"application/json":{"schema":{"type":"object","properties":{"fault":{"type":"object","properties":{"faultstring":{"type":"string"},"detail":{"type":"object","properties":{"errorcode":{"type":"string"}}}}}}}}}},"yaasAware_403":{"description":"Given authorization scopes are not sufficient and do not match required scopes.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}},"internalError_500":{"description":"Some server side error occurred.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorMessage"}}}}},"schemas":{"errorMessage":{"title":"error","description":"Schema for API specified errors.","type":"object","properties":{"status":{"minimum":100,"maximum":599,"description":"original HTTP error code, should be consistent with the response HTTP code","type":"integer"},"type":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error type, lower case with underscore eg validation_failure","type":"string"},"message":{"description":"descriptive error message for debugging","type":"string"},"moreInfo":{"type":"string","description":"link to documentation to investigate further and finding support"},"errorCode":{"type":"string","description":"The error code which specify the problem"},"details":{"description":"list of problems causing this error","type":"array","items":{"title":"errorDetail","description":"schema for specific error cause","anyOf":[{"type":"string"},{"type":"object","properties":{"field":{"description":"a bean notation expression specifying the element in request data causing the error, eg shipTo[0].country, this can be empty if violation was not field specific","type":"string"},"type":{"pattern":"[a-z]+[a-z_]*[a-z]+","description":"classification of the error detail type, lower case with underscore eg missing_value, this value must be always interpreted in context of the general error type.","type":"string"},"message":{"description":"descriptive error detail message for debugging","type":"string"},"moreInfo":{"type":"string","description":"link to documentation to investigate further and finding support for error detail"}}}]}}},"required":["status","type"]}}},"paths":{"/shipping/{tenant}/{site}/cgrelations/{customerId}":{"delete":{"tags":["Customer Group Relations"],"summary":"Deleting a customer's customer-group relation","operationId":"DELETE-shipping-remove-customer-group-relation","description":"Deletes the customer-group relation for the specified customer.","parameters":[{"$ref":"#/components/parameters/tenant"},{"$ref":"#/components/parameters/site"},{"$ref":"#/components/parameters/customerId"}],"responses":{"204":{"description":"Resource successfully deleted."},"401":{"$ref":"#/components/responses/unauthorized_401"},"403":{"$ref":"#/components/responses/yaasAware_403"},"500":{"$ref":"#/components/responses/internalError_500"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developer.emporix.io/api-references/api-guides/delivery-and-shipping/shipping-1/api-reference/customer-group-relations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
