Inventory Adjustment
Version: 1.0
You can track inventory adjustment history in your shop. Alternatively, you can use it to change the available quantity of an inventory item at a single location.
Authenticated access scopes: com.read_inventories, com.write_inventories
What you can do with Inventory Adjustment
The Haravan API lets you do the following with the Inventory Adjustment resource.
- GET
https://apis.haravan.com/com/inventories/adjustments.json - GET
https://apis.haravan.com/com/inventories/adjustments/count.json - GET
https://apis.haravan.com/com/inventories/adjustments/{inventory_adjustment_id}.json - POST
https://apis.haravan.com/com/inventories/adjustorset.json
Properties
id : number
"id": 1206854680
A unique identifier for the inventory adjustment.
created_at : string
"created_at": "2021-05-13T07:29:20.1Z"
The date and time (ISO 8601 format) when the inventory adjustment was created.
updated_at : string
"updated_at":"2021-05-13T07:29:20.808Z"
The date and time (ISO 8601 format) when the inventory adjustment was last updated.
adjust_number : string
"adjust_number":"IA100017"
The number of inventory adjustments.
tran_date : string
"tran_date": "2021-05-13T07:29:20.079Z"
The date and time (ISO 8601 format) when the inventory adjustment was changed.
location_id : number
"location_id": 963414
The ID of the inventory. You can get location information at the Location API.
type : string
"type": "adjust"
Valid values are: adjust, set.
adjust: add the new quantity with the old quantity.
set: override the new quantity with the old quantity.
if the type was not transferred, the default type is "adjust".
reason : array
"reason": "newproduct"
Valid values are: newproduct , returned , productionofgoods , damaged , shrinkage , promotion .
newproduct: New product. returned: Refund product. productionofgoods: Produce more products. damaged: Damanged. shrinkage: Loss. promotion: Promotion. transfer: Transfer.
if the type was not transferred, the default type is "newproduct".
total_quantity : number
"total_quantity": 50000
The quantity products of this inventory adjustment.
note : string
"note": "hàng hư hỏng do nhà sản xuất"
A note about the inventory adjustment.
total_cost : number
"total_cost": 150000000000.00
Total amount cost product of the inventory adjustment.
tags : string
"tags": "Hư hỏng"
Tags that the shop owner has attached to the inventory adjustment, formatted as a string of comma-separated values.
line_items : array
Details
"line_items": [
{
"id": 1116232509,
"product_id": 1031046355,
"product_variant_id": 1068095306,
"quantity": 50000,
"cost_amount": 150000000000.00,
"sku": "IPOD123",
"barcode": "123_pink"
}
]
Best supports 200 items for a request.
id: A unique identifier for the item in this line item.
product_id: A unique identifier for this product.
product_variant_id: A unique identifier for this product variant.
quantity: The number of the item for this product variant.
sku: A unique identifier for this product variant.
barcode: The barcode, UPC, or ISBN number for this product.
Retrieves a list of inventory adjustments.
Retrieves a list of inventory adjustments. You can filter resources by params.
Parameters
limit
Limit of the result.
page
Page to show the result.
since_id
Restrict results to after the specified ID.
location_id
Filter result by the specified location ID.
Retrieve all of the resources of the inventory adjustment by page number. By default, the number of resources on the page is 50.
- GET
https://apis.haravan.com/com/inventories/adjustments.json?page=1
Details
HTTP/1.1 200 OK
{
"adjustments": [
{
"id": 1206854680,
"created_at": "2021-05-13T07:29:20.1Z",
"updated_at": "2021-05-13T07:29:20.808Z",
"adjust_number": "IA100017",
"tran_date": "2021-05-13T07:29:20.079Z",
"location_id": 1007284,
"type": null,
"total_quantity": 1,
"reason": "damaged",
"note": null,
"total_cost": 1000000.00,
"tags": null,
"line_items": [
{
"id": 1124119453,
"product_id": 1032963075,
"product_variant_id": 1072106808,
"quantity": -11,
"cost_amount": -11000000.00,
"sku": null,
"barcode": null
}
]
},
{
"id": 1186433005,
"created_at": "2021-03-03T14:52:13.548Z",
"updated_at": "2021-03-03T14:52:13.6Z",
"adjust_number": "IA100016",
"tran_date": "2021-03-03T14:52:13.519Z",
"location_id": 963414,
"type": null,
"total_quantity": 50000,
"reason": "productionofgoods",
"note": null,
"total_cost": 150000000000.00,
"tags": null,
"line_items": [
{
"id": 1116232509,
"product_id": 1031046355,
"product_variant_id": 1068095306,
"quantity": 50000,
"cost_amount": 150000000000.00,
"sku": null,
"barcode": null
}
]
}
]
}
Retrieve resources of the inventory adjustment by location id.
- GET
https://apis.haravan.com/com/inventories/adjustments.json?location_id=963414
Details
HTTP/1.1 200 OK
{
"adjustments": [
{
"id": 1206854680,
"created_at": "2021-05-13T07:29:20.1Z",
"updated_at": "2021-05-13T07:29:20.808Z",
"adjust_number": "IA100017",
"tran_date": "2021-05-13T07:29:20.079Z",
"location_id": 963414,
"type": null,
"total_quantity": 1,
"reason": "damaged",
"note": null,
"total_cost": 1000000.00,
"tags": null,
"line_items": [
{
"id": 1124119453,
"product_id": 1032963075,
"product_variant_id": 1072106808,
"quantity": -11,
"cost_amount": -11000000.00,
"sku": null,
"barcode": null
}
]
},
{
"id": 1186433005,
"created_at": "2021-03-03T14:52:13.548Z",
"updated_at": "2021-03-03T14:52:13.6Z",
"adjust_number": "IA100016",
"tran_date": "2021-03-03T14:52:13.519Z",
"location_id": 963414,
"type": null,
"total_quantity": 50000,
"reason": "productionofgoods",
"note": null,
"total_cost": 150000000000.00,
"tags": null,
"line_items": [
{
"id": 1116232509,
"product_id": 1031046355,
"product_variant_id": 1068095306,
"quantity": 50000,
"cost_amount": 150000000000.00,
"sku": null,
"barcode": null
}
]
}
]
}
Retrieve a count of the inventory adjustments.
Retrieve the count of resources of the inventory adjustment.
- GET
https://apis.haravan.com/com/inventories/adjustments/count.json
Details
HTTP/1.1 200 OK
{
"count": 2
}
Retrieves single the inventory adjustments.
Retrieves single the inventory adjustment.
- GET
https://apis.haravan.com/com/inventories/adjustments/1186432974.json
Details
HTTP/1.1 200 OK
{
"adjustment": {
"id": 1186432974,
"created_at": "2021-03-03T14:50:47.016Z",
"updated_at": "2021-03-03T14:50:47.989Z",
"adjust_number": "IA100015",
"tran_date": "2021-03-03T14:50:47.001Z",
"location_id": 963414,
"type": null,
"total_quantity": 1,
"reason": "productionofgoods",
"note": null,
"total_cost": 3000000.00,
"tags": null,
"line_items": [
{
"id": 1116232425,
"product_id": 1031046355,
"product_variant_id": 1068095306,
"quantity": 1,
"cost_amount": 3000000.00,
"sku": null,
"barcode": null
}
]
}
}
Create an inventory adjustment.
Create an inventory adjustment.
- POST
https://apis.haravan.com/com/inventories/adjustorset.json
{
"inventory": {
"location_id": 84201,
"type": "adjust",
"reason": "newproduct",
"note": "update from api",
"line_items": [
{
"product_id": 1045244627,
"product_variant_id": 1099983464,
"quantity": 2
},
{
"product_id": 1054720936,
"product_variant_id": 1123302792,
"quantity": 3
}
]
}
}
Details
HTTP/1.1 201 Created
{
"inventory": {
"id": 3181006434,
"created_at": "2026-09-10T11:06:06.0693375Z",
"updated_at": "2026-09-10T11:06:06.0693411Z",
"adjust_number": "IA102603",
"tran_date": "2026-09-10T11:06:06.0688141Z",
"location_id": 84201,
"total_quantity": 5,
"reason": "newproduct",
"note": "update from api",
"total_cost": 0.0,
"tags": null,
"line_items": [
{
"id": 10120270460,
"product_id": 1054720936,
"product_variant_id": 1123302792,
"quantity": 3,
"cost_amount": 0.0,
"sku": "100196571003_3ATSE0143",
"barcode": "8809947352072"
},
{
"id": 10120270461,
"product_id": 1045244627,
"product_variant_id": 1099983464,
"quantity": 2,
"cost_amount": 0.0,
"sku": "456",
"barcode": "AAAHHHH"
}
]
}
}
The API best supports arrays of 100 items per request.
The following table describes the possible responses from the Create an Inventory Adjustment API:
| HTTP Status | Description |
|---|---|
| 201 | Inventory adjustment completed successfully. The variants whose inventory was updated are returned in the response. |
| 200 | The system detected that the inventory quantity of the variant(s) has not changed, so no inventory update is required. This should be treated as a successful request. |
| 422 | The request contains invalid information. |
| 429 | The API call limit has been exceeded. The client should wait and retry. |
| 5xx | The system is temporarily unavailable or has encountered a server-side error. The client should wait and retry. |
| Connection Timeout | The client did not receive a response within the configured timeout period. The client should wait and retry. |
HTTP Status 422 – Unprocessable Entity
- The API returns HTTP status 422 Unprocessable Entity when the request contains invalid data.
- The system stops processing when invalid data is detected. A common cause is an invalid or non-existent
product_idorvariant_id. - For requests containing multiple variants, only one invalid variant is sufficient for the system to stop processing the request; the remaining variants are not checked or processed.
Invalid Inventory Location
HTTP/1.1 422 Unprocessable Entity
{
"errors": "Kho điều chỉnh không hợp lệ"
}
Invalid Product
HTTP/1.1 422 Unprocessable Entity
{
"errors": "Sản phẩm không hợp lệ"
}
Invalid Variant
HTTP/1.1 422 Unprocessable Entity
{
"errors": "Biến thể không hợp lệ"
}
Invalid Data
HTTP/1.1 422 Unprocessable Entity
{
"errors": "Dữ liệu không hợp lệ"
}
Invalid quantity : When type = "adjust", the quantity of each line_items must not be 0
HTTP/1.1 422 Unprocessable Entity
{
"errors": "Số lượng sản phẩm không hợp lệ"
}
Inventory Management Limitations
Inventory updates through the Inventory Adjustment API are currently not supported for the following product types:
- Shops using Basic Inventory Management mode
- Products managed by Lot/Date
- Combo products
- Products with fractional inventory quantities (decimal quantities)
For these product types, inventory adjustments should be performed through the Admin interface instead of using the Inventory Adjustment API.