> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # QueryInventory # Package: catalogV1 # Namespace: InventoryReadApi # Method link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/inventory/query-inventory.md ## Permission Scopes: Read Products: SCOPE.DC-STORES.READ-PRODUCTS ## Introduction Returns a list of up inventory items, given the provided paging, sorting and filtering. See [Stores Pagination](https://dev.wix.com/api/rest/wix-stores/pagination) for more information. --- ## REST API ### Schema ``` Method: queryInventory Description: Returns a list of up inventory items, given the provided paging, sorting and filtering. See [Stores Pagination](https://dev.wix.com/api/rest/wix-stores/pagination) for more information. URL: https://www.wixapis.com/stores-reader/v2/inventoryItems/query Method: POST Method parameters: param name: query | type: Query - name: paging | type: Paging | description: - name: limit | type: integer | description: Amount of items to load per page - name: offset | type: integer | description: Number of items to skip in the display (relevant for all pages after the first) - name: filter | type: string | description: Filter string - name: sort | type: string | description: Sort string Return type: QueryInventoryResponse - name: inventoryItems | type: array | description: Inventory items. - name: id | type: string | description: Inventory item GUID. - name: productId | type: string | description: Product GUID. - name: trackQuantity | type: boolean | description: Whether quantity is being tracked. - name: variants | type: array | description: Variants associated with this inventory item. - name: variantId | type: string | description: Variant GUID. - name: inStock | type: boolean | description: Whether the product is listed as in stock. - name: quantity | type: integer | description: Quantity currently left in inventory. - name: availableForPreorder | type: boolean | description: Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level. - name: lastUpdated | type: string | description: Last updated timestamp. - name: numericId | type: number | description: Inventory’s unique numeric GUID (assigned in ascending order). Primarily for sorting and filtering when crawling all inventories. - name: preorderInfo | type: PreorderInfo | description: Preorder information. - name: enabled | type: boolean | description: Whether the item is available for preorder. - name: message | type: string | description: A message the buyer will see when the item is out of stock and preorder is enabled. - name: limit | type: integer | description: Number of products that can be preordered after stock reaches zero. - name: metadata | type: PagingMetadata | description: Display metadata. - name: items | type: integer | description: Amount of items to load per page - name: offset | type: integer | description: Number of items to skip in the display (relevant for all pages after the first) - name: totalResults | type: integer | description: Number of total results. ``` ### Examples ### QueryInventory ```curl ~~~cURL curl -X POST https://www.wixapis.com/stores/v2/inventoryItems/query \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ --data-binary ' {} }' ~~~ ``` ### QueryInventory ```curl ~~~cURL curl -X POST https://www.wixapis.com/stores/v2/inventoryItems/query \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ --data-binary '{ "query": { "filter": "{\"lastUpdated\": {\"$gt\": [\"2020-01-29T09:22:00.000Z\"]}}" } } }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.catalogV1.InventoryReadApi.queryInventory(options) Description: Returns a list of up inventory items, given the provided paging, sorting and filtering. See [Stores Pagination](https://dev.wix.com/api/rest/wix-stores/pagination) for more information. Method parameters: param name: options | type: QueryInventoryOptions none - name: query | type: Query | description: - name: paging | type: Paging | description: - name: limit | type: integer | description: Amount of items to load per page - name: offset | type: integer | description: Number of items to skip in the display (relevant for all pages after the first) - name: filter | type: string | description: Filter string - name: sort | type: string | description: Sort string Return type: PROMISE - name: inventoryItems | type: array | description: Inventory items. - name: _id | type: string | description: Inventory item GUID. - name: productId | type: string | description: Product GUID. - name: trackQuantity | type: boolean | description: Whether quantity is being tracked. - name: variants | type: array | description: Variants associated with this inventory item. - name: variantId | type: string | description: Variant GUID. - name: inStock | type: boolean | description: Whether the product is listed as in stock. - name: quantity | type: integer | description: Quantity currently left in inventory. - name: availableForPreorder | type: boolean | description: Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level. - name: lastUpdated | type: Date | description: Last updated timestamp. - name: numericId | type: number | description: Inventory’s unique numeric GUID (assigned in ascending order). Primarily for sorting and filtering when crawling all inventories. - name: preorderInfo | type: PreorderInfo | description: Preorder information. - name: enabled | type: boolean | description: Whether the item is available for preorder. - name: message | type: string | description: A message the buyer will see when the item is out of stock and preorder is enabled. - name: limit | type: integer | description: Number of products that can be preordered after stock reaches zero. - name: metadata | type: PagingMetadata | description: Display metadata. - name: items | type: integer | description: Amount of items to load per page - name: offset | type: integer | description: Number of items to skip in the display (relevant for all pages after the first) - name: totalResults | type: integer | description: Number of total results. ``` ### Examples ### Query inventory items with filter Query inventory items filtered by last updated date ```javascript import { inventory } from "@wix/stores"; const query = { filter: "{\"lastUpdated\": {\"$gt\": [\"2020-01-29T09:22:00.000Z\"]}}" }; async function queryInventory() { const response = await inventory.queryInventory({query}); return response; } const result = await inventory.queryInventory({query}); /* Promise resolves to: * { * "inventoryItems": [ * { * "externalId": "c43d36c5-c35a-91ec-1c33-d28efc70d5a6", * "productId": "c43d36c5-c35a-91ec-1c33-d28efc70d5a6", * "trackQuantity": false, * "variants": [ * { * "variantId": "00000000-0000-0000-0000-000000000000", * "inStock": true, * "availableForPreorder": false * } * ], * "numericId": "1766909903931000", * "preorderInfo": { * "enabled": false * }, * "_id": "3bc2c93a-3ca5-6e13-e3cc-2d71038f2a59" * }, * { * "externalId": "df19c1f7-07d8-a265-42f8-e8dfa824cc6e", * "productId": "df19c1f7-07d8-a265-42f8-e8dfa824cc6e", * "trackQuantity": false, * "variants": [ * { * "variantId": "00000000-0000-0000-0000-000000000000", * "inStock": true, * "availableForPreorder": false * } * ], * "numericId": "1462356045882000", * "preorderInfo": { * "enabled": false * }, * "_id": "20e63e08-f827-5d9a-bd07-172057db3391" * } * ], * "metadata": { * "items": 100, * "offset": 0 * }, * "totalResults": 13 * } */ ``` ### Query inventory items Query all inventory items without filters ```javascript import { inventory } from "@wix/stores"; const query = {}; async function queryInventory() { const response = await inventory.queryInventory({query}); return response; } const result = await inventory.queryInventory({query}); /* Promise resolves to: * { * "inventoryItems": [ * { * "externalId": "c43d36c5-c35a-91ec-1c33-d28efc70d5a6", * "productId": "c43d36c5-c35a-91ec-1c33-d28efc70d5a6", * "trackQuantity": false, * "variants": [ * { * "variantId": "00000000-0000-0000-0000-000000000000", * "inStock": true, * "availableForPreorder": false * } * ], * "numericId": "1766909903931000", * "preorderInfo": { * "enabled": false * }, * "_id": "3bc2c93a-3ca5-6e13-e3cc-2d71038f2a59" * }, * { * "externalId": "df19c1f7-07d8-a265-42f8-e8dfa824cc6e", * "productId": "df19c1f7-07d8-a265-42f8-e8dfa824cc6e", * "trackQuantity": false, * "variants": [ * { * "variantId": "00000000-0000-0000-0000-000000000000", * "inStock": true, * "availableForPreorder": false * } * ], * "numericId": "1462356045882000", * "preorderInfo": { * "enabled": false * }, * "_id": "20e63e08-f827-5d9a-bd07-172057db3391" * } * ], * "metadata": { * "items": 100, * "offset": 0 * }, * "totalResults": 13 * } */ ``` ### queryInventory (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { inventory } from '@wix/stores'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { inventory }, // Include the auth strategy and host as relevant }); async function queryInventory(options) { const response = await myWixClient.inventory.queryInventory(options); }; ``` ---