Haravan — Inventory
Get stock levels — haravan.get_inventory_levels
Stock on hand of given variants at given locations. Get location ids from list_locations and variant ids from list_variants or get_product.
| Side effect | Risk | Needs approval | Idempotent | Scopes |
|---|---|---|---|---|
| NONE | low | no | yes | com.read_inventories |
Input
| Field | Type | Required | Description |
|---|---|---|---|
variant_ids | string | yes | Comma-separated variant ids. Pattern: ^\d+(,\d+)*$. |
location_ids | string | yes | Comma-separated location ids. Pattern: ^\d+(,\d+)*$. |
Extra fields: ignored.
Output
| Field | Type | Description |
|---|---|---|
inventory_locations | array of object | Stock per variant and location. |
inventory_locations[].id | integer | Inventory record id. |
inventory_locations[].loc_id | integer | Location id; matches list_locations. |
inventory_locations[].product_id | integer | Product id. |
inventory_locations[].variant_id | integer | Variant id. |
inventory_locations[].qty_onhand | number | Quantity physically in stock; can be negative. |
inventory_locations[].qty_commited | number | Quantity reserved by orders. |
inventory_locations[].qty_incoming | number | Quantity on its way to this location. |
inventory_locations[].qty_available | number | Quantity available for sale; can be negative. |
inventory_locations[].updated_at | string | When it was last updated (ISO 8601). |
Adjust stock — haravan.adjust_inventory
Add to (adjust) or overwrite (set) stock at one location.
| Side effect | Risk | Needs approval | Idempotent | Scopes |
|---|---|---|---|---|
| WRITE | medium | yes | no | com.write_inventories |
Input
| Field | Type | Required | Description |
|---|---|---|---|
inventory | object | yes | The adjustment. |
inventory.location_id | integer | yes | Location id from list_locations. |
inventory.type | string | no | adjust adds to stock; set overwrites it. One of: adjust, set. |
inventory.reason | string | no | Reason: newproduct, returned, productionofgoods, damaged, shrinkage, promotion. One of: newproduct, returned, productionofgoods, damaged, shrinkage, promotion. |
inventory.note | string | no | Note. |
inventory.line_items | array of object | yes | Up to 200 items: product_id, product_variant_id, quantity. |
inventory.line_items[].product_id | integer | yes | Product id. |
inventory.line_items[].product_variant_id | integer | yes | Variant id. |
inventory.line_items[].quantity | integer | yes | Quantity. |
Extra fields: ignored.
Output
| Field | Type | Description |
|---|---|---|
inventory | object | The adjustment. |
inventory.id | integer | Adjustment id. |
inventory.created_at | string | When it was created (ISO 8601). |
inventory.updated_at | string | When it was last updated (ISO 8601). |
inventory.adjust_number | string | Adjustment number, e.g. IA100017. |
inventory.tran_date | string | When the stock changed (ISO 8601). |
inventory.location_id | integer | Location id; matches list_locations. |
inventory.type | string | null | adjust adds to stock, set overwrites it; null in list replies and absent from the reply of adjust_inventory. |
inventory.reason | string | newproduct, returned, productionofgoods, damaged, shrinkage or promotion. |
inventory.total_quantity | number | Total quantity of this adjustment. |
inventory.note | string | null | Note. |
inventory.total_cost | number | Total cost of the adjusted stock, VND. |
inventory.tags | string | null | Comma-separated tags. |
inventory.line_items | array of object | Adjusted variants. |
inventory.line_items[].id | integer | Line item id. |
inventory.line_items[].product_id | integer | Product id. |
inventory.line_items[].product_variant_id | integer | Variant id. |
inventory.line_items[].quantity | number | Quantity; negative when stock was removed. |
inventory.line_items[].sku | string | null | SKU of the variant. |
inventory.line_items[].barcode | string | null | Barcode of the variant. |
inventory.line_items[].cost_amount | number | Cost of this line, VND. |
List stock adjustments — haravan.list_inventory_adjustments
List past stock adjustments.
| Side effect | Risk | Needs approval | Idempotent | Scopes |
|---|---|---|---|---|
| NONE | low | no | yes | com.read_inventories |
Input
| Field | Type | Required | Description |
|---|---|---|---|
created_at_min | string | no | Created at or after (ISO 8601). |
created_at_max | string | no | Created at or before (ISO 8601). |
page | integer | no | Page number, from 1. Min 1. |
limit | integer | no | Items per page (1-50, default 50). Min 1. Max 50. |
Extra fields: ignored.
Output
| Field | Type | Description |
|---|---|---|
adjustments | array of object | Adjustments. |
adjustments[].id | integer | Adjustment id. |
adjustments[].created_at | string | When it was created (ISO 8601). |
adjustments[].updated_at | string | When it was last updated (ISO 8601). |
adjustments[].adjust_number | string | Adjustment number, e.g. IA100017. |
adjustments[].tran_date | string | When the stock changed (ISO 8601). |
adjustments[].location_id | integer | Location id; matches list_locations. |
adjustments[].type | string | null | adjust adds to stock, set overwrites it; null in list replies and absent from the reply of adjust_inventory. |
adjustments[].reason | string | newproduct, returned, productionofgoods, damaged, shrinkage or promotion. |
adjustments[].total_quantity | number | Total quantity of this adjustment. |
adjustments[].note | string | null | Note. |
adjustments[].total_cost | number | Total cost of the adjusted stock, VND. |
adjustments[].tags | string | null | Comma-separated tags. |
adjustments[].line_items | array of object | Adjusted variants. |
adjustments[].line_items[].id | integer | Line item id. |
adjustments[].line_items[].product_id | integer | Product id. |
adjustments[].line_items[].product_variant_id | integer | Variant id. |
adjustments[].line_items[].quantity | number | Quantity; negative when stock was removed. |
adjustments[].line_items[].sku | string | null | SKU of the variant. |
adjustments[].line_items[].barcode | string | null | Barcode of the variant. |
adjustments[].line_items[].cost_amount | number | Cost of this line, VND. |
List stock transfers — haravan.list_inventory_transfers
List stock transfers between locations.
| Side effect | Risk | Needs approval | Idempotent | Scopes |
|---|---|---|---|---|
| NONE | low | no | yes | com.read_inventories |
Input
| Field | Type | Required | Description |
|---|---|---|---|
created_at_min | string | no | Created at or after (ISO 8601). |
created_at_max | string | no | Created at or before (ISO 8601). |
page | integer | no | Page number, from 1. Min 1. |
limit | integer | no | Items per page (1-50, default 50). Min 1. Max 50. |
Extra fields: ignored.
Output
| Field | Type | Description |
|---|---|---|
transfers | array of object | Transfers. |
transfers[].id | integer | Transfer id. |
transfers[].transfer_number | string | Transfer number, e.g. IT100001. |
transfers[].from_loc_id | integer | Source location id. |
transfers[].to_loc_id | integer | Destination location id. |
transfers[].reason | string | newproduct, returned, productionofgoods, damaged, shrinkage or promotion. |
transfers[].tran_date | string | When the transfer was made (ISO 8601). |
transfers[].note | string | null | Note. |
transfers[].total | number | Total quantity transferred. |
transfers[].created_at | string | When it was created (ISO 8601). |
transfers[].updated_at | string | When it was last updated (ISO 8601). |
transfers[].status | string | Transfer status, e.g. Active or Received. |
transfers[].actived_at | string | When the transfer was activated (ISO 8601). |
transfers[].received_at | string | null | When it was received (ISO 8601). |
transfers[].created_user | integer | Staff id who created the transfer. |
transfers[].received_user | integer | null | Staff id who received it; null if not yet. |
transfers[].tags | string | null | Comma-separated tags. |
transfers[].line_items | array of object | Transferred variants. |
transfers[].line_items[].id | integer | Line item id. |
transfers[].line_items[].product_id | integer | Product id. |
transfers[].line_items[].product_variant_id | integer | Variant id. |
transfers[].line_items[].quantity | number | Quantity; negative when stock was removed. |
transfers[].line_items[].sku | string | null | SKU of the variant. |
transfers[].line_items[].barcode | string | null | Barcode of the variant. |
transfers[].line_items[].variant_title | string | null | Variant title. |
transfers[].line_items[].product_name | string | Product name. |
Create stock transfer — haravan.create_inventory_transfer
Move stock from one location to another.
| Side effect | Risk | Needs approval | Idempotent | Scopes |
|---|---|---|---|---|
| WRITE | medium | yes | no | com.write_inventories |
Input
| Field | Type | Required | Description |
|---|---|---|---|
transfer | object | yes | The transfer. |
transfer.from_loc_id | integer | yes | Source location id. |
transfer.to_loc_id | integer | yes | Destination location id. |
transfer.reason | string | no | Reason: newproduct, returned, productionofgoods, damaged, shrinkage, promotion. One of: newproduct, returned, productionofgoods, damaged, shrinkage, promotion. |
transfer.note | string | no | Note. |
transfer.line_items | array of object | yes | Up to 200 items: product_id, product_variant_id, quantity. |
transfer.line_items[].product_id | integer | yes | Product id. |
transfer.line_items[].product_variant_id | integer | yes | Variant id. |
transfer.line_items[].quantity | integer | yes | Quantity. |
Extra fields: ignored.
Output
| Field | Type | Description |
|---|---|---|
transfer | object | The transfer. |
transfer.id | integer | Transfer id. |
transfer.transfer_number | string | Transfer number, e.g. IT100001. |
transfer.from_loc_id | integer | Source location id. |
transfer.to_loc_id | integer | Destination location id. |
transfer.reason | string | newproduct, returned, productionofgoods, damaged, shrinkage or promotion. |
transfer.tran_date | string | When the transfer was made (ISO 8601). |
transfer.note | string | null | Note. |
transfer.total | number | Total quantity transferred. |
transfer.created_at | string | When it was created (ISO 8601). |
transfer.updated_at | string | When it was last updated (ISO 8601). |
transfer.status | string | Transfer status, e.g. Active or Received. |
transfer.actived_at | string | When the transfer was activated (ISO 8601). |
transfer.received_at | string | null | When it was received (ISO 8601). |
transfer.created_user | integer | Staff id who created the transfer. |
transfer.received_user | integer | null | Staff id who received it; null if not yet. |
transfer.tags | string | null | Comma-separated tags. |
transfer.line_items | array of object | Transferred variants. |
transfer.line_items[].id | integer | Line item id. |
transfer.line_items[].product_id | integer | Product id. |
transfer.line_items[].product_variant_id | integer | Variant id. |
transfer.line_items[].quantity | number | Quantity; negative when stock was removed. |
transfer.line_items[].sku | string | null | SKU of the variant. |
transfer.line_items[].barcode | string | null | Barcode of the variant. |
transfer.line_items[].variant_title | string | null | Variant title. |
transfer.line_items[].product_name | string | Product name. |
Receive stock transfer — haravan.receive_inventory_transfer
Mark a stock transfer as received at the destination.
| Side effect | Risk | Needs approval | Idempotent | Scopes |
|---|---|---|---|---|
| WRITE | medium | yes | no | com.write_inventories |
Input
| Field | Type | Required | Description |
|---|---|---|---|
transfer_id | integer | yes | Transfer id. Min 1. |
transfer | object | no | Who received it. |
transfer.user_id | integer | no | Staff id. |
Extra fields: ignored.
Output
| Field | Type | Description |
|---|---|---|
transfer | object | The transfer. |
transfer.id | integer | Transfer id. |
transfer.transfer_number | string | Transfer number, e.g. IT100001. |
transfer.from_loc_id | integer | Source location id. |
transfer.to_loc_id | integer | Destination location id. |
transfer.reason | string | newproduct, returned, productionofgoods, damaged, shrinkage or promotion. |
transfer.tran_date | string | When the transfer was made (ISO 8601). |
transfer.note | string | null | Note. |
transfer.total | number | Total quantity transferred. |
transfer.created_at | string | When it was created (ISO 8601). |
transfer.updated_at | string | When it was last updated (ISO 8601). |
transfer.status | string | Transfer status, e.g. Active or Received. |
transfer.actived_at | string | When the transfer was activated (ISO 8601). |
transfer.received_at | string | null | When it was received (ISO 8601). |
transfer.created_user | integer | Staff id who created the transfer. |
transfer.received_user | integer | null | Staff id who received it; null if not yet. |
transfer.tags | string | null | Comma-separated tags. |
transfer.line_items | array of object | Transferred variants. |
transfer.line_items[].id | integer | Line item id. |
transfer.line_items[].product_id | integer | Product id. |
transfer.line_items[].product_variant_id | integer | Variant id. |
transfer.line_items[].quantity | number | Quantity; negative when stock was removed. |
transfer.line_items[].sku | string | null | SKU of the variant. |
transfer.line_items[].barcode | string | null | Barcode of the variant. |
transfer.line_items[].variant_title | string | null | Variant title. |
transfer.line_items[].product_name | string | Product name. |