Skip to main content

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​

ParameterTypeDescription
idStringRequired. The ID of the warehouse to update.

Request Body​

The request body must be JSON and contain the following fields:

FieldTypeRequiredDescription
inventoryArrayNoThe full list of stock levels for the warehouse. See Create Warehouse.
nameStringNoName of the warehouse.
countryStringNoTwo-letter country code, for example US.
addressObjectNoThe full address of the warehouse. Same fields as in Create Warehouse.
activeBooleanNoWhether the warehouse is active.
defaultBooleanNoSet to true to make this your store's default warehouse.
shippingZonesArrayNoIDs 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 success to 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​

FieldTypeDescription
successBooleanWhether the warehouse was updated.
messageStringResult message.
dataObjectThe updated warehouse.

Warehouse Data​

The warehouse fields are described in Get Single Warehouse.

Notes​

  • When inventory is 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.
  • address replaces the full address, so send all address fields.
  • Your store must always have one default warehouse. To change it, set default to true on the new default warehouse.
  • If no warehouse matches the ID, success is false and message is WareHouse not found.