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
| Parameter | Type | Description |
|---|---|---|
companyId | String | The ID of the company to add the addresses to. |
Request Body
Send a JSON array with at least one address object.
| Field | Type | Required | Description |
|---|---|---|---|
address1 | String | Yes | Address line 1. |
city | String | Yes | City. |
state | String | Yes | State code, for example NY. |
country | String | Yes | Country code, for example US. |
zipcode | String | Yes | Postal code. |
firstName | String | No | First name of the contact. |
lastName | String | No | Last name of the contact. |
companyName | String | No | Company name shown on the address. |
companyEmail | String | No | Email address for the address. |
address2 | String | No | Address line 2. |
phoneNumber | String | No | Phone number of the contact. |
isDefaultAddress | Boolean | No | Make this the company's default shipping address. Only one item can be the default. |
metaFields | Array | No | Custom 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
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the request succeeded. |
message | String | Result message. |
data | Array | The 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.