Skip to main content

Add Addresses

Adds one or more addresses to a company. The request body is a JSON array, and each item can be a billing or a shipping address.

HTTP Request​

  • URL: /address/company/{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
typeStringNoshipping or billing. Default is shipping.
address1StringYesAddress line 1.
cityStringYesCity.
stateStringYesState code, for example NJ.
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 default address of its type. Only one per type.
metaFieldsArrayNoCustom field values as code and value. See Metafields.

cURL Example​

curl --location '<BASE_URL>/address/company/66b9b3b166169eecd60e5ba8' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '[
{
"type": "shipping",
"firstName": "John",
"lastName": "Doe",
"address1": "3700 Old Seward Hwy",
"city": "Anchorage",
"state": "AK",
"country": "US",
"zipcode": "99503",
"isDefaultAddress": true
},
{
"type": "billing",
"companyName": "Keystone Building Supply",
"address1": "102 East Green Milton Road",
"city": "Elizabeth",
"state": "NJ",
"country": "US",
"zipcode": "07202"
}
]'

Response​

  • 200 OK: The 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 of the same type is marked as default.

Sample JSON Response​

{
"success": true,
"message": "Addresses added successfully",
"data": [
{
"id": "66b9b3b166169eecd60e5baa",
"company": "66b9b3b166169eecd60e5ba8",
"type": "shipping",
"firstName": "John",
"lastName": "Doe",
"address1": "3700 Old Seward Hwy",
"city": "Anchorage",
"state": { "code": "AK", "name": "Alaska" },
"country": { "code": "US", "name": "United States" },
"zipcode": "99503",
"isDefaultAddress": true,
"status": true,
"metaFields": [],
"createdAt": "2024-08-23T13:27:13.715Z",
"updatedAt": "2024-08-23T13:27:13.715Z"
},
{
"id": "66b9b3b166169eecd60e5bab",
"company": "66b9b3b166169eecd60e5ba8",
"type": "billing",
"companyName": "Keystone Building Supply",
"address1": "102 East Green Milton Road",
"city": "Elizabeth",
"state": { "code": "NJ", "name": "New Jersey" },
"country": { "code": "US", "name": "United States" },
"zipcode": "07202",
"isDefaultAddress": false,
"status": true,
"metaFields": [],
"createdAt": "2024-08-23T13:27:13.715Z",
"updatedAt": "2024-08-23T13:27:13.715Z"
}
]
}

Response Details​

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

Address Data​

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

Notes​

  • When an address is marked as default, the company's previous default address of that type is no longer the default.