API reference · Customers
Add Address to Customer
https://api.sandbox.cws.digital/customer/{document}/addressDescription
Adds an address to the registration of a customer of your store.
Parameters
Path parameters
| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| document | string | Yes | Customer's CPF or CNPJ. |
Request body
application/jsonRequired| Field | Type | Required | Description | Value |
|---|---|---|---|---|
| name | string | Yes | Address name. It cannot be null. | |
| 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. | |
| howToReachLocationDescription | string | No | Instructions to access the location. | |
| responsibleContact | string | No | Responsible contact at the address. | |
| enabled | boolean | No | Active address. Absent means | |
| addressAttributes | array of object | No | Custom attributes. Each one must exist in your store's configuration. |
Business rules
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 address is rejected.
A ZIP code that is not found is also rejected, unless your store has ZIP code validation disabled.
addressType accepts only two values
RESIDENTIAL or BUSINESS, in any case. Any other value is rejected with Property addressType is type-mismatched.
Responses
- 401
Missing, malformed or expired token.
- 404
Document not registered in your store.