Stock Correction POST

URI

https://{DATACENTER}.brightpearlconnect.com/public-api/{ACCOUNT}
/warehouse-service/warehouse/{ID}/stock-correction

Refer to our documentation on URI syntax for more information on how to construct URIs.

Description

Create stock corrections for a single warehouse. You can perform multiple corrections with a single request so the return value is the array of created stock correction note IDs.

Adding new stock against an archived product will set it to live automatically.


Request fields:

Field Data type Description Required?
corrections array Array of corrections to be made. Yes
corrections[].quantity integer Adjustment amount. If +ve increment by x, if -ve decrement by x. Yes
corrections[].productId integer ID of stock-tracked product affected by correction Yes
corrections[].reason string Reason for correction. Useful for auditing. Yes
corrections[].locationId integer When warehouse location's stock is being corrected. When using standard inventory management this value should be 2 Yes
corrections[].cost object Monetary value object of stock affected. Only when adding stock
corrections[].cost.currency string Currency for item-value of stock affected. See above
corrections[].cost.value number Amount for item-value of stock affected. See above
corrections[].batchId number The batch you wish to remove stock from. If not supplied FIFO rules will apply. No. Only applicable when decrementing stock, do not supply otherwise.
corrections[].orderId number You can supply an order ID as a reference if this stock correction relates to an order. No.

Example 1

Adding stock to multiple products: Add 166 of product 1010 to warehouse 2 at location 2 at a cost of 100.50 GBP. Add 76 of product 1012 to warehouse 2 at location 2 at a cost of 50.00 GBP.

Request URI

/warehouse/2/stock-correction

Request body

{
	"corrections": [
		{
			"quantity": 166,
			"productId": 1010,
			"reason": "Add stock to warehouse",
			"locationId": 2,
			"cost": {
				"currency": "GBP",
				"value": 100.50
			}
		},
		{
			"quantity": 76,
			"productId": 1012,
			"reason": "Add stock to warehouse",
			"locationId": 2,
			"cost": {
				"currency": "GBP",
				"value": 50.00
			}
		}
	]
}

Response

{
	"response": [
		43,
		44
	]
}

Example 2

Removing stock: Remove 166 of product 1010 from warehouse 2 at location 2 at a cost of 100.50 GBP.

Request URI

/warehouse/2/stock-correction

Request body

{
	"corrections": [
		{
			"quantity": -166,
			"productId": 1010,
			"reason": "Add stock to warehouse",
			"locationId": 2,
			"cost": {
				"currency": "GBP",
				"value": 100.50
			}
		}
	]
}

Response

{
	"response": [
		45
	]
}

Example 3

Removing stock which has insufficient availability at the requested location: Remove 166 of product ID 1009 from warehouse 2 at location ID 2 at a cost of 100.50GBP.

Request URI

/warehouse/2/stock-correction

Request body

{
	"corrections": [
		{
			"quantity": -166,
			"productId": 1009,
			"reason": "Remove stock to warehouse",
			"locationId": 2,
			"cost": {
				"currency": "GBP",
				"value": 100.50
			}
		}
	]
}

Response

{
	"errors": [
		{
			"code": "WHSB-067",
			"message": "Not enough on-hand availability of product 1009 in location 2 to accommodate the requested corrections."
		}
	]
}

Example 4

Removing stock from a particular batch Remove 1 of product ID 1010 from warehouse 2 at location ID 2 from batch ID 12 at a cost of 100.50GBP.

Request URI

/warehouse/2/stock-correction

Request body

{
	"corrections": [
		{
			"quantity": -166,
			"productId": 1010,
			"reason": "Add stock to warehouse",
			"locationId": 2,
			"cost": {
				"currency": "GBP",
				"value": 100.50
			},
			"batchId": 12
		}
	]
}

Response

{
	"response": [
		45
	]
}