Update Address
Updates a single company or customer address. Only the fields you send are changed.
HTTP Request
- URL:
/address/{id} - Method:
PUT - Headers:
accessToken: Required. Your API access token.Content-Type:application/json
- Required scope:
READ_WRITE_COMPANY
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | The ID of the address to update. |
Request Body
Send a JSON object with the fields to update. All fields are optional, but the body cannot be empty.
| Field | Type | Required | Description |
|---|---|---|---|
type | String | No | shipping or billing. |
address1 | String | No | Address line 1. |
address2 | String | No | Address line 2. |
city | String | No | City. |
state | String | No | State code, for example NJ. |
country | String | No | Country code, for example US. |
zipcode | String | No | Postal code. |
firstName | String | No | First name of the contact. |
lastName | String | No | Last name of the contact. |
companyName | String | No | Company name shown on the address. |
companyEmail | String | No | Email address for the address. |
phoneNumber | String | No | Phone number of the contact. |
isDefaultAddress | Boolean | No | Make this the default address of its type. |
metaFields | Array | No | Custom field values as code and value. Replaces the current values. |
cURL Example
curl --location --request PUT '<BASE_URL>/address/66b9b3b166169eecd60e5baa' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"address1": "1200 Airport Heights Dr",
"city": "Anchorage",
"state": "AK",
"country": "US",
"zipcode": "99508",
"isDefaultAddress": true
}'
Response
- 200 OK: The address was updated successfully.
- 400 Bad Request: The access token is missing or invalid, the body is empty, a field is not valid, or the address ID is not valid.
- 404 Not Found: No address matches the ID.
Sample JSON Response
{
"success": true,
"message": "Address updated successfully",
"data": {
"id": "66b9b3b166169eecd60e5baa",
"company": "66b9b3b166169eecd60e5ba8",
"type": "shipping",
"firstName": "John",
"lastName": "Doe",
"address1": "1200 Airport Heights Dr",
"city": "Anchorage",
"state": { "code": "AK", "name": "Alaska" },
"country": { "code": "US", "name": "United States" },
"zipcode": "99508",
"isDefaultAddress": true,
"status": true,
"metaFields": [],
"createdAt": "2024-08-23T13:27:13.715Z",
"updatedAt": "2024-10-09T13:05:59.036Z"
}
}
Response Details
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the request succeeded. |
message | String | Result message. |
data | Object | The updated address. |
Address Data
data has the same fields as the address returned by Get Address by ID.
Notes
- When an address is marked as default, the previous default address of the same type for that company or customer is no longer the default.