API reference · Callbacks and Webhooks
Customers Webhook Payload
Description
This is an example payload for the Customers Webhook, sent when a customer is created or updated on the CWS platform.
The registration comes in data, always with all the fields: what the customer does not have comes empty (empty text, 0, false or null).
A date without a value comes as 0001-01-01T00:00:00Z.
Respond 200, 201 or 202 to confirm the receipt: CWS does not read the response body. On 401, CWS gets a new token and resends the notification once; any other status, 204 included, counts as a delivery failure.
Parameters
Headers
| Field | Type | Description |
|---|---|---|
| Authorization | string | CWS's credential on your endpoint: |
Payload
| Field | Type | Description |
|---|---|---|
| operation | string | Operation that triggered the notification: |
| data | object | Customer registration. Fields in data |
| Field | Type | Description |
|---|---|---|
| id | integer | Customer id at CWS. |
| document | string | Customer's CPF or CNPJ. |
| name | string | Name or corporate name. |
| tradingName | string | Trading name. |
| contactName | string | Contact name. |
| documentType | string |
|
| dateCreated | string | Date and time of the registration. |
| lastUpdated | string | Date and time of the registration's last change. |
| string | Customer's login e-mail. | |
| phone | string | Phone. |
| optinTracking | boolean | Whether the tracking opt-in is active. |
| trackingPhone | string | Tracking mobile phone. |
| stateRegistration | string | State registration. |
| genre | string | Sex: |
| birthdate | string | Date of birth. |
| cnae | string | Customer's CNAE. |
| politicallyExposedPerson | boolean | Whether it is a politically exposed person. |
| federalEmployee | string | Public servant: |
| address | array of object | Customer's addresses. Fields in data.address[] |
| priceRuleTag | array of object | Always Fields in data.priceRuleTag[] |
| priceType | object | Always with empty Fields in data.priceType |
| registrationAddress | object | Registration address. Fields in data.registrationAddress |
| customerAttributes | array of object | Custom attributes of the customer's registration. Fields in data.customerAttributes[] |
| customerTypeList | array of object | Linked customer types. Fields in data.customerTypeList[] |
| customerGroupList | array of object | Linked customer groups. Fields in data.customerGroupList[] |
| customerRuralComplement | object | Fields in data.customerRuralComplement |
| cars | array of object | Customer's Rural Environmental Registries (CAR). Fields in data.cars[] |
| unassociatedCars | array of object | Customer's CARs without an associated address. Fields in data.unassociatedCars[] |
| lastUpdatedBy | object | Seller who made the change, when it came from a seller; without a seller, the fields come empty. Fields in data.lastUpdatedBy |
| Field | Type | Description |
|---|---|---|
| id | integer | Address id. |
| name | string | Address name. |
| street | string | Street. |
| number | string | Number. |
| complement | string | Complement. |
| quarter | string | Neighborhood. |
| city | string | City. |
| state | string | State (UF). |
| zipcode | string | ZIP code (CEP). |
| principal | boolean | Whether it is the main address. |
| addressType | string |
|
| farmerStateRegistration | string | Rural producer's state registration. |
| howToReachLocationDescription | string | |
| addressAttributes | array of object | Always Fields in data.address[].addressAttributes[] |
| addressRuralComplement | object | null | Fields in data.address[].addressRuralComplement |
| agronomicProfile | object | Fields in data.address[].agronomicProfile |
| dateCreated | string | Date and time the address was registered. |
| lastUpdated | string | Date and time of the address's last change. |
| Field | Type | Description |
|---|---|---|
| name | string | Attribute name. |
| value | string | Attribute value. |
| Field | Type | Description |
|---|---|---|
| bpCode | string | |
| indeaIdentificationNumber | integer | |
| indeaStatus | boolean | |
| isLeased | boolean | |
| lessorCpf | string | |
| lessorPhone | string | |
| lessorName | string | |
| leasedArea | number | |
| ieStatus | string | |
| ieIndustrialSector | string | |
| ieBusinessName | string | |
| ieCharacterizedAsSociety | boolean | |
| radius | integer | |
| membersIELink | array of object |
| Field | Type | Description |
|---|---|---|
| id | integer | |
| memberCpf | string |
| Field | Type | Description |
|---|---|---|
| consolidatedFarmableArea | number | |
| consolidatedProductiveAreas | array of object | |
| associatedCars | array of object |
| Field | Type | Description |
|---|---|---|
| commodity | object | |
| crop | object | |
| areaHa | number | |
| origin | string |
| Field | Type | Description |
|---|---|---|
| id | string | |
| culture | string |
| Field | Type | Description |
|---|---|---|
| id | string | |
| cropName | string |
| Field | Type | Description |
|---|---|---|
| id | integer | |
| name | string |
| Field | Type | Description |
|---|---|---|
| id | string | |
| name | string |
| Field | Type | Description |
|---|---|---|
| id | string | |
| name | string |
| Field | Type | Description |
|---|---|---|
| street | string | Street. |
| number | string | Number. |
| complement | string | Complement. |
| quarter | string | Neighborhood. |
| city | string | City. |
| state | string | State (UF). |
| zipcode | string | ZIP code (CEP). |
| addressType | string |
|
| howToReachLocationDescription | string | |
| farmerStateRegistration | string | Rural producer's state registration. |
| Field | Type | Description |
|---|---|---|
| name | string | Attribute name. |
| value | string | Attribute value. |
| Field | Type | Description |
|---|---|---|
| id | integer | Customer type id. |
| name | string | Customer type name. |
| Field | Type | Description |
|---|---|---|
| id | integer | Customer group id. |
| name | string | Customer group name. |
| externalId | string | Customer group's external id. |
| type | string | Name of the group type. |
| codeType | integer | Id of the group type. |
| Field | Type | Description |
|---|---|---|
| cndIdentificationNumber | integer | |
| cndInstitutionAuthNumber | string | |
| cndValidFrom | string | |
| cndValidUntil | string | |
| billingContact | string | |
| documentRegistrationStatus | string |
| Field | Type | Description |
|---|---|---|
| id | integer | |
| name | string | |
| totalAreaHa | number | |
| farmableAreaHa | number | |
| city | string | |
| state | string | |
| isThirdPartyLease | boolean | Always |
| isCustomerLease | boolean | Always |
| isOwnLease | boolean | Always |
| origin | string | |
| agriculturalArea | number | |
| cornProductionArea | number | |
| soybeanProductionArea | number | |
| socioEnvironmentalAnalysis | string | |
| status | string | |
| productiveAreas | array of object | Fields in data.cars[].productiveAreas[] |
| dateCreated | string | |
| lastUpdated | string |
| Field | Type | Description |
|---|---|---|
| commodity | object | Fields in data.cars[].productiveAreas[].commodity |
| crop | object | Fields in data.cars[].productiveAreas[].crop |
| areaHa | number |
| Field | Type | Description |
|---|---|---|
| id | string | |
| culture | string |
| Field | Type | Description |
|---|---|---|
| id | string | |
| cropName | string |
| Field | Type | Description |
|---|---|---|
| id | integer | |
| name | string |
| Field | Type | Description |
|---|---|---|
| agentType | string | Seller type ( |
| string | Seller's login e-mail. | |
| document | string | Seller's document. |
| agentCode | string | Seller code. |
| agentPartners | array of object | Seller's partners. Fields in data.lastUpdatedBy.agentPartners[] |
| Field | Type | Description |
|---|---|---|
| partnerId | integer | Partner id at CWS. |
| companyName | string | Partner's corporate name. |
| document | string | Partner's document. |
| defaultPartner | boolean | Whether it is the seller's default partner. |
{
"operation": "UPDATE",
"data": {
"id": 547322,
"document": "57.578.030/0001-05",
"name": "Comercial Aurora Ltda",
"tradingName": "Aurora Distribuidora",
"contactName": "Marcos Aurélio",
"documentType": "pj",
"dateCreated": "2023-01-25T19:59:58Z",
"lastUpdated": "2023-01-25T19:59:58Z",
"email": "compras@auroradistribuidora.com.br",
"phone": "(11) 98765-4321",
"optinTracking": true,
"trackingPhone": "(11) 98765-4321",
"stateRegistration": "123456789",
"genre": "",
"birthdate": "",
"cnae": "4530703",
"politicallyExposedPerson": false,
"federalEmployee": "N",
"address": [
{
"id": 1060461,
"name": "Endereço de cadastro",
"street": "Avenida Paulista",
"number": "1578",
"complement": "Conjunto 42",
"quarter": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"zipcode": "01310-100",
"principal": true,
"addressType": "BUSINESS",
"farmerStateRegistration": "",
"howToReachLocationDescription": "",
"addressAttributes": [],
"addressRuralComplement": null,
"agronomicProfile": {
"consolidatedFarmableArea": 0,
"consolidatedProductiveAreas": [],
"associatedCars": []
},
"dateCreated": "2023-01-25T19:59:58Z",
"lastUpdated": "2023-01-25T19:59:58Z"
}
],
"priceRuleTag": [],
"priceType": {
"id": "",
"name": ""
},
"registrationAddress": {
"street": "Avenida Paulista",
"number": "1578",
"complement": "Conjunto 42",
"quarter": "Bela Vista",
"city": "São Paulo",
"state": "SP",
"zipcode": "01310-100",
"addressType": "BUSINESS",
"howToReachLocationDescription": "",
"farmerStateRegistration": ""
},
"customerAttributes": [],
"customerTypeList": [],
"customerGroupList": [],
"customerRuralComplement": {
"cndIdentificationNumber": 0,
"cndInstitutionAuthNumber": "",
"cndValidFrom": "0001-01-01T00:00:00Z",
"cndValidUntil": "0001-01-01T00:00:00Z",
"billingContact": "",
"documentRegistrationStatus": ""
},
"cars": [],
"unassociatedCars": [],
"lastUpdatedBy": {
"agentType": "",
"email": "",
"document": "",
"agentCode": "",
"agentPartners": []
}
}
}Expected response
- 200
Confirm with
200,201or202.