Skip to main content

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​

ParameterTypeDescription
idStringThe 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.

FieldTypeRequiredDescription
typeStringNoshipping or billing.
address1StringNoAddress line 1.
address2StringNoAddress line 2.
cityStringNoCity.
stateStringNoState code, for example NJ.
countryStringNoCountry code, for example US.
zipcodeStringNoPostal code.
firstNameStringNoFirst name of the contact.
lastNameStringNoLast name of the contact.
companyNameStringNoCompany name shown on the address.
companyEmailStringNoEmail address for the address.
phoneNumberStringNoPhone number of the contact.
isDefaultAddressBooleanNoMake this the default address of its type.
metaFieldsArrayNoCustom 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​

FieldTypeDescription
successBooleanWhether the request succeeded.
messageStringResult message.
dataObjectThe 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.