Skip to content

Update Customer Address

Update an existing address in the customer's address book.

Endpoint

PUT /api/shop/customer-addresses/{addressId}

URL Parameters

ParameterTypeRequiredDescription
addressIdintegerYesAddress ID to update

Request Headers

HeaderRequiredDescription
Content-TypeYesapplication/json
X-STOREFRONT-KEYYesYour storefront API key
AuthorizationYesBearer token (customer login required)

Request Body

json
{
  "firstName": "Jane",
  "lastName": "Doe",
  "companyName": "Updated Corp.",
  "vatId": "DE987654321",
  "email": "[email protected]",
  "phone": "9876543210",
  "address1": "789 Pine Rd",
  "address2": "Suite 300",
  "city": "Los Angeles",
  "state": "CA",
  "country": "US",
  "postcode": "90002"
}

Request Parameters

ParameterTypeRequiredDescription
firstNamestringNoFirst name
lastNamestringNoLast name
companyNamestringNoCompany name
vatIdstringNoVAT identification number
emailstringNoEmail address
phonestringNoPhone number
address1stringNoStreet address line 1
address2stringNoStreet address line 2
citystringNoCity
statestringNoState/Province
countrystringNoCountry code
postcodestringNoPostal code
defaultAddressbooleanNoSet as default address

Response Fields (200 OK)

The response is the updated address itself, flat — there is no wrapper object and no message.

FieldTypeDescription
id / addressIdintegerAddress ID, returned under both keys.
firstName / lastNamestringName as stored after the update.
companyName / vatIdstringCompany details, null when unset.
email / phonestringContact details, null when unset.
address1 / address2stringStreet lines. Sent and echoed as address1; read endpoints return the same value as address.
country / state / city / postcodestringLocation as stored.
defaultAddressbooleanWhether this address is the customer's default.

Update Behaviour

  • The update is a partial patch — send only the fields that change; omitted fields keep their stored value.
  • country, state, and postcode are stored as sent and are not checked against the store's country list.
  • Setting defaultAddress: true clears the flag on whichever address held it before.
  • An address belonging to another customer answers 404, the same as an ID that does not exist.

Use Cases

  • Fix one field — post just {"city": "Boston"}; nothing else on the address is touched.
  • Promote an address to default — post {"defaultAddress": true}; the previous default is demoted in the same call.
  • Restore a default after deleting one — deleting the default promotes nothing, so set a new one explicitly here.

Best Practices

  • Do not resend the whole address to change one field — a partial body is enough, and a full resend risks overwriting a field the customer edited elsewhere.
  • Use address1, not address — an unrecognised key is ignored, so the street silently stays as it was.
  • Read 404 as "not yours or not there" — the endpoint gives no separate signal for another customer's address.

Released under the MIT License.