Skip to main content

Create Shipping Address

Adds one or more shipping addresses to a company. The request body is a JSON array of addresses.

HTTP Request​

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

Path Parameters​

ParameterTypeDescription
companyIdStringThe ID of the company to add the addresses to.

Request Body​

Send a JSON array with at least one address object.

FieldTypeRequiredDescription
address1StringYesAddress line 1.
cityStringYesCity.
stateStringYesState code, for example NY.
countryStringYesCountry code, for example US.
zipcodeStringYesPostal code.
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. See Metafields.

cURL Example​

curl --location '<BASE_URL>/shippingAddress/66b9b3b166169eecd60e5ba8' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '[
{
"firstName": "Maria",
"lastName": "Lopez",
"address1": "123 Maple St",
"address2": "Unit 4B",
"phoneNumber": "2125550198",
"city": "New York",
"state": "NY",
"country": "US",
"zipcode": "10001",
"isDefaultAddress": true
}
]'

Response​

  • 200 OK: The shipping addresses were added 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 added Successfully",
"data": [
{
"_id": "66d0f6973560dad7cf821e9a",
"id": "66d0f6973560dad7cf821e9a",
"company": "66b9b3b166169eecd60e5ba8",
"type": "shipping",
"firstName": "Maria",
"lastName": "Lopez",
"address1": "123 Maple St",
"address2": "Unit 4B",
"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-08-29T22:41:59.512Z"
}
]
}

Response Details​

FieldTypeDescription
successBooleanWhether the request succeeded.
messageStringResult message.
dataArrayThe new shipping addresses.

Shipping Address Data​

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

Notes​

  • When a new address is marked as default, the company's previous default shipping address is no longer the default.
  • To add billing addresses, use Add Addresses.