Skip to main content

Update Warehouse

This PUT API allows you to update details of an existing warehouse including its address and inventory information. This endpoint supports specifying shipping zones and managing product inventory.

Endpoint Details

  • URL: /wareHouse/update/{warehouse_id}
  • Method: PUT
  • Authentication: Bearer Token (required)

Path Parameters

ParameterTypeDescription
warehouse_idstringThe unique identifier of the warehouse to be updated.

Authentication

You must provide a valid accessToken in the request headers to authenticate and access this endpoint.

Authentication Headers

HeaderTypeDescription
Content-TypestringMust be set to application/json.
accessTokenstringA valid access token is required.

Request Body

The request body should be in JSON format and must contain the following details to update the warehouse:

FieldTypeDescription
namestringName of the warehouse.
countrystringCountry code where the warehouse is located.
activebooleanIndicates if the warehouse is active.
defaultbooleanIndicates if this is the default warehouse.
addressobjectThe address details for the warehouse. See the address object structure below.
shippingZonesarrayList of shipping zone IDs associated with the warehouse.
inventoryarrayList of inventory items with product IDs, stock, minStock, and optional variant details.

Address Object (address)

The address object contains detailed address information:

FieldTypeDescription
firstNamestringFirst name of the contact person.
lastNamestringLast name of the contact person.
address1stringPrimary address line.
address2stringSecondary address line.
citystringCity where the warehouse is located.
statestringState code of the location.
countrystringCountry code.
zipcodestringPostal code of the warehouse.

Inventory Object (inventory[])

Each object in the inventory array represents a product's inventory details:

FieldTypeDescription
productIdstringThe unique identifier of the product.
stocknumberCurrent stock quantity of the product.
minStocknumberMinimum stock threshold for the product.
variantsarrayList of variant objects, each with a variant ID, stock, and minStock values.

Variant Object (variants[])

FieldTypeDescription
variantIdstringThe unique identifier of the product variant.
stocknumberCurrent stock quantity of the variant.
minStocknumberMinimum stock threshold for the variant.

Sample Request Body

{
"name": "New York Central Warehouse",
"country": "US",
"active": true,
"default": true,
"address": {
"firstName": "Alex",
"lastName": "Johnson",
"address1": "150 Main St",
"address2": "Suite 200",
"city": "New York",
"state": "NY",
"country": "US",
"zipcode": "10001"
},
"shippingZones": ["6ae3599858dec23921d0c089"],
"inventory": [
{
"productId": "76b4a11249e6ce3d41c428fa",
"stock": 0,
"minStock": 0,
"variants": [
{
"variantId": "76d5a286fcb786834cebb168",
"stock": 150,
"minStock": 10
}
]
},
{
"productId": "75b88ef6045a7d009e79cb6c",
"stock": 300,
"minStock": 30
}
]
}

Response

Success Response

Status CodeDescription
200 OKThe request was successful, and the warehouse details were updated.

Success Response Body Structure

FieldTypeDescription
successbooleanIndicates if the request was successful.
messagestringMessage indicating the result of the operation.
dataobjectContains the details of the updated warehouse.

Sample Response Body

{
"success": true,
"message": "Warehouse updated Successfully",
"data": {
"name": "New York Central Warehouse",
"country": "US",
"active": true,
"default": true,
"address": {
"firstName": "Alex",
"lastName": "Johnson",
"address1": "150 Main St",
"address2": "Suite 200",
"city": "New York",
"state": "NY",
"country": "US",
"zipcode": "10001"
},
"shippingZones": ["6ae3599858dec23921d0c089"],
"inventory": [
{
"productId": "76b4a11249e6ce3d41c428fa",
"stock": 200,
"minStock": 20,
"variants": [
{
"variantId": "76d5a286fcb786834cebb168",
"stock": 150,
"minStock": 10
}
]
},
{
"productId": "75b88ef6045a7d009e79cb6c",
"stock": 300,
"minStock": 30
}
],
"createdAt": "2024-01-10T12:00:00Z",
"updatedAt": "2024-01-12T12:00:00Z",
"id": "76b9b3b166169eecd60e5ba9"
}
}

Error Responses

Status CodeDescription
400 Bad RequestInvalid request format or missing data.
401 UnauthorizedInvalid or missing access token.
403 ForbiddenAccess denied.
404 Not FoundWarehouse not found.
500 Internal Server ErrorServer encountered an error.

Notes

  • Ensure that the warehouse_id in the URL matches the actual ID of the warehouse you wish to update.
  • Make sure that all required fields are included in the request body to avoid validation errors.
  • Use a valid access token for authentication to successfully update the warehouse details.