Skip to main content

Update Shipping Address

Updates existing shipping addresses of a company and adds new ones in the same request. Items with an id update that address. Items without an id are added as new addresses.

HTTP Request​

  • URL: /shippingAddress/{companyId}
  • Method: PUT
  • Headers:
    • accessToken: Required. Your API access token.
    • Content-Type: application/json
  • Required scope: READ_WRITE_COMPANY

Path Parameters​

ParameterTypeDescription
companyIdStringThe ID of the company that owns the addresses.

Request Body​

Send a JSON array with at least one address object.

FieldTypeRequiredDescription
idStringNoID of the shipping address to update. Leave out to add a new address.
address1StringNoAddress line 1. Required for new addresses.
cityStringNoCity. Required for new addresses.
stateStringNoState code, for example NY. Required for new addresses.
countryStringNoCountry code, for example US. Required for new addresses.
zipcodeStringNoPostal code. Required for new addresses.
firstNameStringNoFirst name of the contact.
lastNameStringNoLast name of the contact.
companyNameStringNoCompany name shown on the address.
companyEmailStringNoEmail address for the address.
address2StringNoAddress line 2.
phoneNumberStringNoPhone number of the contact.
isDefaultAddressBooleanNoMake this the company's default shipping address. Only one item can be the default.
metaFieldsArrayNoCustom field values as code and value. Replaces the current values.

cURL Example​

curl --location --request PUT '<BASE_URL>/shippingAddress/66b9b3b166169eecd60e5ba8' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '[
{
"id": "66d0f6973560dad7cf821e9a",
"address2": "Unit 5C",
"state": "NY",
"country": "US",
"isDefaultAddress": true
},
{
"firstName": "Jane",
"lastName": "Smith",
"address1": "456 Oak Ave",
"city": "Los Angeles",
"state": "CA",
"country": "US",
"zipcode": "90001"
}
]'

Response​

  • 200 OK: The shipping addresses were updated successfully.
  • 400 Bad Request: The access token is missing or invalid, the body is empty, a field is missing or not valid, or more than one address is marked as default.

Sample JSON Response​

{
"success": true,
"message": "Shipping Address Updated Successfully",
"data": [
{
"id": "66d0f6973560dad7cf821e9a",
"company": "66b9b3b166169eecd60e5ba8",
"type": "shipping",
"firstName": "Maria",
"lastName": "Lopez",
"address1": "123 Maple St",
"address2": "Unit 5C",
"phoneNumber": "2125550198",
"city": "New York",
"state": { "code": "NY", "name": "New York" },
"country": { "code": "US", "name": "United States" },
"zipcode": "10001",
"isDefaultAddress": true,
"status": true,
"metaFields": [],
"createdAt": "2024-08-29T22:41:59.512Z",
"updatedAt": "2024-10-09T13:05:59.036Z"
},
{
"id": "66f1a2b3c4d5e6f708192a3b",
"company": "66b9b3b166169eecd60e5ba8",
"type": "shipping",
"firstName": "Jane",
"lastName": "Smith",
"address1": "456 Oak Ave",
"city": "Los Angeles",
"state": { "code": "CA", "name": "California" },
"country": { "code": "US", "name": "United States" },
"zipcode": "90001",
"isDefaultAddress": false,
"status": true,
"metaFields": [],
"createdAt": "2024-10-09T13:05:59.040Z",
"updatedAt": "2024-10-09T13:05:59.040Z"
}
]
}

Response Details​

FieldTypeDescription
successBooleanWhether the request succeeded.
messageStringResult message.
dataArrayThe updated and new shipping addresses, in request order.

Shipping Address Data​

Each item in data has the same fields as the address returned by Get Address by ID.

Notes​

  • Items whose id does not match a shipping address of the company are skipped.
  • When an address is marked as default, the company's previous default shipping address is no longer the default.