API reference · Customers

Add Address to Customer

POSThttps://api.sandbox.cws.digital/customer/{document}/address

Description

Adds an address to the registration of a customer of your store.

Parameters

Path parameters

FieldTypeRequiredDescriptionValue
documentstringYes

Customer's CPF or CNPJ.

Request body

Content-Typeapplication/jsonRequired
Edit the body with
FieldTypeRequiredDescriptionValue
namestringYes

Address name. It cannot be null.

zipcodestringYes

Address ZIP code. It is what resolves street and district — see the Correios rule.

numberstringYes

Number.

complementstringNo

Address complement.

streetstringConditional

Street. See the Correios rule.

quarterstringConditional

District. See the Correios rule.

citystringNo

City.

statestringNo

State (UF).

addressTypestringNo

RESIDENTIAL or BUSINESS. Case-insensitive.

farmerStateRegistrationstringNo

Rural producer state registration.

principalbooleanNo

Marks the address as the principal one.

howToReachLocationDescriptionstringNo

Instructions to access the location.

responsibleContactstringNo

Responsible contact at the address.

enabledbooleanNo

Active address. Absent means true.

addressAttributesarray of objectNo

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.

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/46693537308/address' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Escritório",
  "zipcode": "01310-100",
  "street": "Avenida Paulista",
  "number": "2000",
  "complement": "12º andar",
  "quarter": "Bela Vista",
  "city": "São Paulo",
  "state": "SP",
  "addressType": "BUSINESS",
  "principal": false,
  "howToReachLocationDescription": "Entrada pela portaria B",
  "responsibleContact": "Marcos Aurélio"
}'

Response

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