Multi-inventory
Multi-inventory endpoints exposed under the Yep REST /api2 standard. They list active store warehouses, query and update stock distributed by warehouse (with automatic aggregation of the total) and read the warehouse breakdown inside order items.
Overview
When the multi-inventory feature is active on the store, Yep distributes each product's stock across multiple warehouses (physical store, main depot, distribution centers etc.). This page covers the four related REST API surfaces: Warehouses (warehouse registry), Stockitems (per-warehouse stock with automatic aggregation), Products (with stock_data.warehouses) and the impact on Orders (warehouses per order item).
{code: qty} or list [{code, qty}].General rules
Conventions shared by every multi-inventory endpoint. Base URL in examples: /api2. Protected endpoints require Authorization: Bearer {{token}} and Content-Type: application/json on POST/PATCH verbs.
- These endpoints are part of the multi-inventory feature and inherit OAuth authentication, deterministic pagination and the Yep REST response shape.
- Listings accept
page,limit,include_paginationand filters via query string or JSON body. - The
warehousesfield accepts two shapes: map{code: qty}(compact shortcut) or list[{code, qty}](more explicit; useful when the integration works with arrays). - When
warehousesis sent, the product's aggregated total stock is recalculated automatically by the module's model. There is no need to sendqtyseparately.
Warehouses
Store warehouse registry. By default, lists active warehouses only; use include_inactive=true for auditing or for integrations that need to see all of them.
List warehouses.
true, includes inactive warehouses. Default: active only.Paginated listing
GET /api2/warehouses?page=1&limit=50&include_pagination=1
Authorization: Bearer {{token}}
By code
GET /api2/warehouses?code=main_depot
Authorization: Bearer {{token}}
Sample response — single warehouse
{
"success": true,
"warehouse": {
"warehouse_id": 1,
"code": "main_depot",
"name": "Main depot",
"status": 1
}
}
Sample response — listing
{
"success": true,
"page": 1,
"limit": 50,
"total": 4,
"last_page": 1,
"has_next": false,
"warehouses": [
{"warehouse_id": 1, "code": "main_depot", "name": "Main depot", "status": 1},
{"warehouse_id": 2, "code": "store_sp", "name": "São Paulo", "status": 1},
{"warehouse_id": 3, "code": "store_rj", "name": "Rio store", "status": 1},
{"warehouse_id": 4, "code": "dc_north", "name": "DC North", "status": 0}
]
}
warehouses key. Lookup by id or single code uses the warehouse key.Stockitems
Query and update stock per warehouse. The response always includes a warehouses field with the breakdown per warehouse and the aggregated total qty.
List stock per warehouse.
Paginated listing
GET /api2/stockitems?page=1&limit=50&include_pagination=1
Authorization: Bearer {{token}}
By stock item ID
GET /api2/stockitems?id=456
Authorization: Bearer {{token}}
By product ID
GET /api2/stockitems?product_id=123
Authorization: Bearer {{token}}
By single SKU
GET /api2/stockitems?sku=PRODUCT-001
Authorization: Bearer {{token}}
By multiple SKUs (JSON body)
{
"sku": ["PRODUCT-001", "PRODUCT-002"],
"include_pagination": true
}
Sample response — single item
{
"success": true,
"stockitem": {
"item_id": 456,
"stock_item_id": 456,
"stock_id": 1,
"product_id": 123,
"sku": "PRODUCT-001",
"name": "Product 001",
"qty": 15,
"is_in_stock": 1,
"manage_stock": 1,
"use_config_manage_stock": 1,
"backorders": 0,
"min_qty": 0,
"min_sale_qty": 1,
"warehouses": {
"main_depot": 10,
"store_sp": 5
}
}
}
stockitems key; single lookups use stockitem. The qty field is the sum of per-warehouse quantities — recalculated automatically. The item_id and stock_item_id point to the same record and can be used interchangeably in queries and updates.Update per-warehouse stock. Identify the stock item with id, item_id or stock_item_id; or identify by product with product_id or sku. The endpoint also accepts POST for integrations that cannot send PATCH.
By stock item ID
PATCH /api2/stockitems
Authorization: Bearer {{token}}
Content-Type: application/json
{
"id": 456,
"warehouses": {
"main_depot": 10,
"store_sp": 5
}
}
By SKU (warehouses map)
PATCH /api2/stockitems
Authorization: Bearer {{token}}
Content-Type: application/json
{
"sku": "PRODUCT-001",
"warehouses": {
"main_depot": 10,
"store_sp": 5
}
}
Nested under stock_data with management flags
PATCH /api2/stockitems
Authorization: Bearer {{token}}
Content-Type: application/json
{
"product_id": 123,
"stock_data": {
"is_in_stock": 1,
"manage_stock": 1,
"warehouses": {
"main_depot": 10
}
}
}
Total recalculated automatically
When warehouses is sent, the aggregated qty is recalculated by the module's model. Do not send qty manually — it will be overridden by the sum of per-warehouse quantities.
Batch update — send an array of objects in the body. Each item follows the same rules as the simple PATCH. Accepts both warehouses shapes (map or list).
PATCH /api2/stockitems
Authorization: Bearer {{token}}
Content-Type: application/json
[
{
"sku": "PRODUCT-001",
"warehouses": {
"main_depot": 10
}
},
{
"sku": "PRODUCT-002",
"warehouses": [
{"code": "main_depot", "qty": 3},
{"code": "store_sp", "qty": 2}
]
}
]
[{code, qty}]) is especially useful for integrations that serialize data from a relational database (one row per warehouse).Warehouses inside Products
When the multi-inventory feature is active, the Products endpoints start including stock_data.warehouses in the responses, preserving compatibility with the stock_data semantics already consumed by catalog integrations.
GET /api2/products?type=sku&id=PRODUCT-001
Authorization: Bearer {{token}}
GET /api2/products?page=1&limit=50&include_pagination=1
Authorization: Bearer {{token}}
{
"success": true,
"product": {
"product_id": 123,
"sku": "PRODUCT-001",
"name": "Product 001",
"stock_data": {
"qty": 15,
"is_in_stock": 1,
"warehouses": {
"main_depot": 10,
"store_sp": 5
}
}
}
}
stock_data.warehouses simply does not appear in the response — existing integrations continue to work without changes.Warehouses inside order items
When the multi-inventory feature is active, the Orders endpoints include a warehouses field inside each item of the response — indicating which warehouses fulfilled each quantity.
GET /api2/order?id=100
Authorization: Bearer {{token}}
{
"success": true,
"order": {
"order_id": 100,
"increment_id": "100000100",
"items": [
{
"item_id": 10,
"sku": "PRODUCT-001",
"qty_ordered": 2,
"warehouses": {
"main_depot": 2
}
}
]
}
}
/api/rest/orders in multi-inventory environments. When the module is inactive, the warehouses field simply does not appear in items.Supported usage patterns
Tested and certified combinations for the multi-inventory API.
GET /api2/warehouses?include_pagination=1GET /api2/warehouses?include_inactive=trueGET /api2/warehouses?code=main_depotGET /api2/stockitems?id=456GET /api2/stockitems?sku=PRODUCT-001GET /api2/stockitems?sku=PRODUCT-001,PRODUCT-002PATCH /api2/stockitems + id: 456PATCH /api2/stockitems + warehouses: {code: qty}PATCH /api2/stockitems + warehouses: [{code, qty}]PATCH /api2/stockitems + array of objectsGET /api2/products?type=sku&id=PRODUCT-001Integration recommendations
Recommended
- Cache the listing of
/api2/warehouses— the registry rarely changes, and every stock call can reuse the list. - Use the list shape (
[{code, qty}]) when the integration serializes data from a relational database; use the map shape ({code: qty}) when the data already arrives as a dictionary. - For high-volume syncs, prefer the batch PATCH — it minimizes auth and logging overhead.
- Read
warehousesfrom order items to feed your OMS/WMS with which warehouse fulfills each line.
Avoid
- Sending the total
qtytogether withwarehouses— the total will be overridden by the module's recalculation. - Using non-ASCII characters in warehouse codes for environments that serialize URLs — prefer slugs (
main_depotrather thanDepósito Padrão). - Updating warehouses in a loop (1 PATCH per SKU) when the batch already covers it — generates contention on the aggregated stock.
Incremental sync
For periodic WMS syncs, combine GET /api2/warehouses (cached for 24h) + batch PATCH /api2/stockitems on each delta window. This pattern drastically reduces the number of calls and keeps the aggregated stock consistent.
Common errors
| Status | Sample body | When it happens |
|---|---|---|
400 | {"error": "Invalid warehouse code"} | warehouses contains a code that does not exist in the registry. |
400 | {"error": "Invalid quantity"} | Non-numeric or negative quantity in some warehouse. |
400 | {"error": "Module not active"} | The multi-inventory feature is not enabled in the environment. |
401 | {"error": "Unauthorized"} | Missing Authorization or expired token. |
404 | {"error": "Warehouse not found"} | Unknown warehouse_id or code. |
404 | {"error": "Product not found"} | Unknown product_id or sku. |
409 | {"error": "Conflict on save"} | Duplicate or deadlock on concurrent writes. |