Update Warehouse
Updates an existing warehouse, including its address, shipping zones and stock levels.
HTTP Request
- URL:
/wareHouse/update/{id} - Method:
PUT - Headers:
accessToken: Required. Your API access token.Content-Type:application/json
- Required scope:
READ_WRITE_WAREHOUSE
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | String | Required. The ID of the warehouse to update. |
Request Body
The request body must be JSON and contain the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
inventory | Array | No | The full list of stock levels for the warehouse. See Create Warehouse. |
name | String | No | Name of the warehouse. |
country | String | No | Two-letter country code, for example US. |
address | Object | No | The full address of the warehouse. Same fields as in Create Warehouse. |
active | Boolean | No | Whether the warehouse is active. |
default | Boolean | No | Set to true to make this your store's default warehouse. |
shippingZones | Array | No | IDs of the shipping zones this warehouse serves. |
cURL Example
curl --location --request PUT '<BASE_URL>/wareHouse/update/6650c4b2e8a1f93d7c2b5e40' \
--header 'accessToken: <ACCESS_TOKEN>' \
--header 'Content-Type: application/json' \
--data '{
"name": "Chicago DC",
"inventory": [
{
"productId": "65b88ef5045a7d009e79974b",
"stock": 180,
"minStock": 25
}
]
}'
Response
- 200 OK: The request was processed. Check
successto confirm the warehouse was updated. - 400 Bad Request: The access token is missing or invalid, does not have the required scope, or the request body is not valid.
Sample JSON Response
{
"success": true,
"message": "WareHouse updated Successfully",
"data": {
"_id": "6650c4b2e8a1f93d7c2b5e40",
"id": "6650c4b2e8a1f93d7c2b5e40",
"name": "Chicago DC",
"country": {
"code": "US",
"name": "United States"
},
"active": true,
"default": false,
"address": {
"firstName": "Marcus",
"lastName": "Reyes",
"address1": "2400 S Western Ave",
"address2": "Dock 4",
"city": "Chicago",
"state": {
"code": "IL",
"name": "Illinois"
},
"country": {
"code": "US",
"name": "United States"
},
"zipcode": "60608"
},
"shippingZones": ["66d36af6d1fc2890ebc32e0b"],
"inventory": [
{
"_id": "6724e2b9a3c5d81f6b0e4c50",
"productId": "65b88ef5045a7d009e79974b",
"stock": 180,
"minStock": 25,
"variants": []
}
],
"metaFields": [],
"createdAt": "2024-05-24T16:47:14.302Z",
"updatedAt": "2024-11-01T15:30:08.771Z"
}
}
Response Details
| Field | Type | Description |
|---|---|---|
success | Boolean | Whether the warehouse was updated. |
message | String | Result message. |
data | Object | The updated warehouse. |
Warehouse Data
The warehouse fields are described in Get Single Warehouse.
Notes
- When
inventoryis sent, it replaces the warehouse's full stock list, so include every product you want to keep. Leave it out to keep the current stock. addressreplaces the full address, so send all address fields.- Your store must always have one default warehouse. To change it, set
defaulttotrueon the new default warehouse. - If no warehouse matches the ID,
successisfalseandmessageisWareHouse not found.