Skip to main content

Inventory Management

Switchyard provides a hierarchical inventory location system designed for warehouse and retail operations.

Location Hierarchy

Inventory locations follow a 5-level hierarchy:
Zone > Aisle > Bay > Shelf > Slot
LevelDescriptionExample
ZoneMajor area of the warehouseA (Ambient), F (Frozen)
AisleNumbered pathway1, 2, 3
BaySection within an aisle1, 2, 3
ShelfVertical position in bay1 (bottom) to 5 (top)
SlotHorizontal position on shelf1 to 4

Location Code Format

Location codes follow the pattern: {Zone}{Aisle}-{Bay}-{Shelf}-{Slot} Examples:
  • A1-1-1-1 - Zone A, Aisle 1, Bay 1, Shelf 1, Slot 1
  • F2-3-4-2 - Zone F (Frozen), Aisle 2, Bay 3, Shelf 4, Slot 2

API Endpoints

List Inventory Groups

GET /admin/inventory-groups
Query parameters:
  • type - Filter by level type (zone, aisle, bay, shelf, slot)
  • parent_group_id - Filter by parent location

Get Location Details

GET /admin/inventory-groups/:id?include_ancestors_tree=true

Create Location

POST /admin/inventory-groups
Content-Type: application/json

{
  "name": "Bay 1",
  "type": "bay",
  "bay_number": 1,
  "parent_group_id": "aisle-uuid"
}

Inventory Items

Inventory items are tracked at the variant level with quantities per location.

Lookup by Barcode

GET /scanner/inventory/lookup?barcode=012345678901
Response:
{
  "product": {
    "id": "prod_123",
    "title": "Organic Bananas",
    "variants": [{
      "id": "var_456",
      "sku": "BAN-ORG-001",
      "barcode": "012345678901"
    }]
  },
  "inventory": {
    "location_id": "loc_789",
    "available_quantity": 24,
    "location_code": "A1-2-3-1"
  }
}

Update Inventory

POST /scanner/inventory/scan
Content-Type: application/json

{
  "barcode": "012345678901",
  "location_id": "loc_789",
  "quantity": 24,
  "action": "set"
}
Actions:
  • set - Set absolute quantity
  • increment - Add to current quantity
  • decrement - Subtract from current quantity

Permissions Required

ActionPermission
View inventoryinventory.read
Update quantitiesinventory.write
Scan operationsinventory.scan