{
  "info": {
    "_postman_id": "a1b2c3d4-e5f6-7890-abcd-1234567890ab",
    "name": "Inventra API",
    "description": "Complete Postman collection for the Inventra Inventory Management API v1.\n\nAuthentication: Bearer token in Authorization header.\nSet {{apiKey}} in your environment to your API key.\nSet {{baseUrl}} to https://your-org.inventra.io/api/v1\n\nFolders:\n- Products & Variants\n- Inventory (levels, adjustments, ledger)\n- Orders\n- Purchase Orders\n- Stock Transfers\n- Suppliers\n- Locations\n- Cycle Counts\n- Returns / RMA\n- Inventory Policies\n- Reports\n- Production Batches (manufacturing)\n- Traceability (lots, waste, expiry)\n- AI",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      { "key": "token", "value": "{{apiKey}}", "type": "string" }
    ]
  },
  "variable": [
    { "key": "baseUrl", "value": "https://your-org.inventra.io/api/v1", "type": "string" }
  ],
  "item": [
    {
      "name": "Products",
      "item": [
        {
          "name": "List Products",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/products?page=1&per_page=25&search=",
              "host": ["{{baseUrl}}"],
              "path": ["products"],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" },
                { "key": "search", "value": "", "description": "Filter by name or SKU" }
              ]
            }
          }
        },
        {
          "name": "Get Product",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/products/:id",
              "host": ["{{baseUrl}}"],
              "path": ["products", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Create Product",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"product\": {\n    \"name\": \"Classic T-Shirt\",\n    \"description\": \"100% cotton unisex t-shirt\",\n    \"category\": \"Apparel\",\n    \"brand\": \"Inventra Basics\"\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/products",
              "host": ["{{baseUrl}}"],
              "path": ["products"]
            }
          }
        },
        {
          "name": "Update Product",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"product\": {\n    \"name\": \"Classic T-Shirt v2\",\n    \"description\": \"Updated description\"\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/products/:id",
              "host": ["{{baseUrl}}"],
              "path": ["products", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        }
      ]
    },
    {
      "name": "Variants",
      "item": [
        {
          "name": "List Variants for Product",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/products/:product_id/variants?page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["products", ":product_id", "variants"],
              "variable": [{ "key": "product_id", "value": "1" }],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Variant",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/variants/:id",
              "host": ["{{baseUrl}}"],
              "path": ["variants", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Create Variant",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"variant\": {\n    \"sku\": \"TSHIRT-BLK-M\",\n    \"barcode\": \"1234567890123\",\n    \"option1\": \"Black\",\n    \"option2\": \"M\",\n    \"price\": \"29.99\",\n    \"cost_price\": \"12.00\",\n    \"weight\": \"0.3\"\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/products/:product_id/variants",
              "host": ["{{baseUrl}}"],
              "path": ["products", ":product_id", "variants"],
              "variable": [{ "key": "product_id", "value": "1" }]
            }
          }
        },
        {
          "name": "Update Variant",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"variant\": {\n    \"price\": \"34.99\",\n    \"cost_price\": \"13.50\"\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/variants/:id",
              "host": ["{{baseUrl}}"],
              "path": ["variants", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Lookup Variant by Barcode",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/variants/barcode/:barcode",
              "host": ["{{baseUrl}}"],
              "path": ["variants", "barcode", ":barcode"],
              "variable": [{ "key": "barcode", "value": "1234567890123" }]
            }
          }
        }
      ]
    },
    {
      "name": "Inventory",
      "item": [
        {
          "name": "Get Inventory Levels",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/inventory_levels?location_id=&sku=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["inventory_levels"],
              "query": [
                { "key": "location_id", "value": "", "description": "Filter by location" },
                { "key": "sku", "value": "", "description": "Filter by exact SKU" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Adjust Inventory",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"sku\": \"TSHIRT-BLK-M\",\n  \"location_id\": 1,\n  \"quantity\": 50,\n  \"reason\": \"cycle_count\",\n  \"note\": \"Physical count — shelf C4\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/inventory_adjustments",
              "host": ["{{baseUrl}}"],
              "path": ["inventory_adjustments"]
            }
          }
        },
        {
          "name": "Get Inventory Ledger",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/inventory_ledger?location_id=&sku=&event_type=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["inventory_ledger"],
              "query": [
                { "key": "location_id", "value": "", "description": "Filter by location" },
                { "key": "sku", "value": "", "description": "Filter by SKU" },
                { "key": "event_type", "value": "", "description": "e.g. purchase_received, order_fulfilled, transfer_in" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Orders",
      "item": [
        {
          "name": "List Orders",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/orders?status=&location_id=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["orders"],
              "query": [
                { "key": "status", "value": "", "description": "pending | reserved | fulfilled | cancelled" },
                { "key": "location_id", "value": "", "description": "Filter by fulfillment location" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Order",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/orders/:id",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Create Order",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Idempotency-Key", "value": "order-{{$guid}}", "description": "Optional — prevents duplicate creation on retry" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"order\": {\n    \"location_id\": 1,\n    \"channel\": \"shopify\",\n    \"customer_name\": \"Jane Smith\",\n    \"customer_email\": \"jane@example.com\",\n    \"shipping_address\": \"123 Main St, Bangkok 10110\",\n    \"notes\": \"Leave at door\",\n    \"items\": [\n      { \"sku\": \"TSHIRT-BLK-M\", \"quantity\": 2, \"unit_price\": \"29.99\" },\n      { \"sku\": \"TSHIRT-WHT-S\", \"quantity\": 1, \"unit_price\": \"29.99\" }\n    ]\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/orders",
              "host": ["{{baseUrl}}"],
              "path": ["orders"]
            }
          }
        },
        {
          "name": "Reserve Order",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/orders/:id/reserve",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":id", "reserve"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Fulfill Order",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Idempotency-Key", "value": "fulfill-{{$guid}}" }
            ],
            "url": {
              "raw": "{{baseUrl}}/orders/:id/fulfill",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":id", "fulfill"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Cancel Order",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Idempotency-Key", "value": "cancel-{{$guid}}" }
            ],
            "url": {
              "raw": "{{baseUrl}}/orders/:id/cancel",
              "host": ["{{baseUrl}}"],
              "path": ["orders", ":id", "cancel"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        }
      ]
    },
    {
      "name": "Purchase Orders",
      "item": [
        {
          "name": "List Purchase Orders",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/purchase_orders?status=&supplier_id=&location_id=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["purchase_orders"],
              "query": [
                { "key": "status", "value": "", "description": "draft | submitted | partially_received | received | cancelled" },
                { "key": "supplier_id", "value": "" },
                { "key": "location_id", "value": "" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Purchase Order",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/purchase_orders/:id",
              "host": ["{{baseUrl}}"],
              "path": ["purchase_orders", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Create Purchase Order",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Idempotency-Key", "value": "po-{{$guid}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"purchase_order\": {\n    \"supplier_id\": 1,\n    \"location_id\": 1,\n    \"expected_at\": \"2026-04-01\",\n    \"notes\": \"Q2 restock\",\n    \"items\": [\n      { \"sku\": \"TSHIRT-BLK-M\", \"quantity_ordered\": 100, \"unit_cost\": \"12.00\" },\n      { \"sku\": \"TSHIRT-WHT-S\", \"quantity_ordered\": 50, \"unit_cost\": \"12.00\" }\n    ]\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/purchase_orders",
              "host": ["{{baseUrl}}"],
              "path": ["purchase_orders"]
            }
          }
        },
        {
          "name": "Update Purchase Order",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"purchase_order\": {\n    \"status\": \"submitted\",\n    \"expected_at\": \"2026-04-05\",\n    \"notes\": \"Expedited shipping requested\"\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/purchase_orders/:id",
              "host": ["{{baseUrl}}"],
              "path": ["purchase_orders", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Receive Purchase Order",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"items\": [\n    { \"sku\": \"TSHIRT-BLK-M\", \"quantity_received\": 80 },\n    { \"sku\": \"TSHIRT-WHT-S\", \"quantity_received\": 50 }\n  ]\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/purchase_orders/:id/receive",
              "host": ["{{baseUrl}}"],
              "path": ["purchase_orders", ":id", "receive"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        }
      ]
    },
    {
      "name": "Stock Transfers",
      "item": [
        {
          "name": "List Stock Transfers",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/stock_transfers?status=&origin_location_id=&destination_location_id=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["stock_transfers"],
              "query": [
                { "key": "status", "value": "", "description": "draft | in_transit | received | cancelled" },
                { "key": "origin_location_id", "value": "" },
                { "key": "destination_location_id", "value": "" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Stock Transfer",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/stock_transfers/:id",
              "host": ["{{baseUrl}}"],
              "path": ["stock_transfers", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Create Stock Transfer",
          "request": {
            "method": "POST",
            "header": [
              { "key": "Content-Type", "value": "application/json" },
              { "key": "Idempotency-Key", "value": "trf-{{$guid}}" }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"stock_transfer\": {\n    \"origin_location_id\": 1,\n    \"destination_location_id\": 2,\n    \"notes\": \"Weekly store replenishment\",\n    \"items\": [\n      { \"sku\": \"TSHIRT-BLK-M\", \"quantity\": 20 },\n      { \"sku\": \"TSHIRT-WHT-S\", \"quantity\": 15 }\n    ]\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/stock_transfers",
              "host": ["{{baseUrl}}"],
              "path": ["stock_transfers"]
            }
          }
        },
        {
          "name": "Ship Stock Transfer",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/stock_transfers/:id/ship",
              "host": ["{{baseUrl}}"],
              "path": ["stock_transfers", ":id", "ship"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Receive Stock Transfer",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/stock_transfers/:id/receive",
              "host": ["{{baseUrl}}"],
              "path": ["stock_transfers", ":id", "receive"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        }
      ]
    },
    {
      "name": "Suppliers",
      "item": [
        {
          "name": "List Suppliers",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/suppliers?page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["suppliers"],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Supplier",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/suppliers/:id",
              "host": ["{{baseUrl}}"],
              "path": ["suppliers", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Create Supplier",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"supplier\": {\n    \"name\": \"Fabric House Co.\",\n    \"code\": \"FHC\",\n    \"contact_name\": \"Somchai Jaidee\",\n    \"email\": \"somchai@fabrichouse.co.th\",\n    \"phone\": \"+66-2-123-4567\",\n    \"address\": \"99 Industrial Rd, Nonthaburi 11000\"\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/suppliers",
              "host": ["{{baseUrl}}"],
              "path": ["suppliers"]
            }
          }
        },
        {
          "name": "Update Supplier",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"supplier\": {\n    \"contact_name\": \"Wichai Jaidee\",\n    \"email\": \"wichai@fabrichouse.co.th\"\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/suppliers/:id",
              "host": ["{{baseUrl}}"],
              "path": ["suppliers", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        }
      ]
    },
    {
      "name": "Locations",
      "item": [
        {
          "name": "List Locations",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/locations?page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["locations"],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Location",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/locations/:id",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Create Location",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"location\": {\n    \"name\": \"Central Warehouse\",\n    \"location_type\": \"warehouse\",\n    \"address_line1\": \"88 Logistics Park\",\n    \"city\": \"Bangna\",\n    \"country\": \"TH\",\n    \"phone\": \"+66-2-888-0001\",\n    \"email\": \"warehouse@example.com\"\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/locations",
              "host": ["{{baseUrl}}"],
              "path": ["locations"]
            }
          }
        },
        {
          "name": "Update Location",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"location\": {\n    \"phone\": \"+66-2-888-0002\",\n    \"email\": \"warehouse-new@example.com\"\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/locations/:id",
              "host": ["{{baseUrl}}"],
              "path": ["locations", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        }
      ]
    },
    {
      "name": "Cycle Counts",
      "description": "Manage physical stock counts. Workflow: Create → Load Inventory → Start → (enter counted quantities) → Complete.\n\nCompleting a cycle count creates ledger entries for every variant where counted ≠ expected.",
      "item": [
        {
          "name": "List Cycle Counts",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/cycle_counts?status=&location_id=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["cycle_counts"],
              "query": [
                { "key": "status", "value": "", "description": "draft | in_progress | completed" },
                { "key": "location_id", "value": "" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Cycle Count",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/cycle_counts/:id",
              "host": ["{{baseUrl}}"],
              "path": ["cycle_counts", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Create Cycle Count",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"cycle_count\": {\n    \"location_id\": 1\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/cycle_counts",
              "host": ["{{baseUrl}}"],
              "path": ["cycle_counts"]
            }
          }
        },
        {
          "name": "Load Inventory into Cycle Count",
          "request": {
            "method": "POST",
            "header": [],
            "description": "Populates the count sheet with current on-hand quantities from inventory snapshots. Call after creating the count, before starting it.",
            "url": {
              "raw": "{{baseUrl}}/cycle_counts/:id/load_inventory",
              "host": ["{{baseUrl}}"],
              "path": ["cycle_counts", ":id", "load_inventory"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Start Cycle Count",
          "request": {
            "method": "POST",
            "header": [],
            "description": "Transitions status from draft to in_progress. Once started, counted quantities can be submitted.",
            "url": {
              "raw": "{{baseUrl}}/cycle_counts/:id/start",
              "host": ["{{baseUrl}}"],
              "path": ["cycle_counts", ":id", "start"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Submit Counted Quantities",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "description": "Update counted quantities for cycle count items. Can be called multiple times while count is in_progress.",
            "body": {
              "mode": "raw",
              "raw": "{\n  \"cycle_count\": {\n    \"items\": [\n      { \"variant_id\": 1, \"counted_quantity\": 48 },\n      { \"variant_id\": 2, \"counted_quantity\": 22 },\n      { \"variant_id\": 3, \"counted_quantity\": 0 }\n    ]\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/cycle_counts/:id",
              "host": ["{{baseUrl}}"],
              "path": ["cycle_counts", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Complete Cycle Count",
          "request": {
            "method": "POST",
            "header": [],
            "description": "Finalises the count. Creates cycle_count_adjustment ledger entries for all variants where counted ≠ expected. Idempotent — cannot be completed twice.",
            "url": {
              "raw": "{{baseUrl}}/cycle_counts/:id/complete",
              "host": ["{{baseUrl}}"],
              "path": ["cycle_counts", ":id", "complete"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        }
      ]
    },
    {
      "name": "Returns / RMA",
      "description": "Return Merchandise Authorisation workflow.\n\nWorkflow: Create RMA → (goods arrive) → Receive Return.\n\nItems with condition=good add inventory (return_received ledger entry).\nItems with condition=damaged do not add inventory (return_disposed ledger entry).",
      "item": [
        {
          "name": "List Return Authorizations",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/return_authorizations?status=&order_id=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["return_authorizations"],
              "query": [
                { "key": "status", "value": "", "description": "pending | received | cancelled" },
                { "key": "order_id", "value": "" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Return Authorization",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/return_authorizations/:id",
              "host": ["{{baseUrl}}"],
              "path": ["return_authorizations", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Create Return Authorization",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"return_authorization\": {\n    \"order_id\": 1,\n    \"reason\": \"Wrong item shipped\",\n    \"items\": [\n      { \"sku\": \"TSHIRT-BLK-M\", \"quantity\": 2, \"condition\": \"good\" },\n      { \"sku\": \"TSHIRT-WHT-S\", \"quantity\": 1, \"condition\": \"damaged\" }\n    ]\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/return_authorizations",
              "host": ["{{baseUrl}}"],
              "path": ["return_authorizations"]
            }
          }
        },
        {
          "name": "Receive Return",
          "request": {
            "method": "POST",
            "header": [],
            "description": "Marks the return as received. Good-condition items are added back to inventory. Damaged items are recorded as disposed without adding stock.",
            "url": {
              "raw": "{{baseUrl}}/return_authorizations/:id/receive",
              "host": ["{{baseUrl}}"],
              "path": ["return_authorizations", ":id", "receive"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Cancel Return Authorization",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/return_authorizations/:id/cancel",
              "host": ["{{baseUrl}}"],
              "path": ["return_authorizations", ":id", "cancel"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        }
      ]
    },
    {
      "name": "Inventory Policies",
      "description": "Reorder policies per variant per location. Define reorder_point, reorder_quantity, safety_stock, and lead_time_days. Used by AI insights and reorder recommendations.",
      "item": [
        {
          "name": "List Inventory Policies",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/inventory_policies?variant_id=&location_id=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["inventory_policies"],
              "query": [
                { "key": "variant_id", "value": "" },
                { "key": "location_id", "value": "" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Inventory Policy",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/inventory_policies/:id",
              "host": ["{{baseUrl}}"],
              "path": ["inventory_policies", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Create Inventory Policy",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"inventory_policy\": {\n    \"variant_id\": 1,\n    \"location_id\": 1,\n    \"reorder_point\": 20,\n    \"reorder_quantity\": 100,\n    \"lead_time_days\": 14,\n    \"safety_stock\": 10\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/inventory_policies",
              "host": ["{{baseUrl}}"],
              "path": ["inventory_policies"]
            }
          }
        },
        {
          "name": "Update Inventory Policy",
          "request": {
            "method": "PATCH",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"inventory_policy\": {\n    \"reorder_point\": 25,\n    \"lead_time_days\": 10\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/inventory_policies/:id",
              "host": ["{{baseUrl}}"],
              "path": ["inventory_policies", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Delete Inventory Policy",
          "request": {
            "method": "DELETE",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/inventory_policies/:id",
              "host": ["{{baseUrl}}"],
              "path": ["inventory_policies", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        }
      ]
    },
    {
      "name": "Reports",
      "item": [
        {
          "name": "Stock by Location",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/reports/stock_by_location?location_id=",
              "host": ["{{baseUrl}}"],
              "path": ["reports", "stock_by_location"],
              "query": [
                { "key": "location_id", "value": "", "description": "Optional — filter to a single location" }
              ]
            }
          }
        },
        {
          "name": "Low Stock",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/reports/low_stock?threshold=10&location_id=&page=1&per_page=50",
              "host": ["{{baseUrl}}"],
              "path": ["reports", "low_stock"],
              "query": [
                { "key": "threshold", "value": "10", "description": "Units below this are flagged (default 10)" },
                { "key": "location_id", "value": "" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "50" }
              ]
            }
          }
        },
        {
          "name": "Fast Movers",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/reports/fast_movers?location_id=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["reports", "fast_movers"],
              "query": [
                { "key": "location_id", "value": "" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Slow Movers",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/reports/slow_movers?location_id=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["reports", "slow_movers"],
              "query": [
                { "key": "location_id", "value": "" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Inventory Aging",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/reports/inventory_aging?location_id=&age_bucket=&page=1&per_page=50",
              "host": ["{{baseUrl}}"],
              "path": ["reports", "inventory_aging"],
              "query": [
                { "key": "location_id", "value": "" },
                { "key": "age_bucket", "value": "", "description": "0-30 | 31-60 | 61-90 | 90+ | unknown" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "50" }
              ]
            }
          }
        },
        {
          "name": "Inventory Value",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/reports/inventory_value?location_id=",
              "host": ["{{baseUrl}}"],
              "path": ["reports", "inventory_value"],
              "query": [
                { "key": "location_id", "value": "", "description": "Optional — filter to a single location" }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "Production Batches",
      "item": [
        {
          "name": "List Production Batches",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/production_batches?status=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["production_batches"],
              "query": [
                { "key": "status", "value": "", "description": "planned | in_progress | completed | cancelled" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Production Batch",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/production_batches/:id",
              "host": ["{{baseUrl}}"],
              "path": ["production_batches", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Create Production Batch",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"production_batch\": {\n    \"recipe_id\": 1,\n    \"location_id\": 1,\n    \"planned_quantity\": 10,\n    \"notes\": \"Optional notes\"\n  }\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/production_batches",
              "host": ["{{baseUrl}}"],
              "path": ["production_batches"]
            }
          }
        },
        {
          "name": "Start Production Batch",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/production_batches/:id/start",
              "host": ["{{baseUrl}}"],
              "path": ["production_batches", ":id", "start"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Complete Production Batch",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"production_batch\": {\n    \"actual_quantity_produced\": 10\n  },\n  \"inputs\": []\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/production_batches/:id/complete",
              "host": ["{{baseUrl}}"],
              "path": ["production_batches", ":id", "complete"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Cancel Production Batch",
          "request": {
            "method": "POST",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/production_batches/:id/cancel",
              "host": ["{{baseUrl}}"],
              "path": ["production_batches", ":id", "cancel"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        }
      ]
    },
    {
      "name": "Traceability",
      "item": [
        {
          "name": "List Lots",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/lots?status=&variant_id=&page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["lots"],
              "query": [
                { "key": "status", "value": "", "description": "active | quarantine | exhausted | recalled" },
                { "key": "variant_id", "value": "" },
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Lot",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/lots/:id",
              "host": ["{{baseUrl}}"],
              "path": ["lots", ":id"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Trace Forward",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/lots/:id/trace_forward",
              "host": ["{{baseUrl}}"],
              "path": ["lots", ":id", "trace_forward"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "Trace Backward",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/lots/:id/trace_backward",
              "host": ["{{baseUrl}}"],
              "path": ["lots", ":id", "trace_backward"],
              "variable": [{ "key": "id", "value": "1" }]
            }
          }
        },
        {
          "name": "List Waste Records",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/waste_records?page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["waste_records"],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Record Waste",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"variant_id\": 1,\n  \"location_id\": 1,\n  \"quantity\": 1,\n  \"reason\": \"expired\",\n  \"notes\": \"Optional note\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/waste_records",
              "host": ["{{baseUrl}}"],
              "path": ["waste_records"]
            }
          }
        },
        {
          "name": "Expiry Alerts",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/expiry/alerts?days=30",
              "host": ["{{baseUrl}}"],
              "path": ["expiry", "alerts"],
              "query": [
                { "key": "days", "value": "30", "description": "Lots expiring within N days (1-365)" }
              ]
            }
          }
        }
      ]
    },
    {
      "name": "AI",
      "item": [
        {
          "name": "Get AI Insights",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/ai/insights?page=1&per_page=25",
              "host": ["{{baseUrl}}"],
              "path": ["ai", "insights"],
              "query": [
                { "key": "page", "value": "1" },
                { "key": "per_page", "value": "25" }
              ]
            }
          }
        },
        {
          "name": "Get Demand Forecasts",
          "request": {
            "method": "GET",
            "header": [],
            "url": {
              "raw": "{{baseUrl}}/ai/forecasts?variant_id=&location_id=",
              "host": ["{{baseUrl}}"],
              "path": ["ai", "forecasts"],
              "query": [
                { "key": "variant_id", "value": "" },
                { "key": "location_id", "value": "" }
              ]
            }
          }
        },
        {
          "name": "AI Natural Language Query",
          "request": {
            "method": "POST",
            "header": [{ "key": "Content-Type", "value": "application/json" }],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"query\": \"Which products are running low at location 1?\"\n}"
            },
            "url": {
              "raw": "{{baseUrl}}/ai/query",
              "host": ["{{baseUrl}}"],
              "path": ["ai", "query"]
            }
          }
        }
      ]
    }
  ],
  "event": [
    {
      "listen": "prerequest",
      "script": {
        "type": "text/javascript",
        "exec": [""]
      }
    },
    {
      "listen": "test",
      "script": {
        "type": "text/javascript",
        "exec": [
          "// Auto-check for successful status codes",
          "pm.test('Status code is 2xx', function () {",
          "  pm.expect(pm.response.code).to.be.within(200, 299);",
          "});"
        ]
      }
    }
  ]
}
