API reference · Customers

Create Customer Group

POSThttps://api.sandbox.cws.digital/customer/group

Description

Creates a customer group in your store.

The group defines which document type it applies to and which delivery and payment methods are restricted for those in it.

Request body

Content-Typeapplication/jsonRequired
Edit the body with
FieldTypeRequiredDescriptionValue
namestringYes

Group name. Unique in your store.

enableGroupDisplayInRegistrationbooleanYes

Whether the group is shown in the customer registration.

enableGroupDisplayInMyAccountbooleanYes

Whether the group is shown in the customer's account.

applicationGroupDocumentTypeobjectYes

Which document type the group applies to. Exactly one true key — see the rule.

Fields in applicationGroupDocumentType

restrictionDeliveryTypeobjectYes

Delivery restriction. Exactly one true key.

Fields in restrictionDeliveryType

restrictionPaymentTypeobjectYes

Payment restriction. Exactly one true key.

Fields in restrictionPaymentType

showToSellerbooleanNo

Whether the group is shown to the seller.

externalIdstringNo

Group id in your system. Unique in the store, maximum 20 characters.

colorHexadecimalstringNo

Group color in hexadecimal, without #: exactly 3, 6 or 8 characters, only 0-9 and A-F.

groupTypeIdstringNo

External id of a group type already registered in your store. Maximum 20 characters.

groupTypeNamestringNo

Name of a group type already registered in your store. Maximum 70 characters.

anonymousCustomerbooleanNo

Marks the group as the anonymous customer group. Only one per store.

applicationGroupDocumentType
FieldTypeRequiredDescriptionValue
allbooleanNo
pjbooleanNo
ieprbooleanNo
pfbooleanNo
restrictionDeliveryType
FieldTypeRequiredDescriptionValue
no_restrictionbooleanNo
restrict_all_except_pickup_in_storebooleanNo
restrict_all_except_carrierbooleanNo
restrict_all_except_deliveriesbooleanNo
restrictionPaymentType
FieldTypeRequiredDescriptionValue
no_restrictionbooleanNo
restrict_online_paymentbooleanNo
restrict_offline_paymentbooleanNo

Business rules

Exactly one true key in each object

In the three objects, one and only one key can be true. None and more than one are rejected, with different messages — Pelo menos uma das opções ... deve ser definida como true. and Somente uma das opções ... deve ser definida como true.

The group type must exist beforehand

groupTypeId and groupTypeName do not create a group type: they reference one that is already registered in your store.

A value without a match is rejected with Tipo Grupo de id X e name Y não cadastrado!.

When sending both, both must point to the same type.

Responses

  • 401

    Missing, malformed or expired token.

Try it

Sandbox

Language

Credentials

Access token: saved in this tab and used on every endpoint.

Each token only reaches the partner's own data and that of the branches with an authorized link.

Don't have sandbox credentials yet? See how to request them

Request

cURL
curl --request POST \
  --url 'https://api.sandbox.cws.digital/customer/group' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Atacado Sudeste",
  "externalId": "GRP-ATC-SE",
  "showToSeller": true,
  "enableGroupDisplayInRegistration": true,
  "enableGroupDisplayInMyAccount": false,
  "colorHexadecimal": "1F7A4D",
  "applicationGroupDocumentType": {
    "pj": true
  },
  "restrictionDeliveryType": {
    "no_restriction": true
  },
  "restrictionPaymentType": {
    "restrict_offline_payment": true
  }
}'

Response

Click Try it to see the real response here, or pick a documented example: