Customers
Create address
Add an address to a customer.
POST
/v1/customers/{customerId}/addressesBearer tokenReturns JSONSuccess 201
Send the full address as one line (formattedAddress) plus the country, and the state and city where you know them, using ids from the Reference lists. The first address of a customer becomes their default. Some countries need extra fields (for example the Saudi National Address); send those in customFieldValues.
Request
Headers
| Field | Type | Description |
|---|---|---|
Authorizationrequired | string | The access token from Get token, as "Bearer <token>". |
Content-Typerequired | string | Always application/json when a body is sent. |
Path parameters
| Field | Type | Description |
|---|---|---|
customerIdrequired | string | The customer's id. |
Request body
| Field | Type | Description |
|---|---|---|
formattedAddressrequired | string | The full address as one line. |
countryIdrequired | string | Country id, from List countries. |
stateIdoptional | string | State id, from List states. |
cityIdoptional | string | City id, from List cities. Needed for the coverage check. |
buildingUnitoptional | string | Building, floor or unit. |
postalCodeoptional | string | Postal code. |
latitudeoptional | number | Latitude, if you have it. |
longitudeoptional | number | Longitude, if you have it. |
customFieldValuesoptional | object | Extra fields some countries require, as key and value pairs. |
labeloptional | string | A short name for the address, for example Home. |
contactNameoptional | string | Who to ask for at this address. |
contactPhoneoptional | string | Phone number at this address. |
deliveryInstructionsoptional | string | Instructions for the driver. |
Example request
curl -X POST "https://api.swiftazu.com/v1/customers/8778df1e-9b74-420d-b826-d17cdad86d36/addresses" \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"formattedAddress": "Burj Views B, Downtown Dubai",
"countryId": "cfde4319-9563-4d6a-9afa-0f72dad3c718",
"stateId": "73ff99bd-ca0e-4ec7-a60e-f314c57c0046",
"cityId": "23a058c2-9b96-460b-92d8-1196cba2f562",
"buildingUnit": "Apt 1203",
"label": "Home",
"contactName": "Layla Hassan",
"contactPhone": "+971558250908"
}'Response
Example response · 201
{
"id": "0df7f36c-417a-4145-b956-743f66c4f9b7"
}Errors
| HTTP | Code | Meaning |
|---|---|---|
| 404 | not_found | The record does not exist, or it is not yours. |
| 400 | invalid_request | The request broke a business rule. message says which one. |
Every call can also return the shared errors listed on the Overview page. Overview