# Update Customer Addresses

## Overview

In order to update the addresses of an existing customer, you can consume the endpoint presented in this article. In order to consume it, you must:

- Be authenticated user

For information on how you can authenticate, see: [Authentication](https://developer.sellercloud.com/dev-article/authentication/)

As soon as you do authentication and receive a valid token, it needs to be passed to the service call.

## Endpoint

Example for such endpoint for **TT** server is:

https://tt.api.sellercloud.com/rest/api/Customers/{customerId}/Addresses

For your server endpoint will be:

https://{your_server_id}.api.sellercloud.com/rest/api/Customers/{customerId}/Addresses

## Request

Information about expected request parameters can be found on swagger UI [https://tt/api.sellercloud.com/rest/swagger](https://tt/api.sellercloud.com/rest/swagger).

- **Method Type**: **HttpPut**
- **Authorization**: Use **Bearer Token** (where ‘Token’ is the token received from token authentication)
- **Header info**: **Content-Type: application/json**
- **Parameters**: Id of existing customer
- **Request Body**:

```
{
  "Addresses": [
    {
      "ID": 0,
      "CompanyName": "string",
      "AddressSource": "LocalSite",
      "AddressStatus": "Unknown",
      "IsShippingAddress": true,
      "IsBillingAddress": true,
      "Address2": "string",
      "ContactName": "string",
      "Country": "string",
      "City": "string",
      "State": "string",
      "Region": "string",
      "ZipCode": "string",
      "Address": "string",
      "Phone": "string",
      "Fax": "string"
    }
  ]
}
```

| **Parameter**        | **Data Type** | **Description**                                                                 | **Is Required** |
|----------------------|----------------|---------------------------------------------------------------------------------|-----------------|
| Addresses            | List           | List of addresses to update                                                     | true            |
| ID                   | integer        | Address ID                                                                      | true            |
| ContactName          | string         | Contact name<br>Either ‘ContactName’ or ‘CompanyName’ has to be provided.     | false           |
| CompanyName          | string         | Business name<br>Either ‘ContactName’ or ‘CompanyName’ has to be provided.    | false           |
| AddressSource        | enum           | Address source<br>Possible values can be found [here](https://developer.sellercloud.com/dev-article/address-source/) | true            |
| AddressStatus        | enum           | Address status<br>Possible values can be found [here](https://developer.sellercloud.com/dev-article/address-status/) | true            |
| IsShippingAddress     | bool           | Indicates if the address is shipping address                                   | true            |
| IsBillingAddress      | bool           | Indicates if the address is billing address                                    | true            |
| Address              | string         | Address Line 1                                                                  | true            |
| Address2            | string         | Address Line 2                                                                  | false           |
| Country             | string         | Two letter iso country code of the address country                             | true            |
| City                | string         | City                                                                            | true            |
| State               | string         | State<br>Required when ‘Country’ is set to “US”.                             | false           |
| Region              | string         | Region                                                                          | false           |
| ZipCode             | string         | Zip code                                                                        | true            |
| Phone               | string         | Phone                                                                          | false           |
| Fax                 | string         | Fax                                                                            | false           |

**USAGE NOTE:** The whole address object has to be provided when updating. Customer address can be obtained from [Get Single Customer](https://developer.sellercloud.com/dev-article/get-single-customer/). Then values of its properties can be changed and the changed address can be provided to this endpoint to update it. Only the addresses to update should be provided to this endpoint.

## Response

- If user is authenticated and update is successful, then response will be **Status Code 200 => OK**
- If user is not authenticated, then response will be **Status Code 401 => Not Valid Token**
- In case of error, response will be **Status Code 500 => Internal Server Error**
