Content >

Get Inventory

Get Inventory

Feature Feature: Sales
Editions Editions: Cloud, Corporate


The item endpoint can be queried to retrieve inventory information. This includes inventory description, quantities per warehouse (and other warehouse details), and serial/lot numbers.

Unless otherwise noted, results obtained through this endpoint are ordered by SKU.

The endpoint requires ViewInventory permissions to access.

Examples

Data Sync

The endpoint supports data synchronization using since and until parameters. See Since & Until parameters for more information. Results obtained through the since parameter are sorted by modification date.

As the modification dates for inventory ware house details and serial/lot numbers are maintained separately from the main inventory records, POS also provides the itemWarehouse and itemSerialLot endpoints. You can use the Since and Until access pattern on these endpoints to detect modifications in warehouse details and serial/lot numbers.

Use the itemWarehouse and itemSerialLot endpoints to perform data synchronization for item warehouse details and serial lot information, respectively.

For other usages, warehouse details and serial lot information can be obtained through properties on the item endpoint.

List Inventory

Return a list of inventory items:

query MyQuery {
  item(
    skip:0,
    first:20
  ) {
    hasMoreResults
    results {
      sku
      name
      longName
      saleUom
      warehouses {
        warehouseCode
        sku
        basePrice
      }
    }
  }
}

The hasMoreResults value indicates whether more results are available, which you set the skip and first parameters to get the next page of data.

In this example, we are also retrieving warehouse details for each inventory item.

List Inventory by Warehouse

Return a list of inventory, filtered by a specified warehouse:

query MyQuery {
  item(
    warehouseCode: "MAIN"
    skip:0,
    first:20
  ) {
    hasMoreResults
    results {
      sku
      name
      longName
      saleUom
      stockUom
      warehouses {
        warehouseCode
        quantityAvailable
        basePrice
      }
    }
  }
}

This query is similar to the List Inventory query above, but with the addition of a warehouseCode parameter that limits the results to only those items that are in the warehouse.

Another difference is that the warehouses property of each item will only return details for the specified warehouse.

Get Inventory by SKU

Return the inventory item that matches the specified SKU:

query MyQuery {
  item(
    sku: "AAMACHINE1"
  ) {
    hasMoreResults
    results {
      sku
      name
      longName
      status
      saleUom
      stockUom
      isNonStock
      isSerialLot
      isWeighed
      canDiscount
      mustOverrideDescription
      mustOverridePrice
      abcCode
      commodityCode
      serialLots {
        type
        code
        quantity
        warehouseCode
      }
      warehouses {
        warehouseCode
        status
        quantityAvailable
        basePrice
        canDiscount
        cost
        inventoryClassCode
        salesTaxCode
      }
      altCodes {
        type
        value
      }
      dimensions {
        volume {
          value
          uom
        }
        weight {
          value
          uom
        }
      }
    }
  }
}

This example returns most of the available fields, including all serial/lot numbers and warehouse details for the item.

The example also illustrates how item volume, weight and alternate codes (e.g. UPC codes) can be retrieved.

An alternative to using the item endpoint to lookup serial/lot information is the itemSerialLot endpoint. This endpoint may be more suitable depending on your use cases, and whether your inventory items have large numbers of serial or lot numbers.

Get Inventory by Serial or Lot Number

Return the inventory item(s) that match a specified serial or lot number:

query MyQuery {
  item(
    serialLotCode: "ABC000002"
  ) {
    hasMoreResults
    results {
      sku
      name
      longName
      saleUom
      stockUom
      serialLots {
        type
        code
        quantity
        warehouseCode
      }
      warehouses {
        warehouseCode
        quantityAvailable
        basePrice
      }
    }
  }
}

Note that if you do not specify a SKU filter parameter value, the results may return multiple results. This would be the case if the same serial or lot numbers are used by multiple inventory items.

Furthermore, when you search by serial or lot number, the serialLots property of the returned item only contains details about that serial/lot number.

Get Inventory by Name

Return the inventory items that have a name that starts with a specified text:

query MyQuery {
  item(name:"butter") {
    hasMoreResults
    results {
      sku
      name
    }
  }
}

This query example will match the following inventory names:

  • Butter
  • Butter Solids
  • Butter Cups

Get Inventory by Name (Includes)

Return the inventory items that have a name that includes the specified text:

query MyQuery2 {
  item(nameIncludes:"butter") {
    hasMoreResults
    results {
      sku
      name
    }
  }
}

This query is less restrictive than the preceding example, and will match the following inventory names:

  • Butter
  • Butter Solids
  • Butter Cups
  • Whipped Butter
  • Peanut Butter