Skip to content
platform

API reference · Customers · Customer Groups

Create Customer Group

Method
POST
Route
/customer/group
Base URL
https://ws.autorei.net
Token
Requires Bearer token
Test in Postman

Opens this request in the public API documentation, the official source of the reference.

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 (JSON)

Field Type Required Description
name string Yes Group name. Unique in your store.
enableGroupDisplayInRegistration boolean Yes Whether the group appears in customer registration.
enableGroupDisplayInMyAccount boolean Yes Whether the group appears in the customer's account.
applicationGroupDocumentType object Yes Which document type the group applies to. Exactly one key true — see the rule.
restrictionDeliveryType object Yes Delivery restriction. Exactly one key true.
restrictionPaymentType object Yes Payment restriction. Exactly one key true.
showToSeller boolean No Whether the group appears to the sales rep.
externalId string No Group id in your system. Unique in the store, maximum 20 characters.
colorHexadecimal string No Group color in hexadecimal, without #: exactly 3, 6 or 8 characters, only 0-9 and A-F.
groupTypeId string No External id of a group type already registered in your store. Maximum 20 characters.
groupTypeName string No Name of a group type already registered in your store. Maximum 70 characters.
anonymousCustomer boolean No Marks the group as the anonymous customer group. Only one per store.

Keys accepted in each of the three objects:

Field Keys
applicationGroupDocumentType all · pj · iepr · pf
restrictionDeliveryType no_restriction · restrict_all_except_pickup_in_store · restrict_all_except_carrier · restrict_all_except_deliveries
restrictionPaymentType no_restriction · restrict_online_payment · restrict_offline_payment

Business rules

Exactly one true key in each object

In all 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 with no match is rejected with Tipo Grupo de id X e name Y não cadastrado!. If you send both, both must point to the same type.

Response · 200

Field Type Description
status string SUCCESS.
message string Confirmation of the operation.
action string CREATE or DELETE.
dateHour string Date and time of the operation, in UTC.
responsable.user string Email of the token's user.
responsable.origin string API.
group.internalId integer Internal id of the group.
group.name string Group name.
group.externalId string External id. null when not provided.
group.groupTypeId · group.groupTypeName string Group type. null when not linked.

Errors

Code When
400 Any rejection: missing required field, wrong count of true keys, name or externalId already registered, nonexistent group type, or size limit exceeded.
401 Token missing, malformed or expired.

The rejection comes in the same envelope as the operation, with status: "ERROR", and the message carries the HTTP code as a prefix:

{"status":"ERROR","message":"400 BAD_REQUEST: O campo 'name' é de preenchimento obrigatório.",
 "action":"CREATE","dateHour":"2026-09-04T12:14:15Z",
 "responsable":{"user":"integracao@lojaexemplo.com.br","origin":"API"}}

When there is more than one reason, they come in the same message, separated by , .

Example request

curl --request POST 'https://ws.autorei.net/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
  }
}'

Example responses

200Success — group created

{
  "status": "SUCCESS",
  "message": "Grupo criado com sucesso.",
  "action": "CREATE",
  "dateHour": "2026-09-04T12:15:16Z",
  "responsable": {
    "user": "integracao@lojaexemplo.com.br",
    "origin": "API"
  },
  "group": {
    "internalId": 4470801,
    "name": "Atacado Sudeste",
    "externalId": "GRP-ATC-SE",
    "groupTypeId": null,
    "groupTypeName": null
  }
}

Used in

Generated from the public API collection, published on 2026-09-04: api-docs.cws.digital.