API reference · Customers
Create New Customer
https://api.sandbox.cws.digital/v1/customerDescription
Registers a customer in your store, with the address and, optionally, the type, group and price tag links.
The created customer can already access the store with the username and password provided.
Request body
application/jsonRequired| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| documentType | string | Yes |
| |
| document | string | Yes | CPF or CNPJ, valid and consistent with the | |
| username | string | Yes | Customer's access e-mail. It must be a valid e-mail. | |
| phone | string | Yes | Customer's phone. | |
| password | string | Yes | Customer's access password. | |
| customerRegistrationAddress | object | Conditional | Customer's registration address. See the rule below. Fields in customerRegistrationAddress | |
| addressList | array of object | Conditional | Customer's delivery addresses. See the rule below. Fields in addressList[] | |
| name | string | No | Name or corporate name. | |
| tradingName | string | No | Trade name. | |
| contactName | string | No | Contact name. | |
| stateRegistration | string | No | State registration. | |
| cnae | string | No | Customer's CNAE. | |
| paysIcms | boolean | No | Whether the customer is an ICMS taxpayer. | |
| politicallyExposedPerson | boolean | No | Whether the customer is a politically exposed person. | |
| federalEmployee | string | No | Civil servant: Allowed values: NSVSPFSPESPM | |
| optinTracking | boolean | No | Acceptance of tracking by message. | |
| trackingPhone | string | No | Tracking phone. | |
| forceChangePassword | boolean | No | Requires a password change on the first access. | |
| passwordExpired | boolean | No | Marks the password as expired. Absent means | |
| sendEmailNewCustomer | boolean | No |
| |
| ssoConfigId | integer | No | SSO configuration. Validated against your store. | |
| priceRuleTags | array of object | No | Price tags, by name. | |
| customerTypeList | array of object | No | Customer types, by | |
| customerGroupList | array of object | No | Customer groups, by |
| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| zipcode | string | Yes | Address ZIP code. It is what resolves street and district — see the Correios rule. | |
| number | string | Yes | Number. | |
| complement | string | No | Address complement. | |
| street | string | Conditional | Street. See the Correios rule. | |
| quarter | string | Conditional | District. See the Correios rule. | |
| city | string | No | City. | |
| state | string | No | State (UF). | |
| addressType | string | No |
| |
| farmerStateRegistration | string | No | Rural producer state registration. | |
| principal | boolean | No | Marks the address as the principal one. | |
| name | string | No | Address name. | |
| lat | number | No | Coordinates. Accepted only if your store has the latitude/longitude feature enabled. | |
| lng | number | No | Coordinates. Accepted only if your store has the latitude/longitude feature enabled. |
addressList[]| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| zipcode | string | Yes | Address ZIP code. It is what resolves street and district — see the Correios rule. | |
| number | string | Yes | Number. | |
| complement | string | No | Address complement. | |
| street | string | Conditional | Street. See the Correios rule. | |
| quarter | string | Conditional | District. See the Correios rule. | |
| city | string | No | City. | |
| state | string | No | State (UF). | |
| addressType | string | No |
| |
| farmerStateRegistration | string | No | Rural producer state registration. | |
| principal | boolean | No | Marks the address as the principal one. | |
| name | string | No | Address name. | |
| lat | number | No | Coordinates. Accepted only if your store has the latitude/longitude feature enabled. | |
| lng | number | No | Coordinates. Accepted only if your store has the latitude/longitude feature enabled. |
Business rules
customerRegistrationAddress and addressList store different things
Both are addresses, but they go to different places and sending only one of them has different effects:
| What you send | What the customer gets |
|---|---|
Only customerRegistrationAddress | Registration address filled in, and no delivery address — the list stays empty. |
Only addressList, with one item principal: true | The delivery addresses of the list, and the registration address copied from the principal item. |
| Both | The delivery addresses of the list and the registration address you provided. |
Only addressList without any principal: true | Rejected — there is no registration address to determine. |
| Neither | Rejected. |
The ZIP code rules the address
The address is resolved by Correios from the zipcode: what Correios returns replaces what you sent in street, quarter, city and state.
Of what you send, number and complement are always kept, because Correios does not have this data.
The fields you send work as a fallback: each one is used only when Correios does not bring that data for the ZIP code.
After this combination, street and quarter cannot be empty: if they are, the creation is rejected.
A ZIP code that is not found is also rejected, unless your store has ZIP code validation disabled.
An addressType outside the list becomes RESIDENTIAL
A value other than RESIDENTIAL/BUSINESS is stored as RESIDENTIAL.
Responses
- 401
Missing, malformed or expired token.