# inventoryItem - admin-graphql - QUERY Version: 2024-04 ## Description Returns an [InventoryItem](https://shopify.dev/docs/api/admin-graphql/latest/objects/InventoryItem) object by ID. ### Access Scopes ## Arguments * [id](/docs/api/admin-graphql/2024-04/scalars/ID): ID! - The ID of the `InventoryItem` to return. ## Returns * [countryCodeOfOrigin](/docs/api/admin-graphql/2024-04/enums/CountryCode): CountryCode The ISO 3166-1 alpha-2 country code of where the item originated from. * [createdAt](/docs/api/admin-graphql/2024-04/scalars/DateTime): DateTime! The date and time when the inventory item was created. * [duplicateSkuCount](/docs/api/admin-graphql/2024-04/scalars/Int): Int! The number of inventory items that share the same SKU with this item. * [harmonizedSystemCode](/docs/api/admin-graphql/2024-04/scalars/String): String The harmonized system code of the item. * [id](/docs/api/admin-graphql/2024-04/scalars/ID): ID! A globally-unique ID. * [inventoryHistoryUrl](/docs/api/admin-graphql/2024-04/scalars/URL): URL The URL that points to the inventory history for the item. * [inventoryLevel](/docs/api/admin-graphql/2024-04/objects/InventoryLevel): InventoryLevel The inventory item's quantities at the specified location. * [legacyResourceId](/docs/api/admin-graphql/2024-04/scalars/UnsignedInt64): UnsignedInt64! The ID of the corresponding resource in the REST Admin API. * [locationsCount](/docs/api/admin-graphql/2024-04/objects/Count): Count The number of locations where this inventory item is stocked. * [measurement](/docs/api/admin-graphql/2024-04/objects/InventoryItemMeasurement): InventoryItemMeasurement! The packaging dimensions of the inventory item. * [provinceCodeOfOrigin](/docs/api/admin-graphql/2024-04/scalars/String): String The ISO 3166-2 alpha-2 province code of where the item originated from. * [requiresShipping](/docs/api/admin-graphql/2024-04/scalars/Boolean): Boolean! Whether the inventory item requires shipping. * [sku](/docs/api/admin-graphql/2024-04/scalars/String): String Inventory item SKU. Case-sensitive string. * [tracked](/docs/api/admin-graphql/2024-04/scalars/Boolean): Boolean! Whether inventory levels are tracked for the item. * [trackedEditable](/docs/api/admin-graphql/2024-04/objects/EditableProperty): EditableProperty! Whether the value of the `tracked` field for the inventory item can be changed. * [unitCost](/docs/api/admin-graphql/2024-04/objects/MoneyV2): MoneyV2 Unit cost associated with the inventory item. Note: the user must have "View product costs" permission granted in order to access this field once product granular permissions are enabled. * [updatedAt](/docs/api/admin-graphql/2024-04/scalars/DateTime): DateTime! The date and time when the inventory item was updated. * [variant](/docs/api/admin-graphql/2024-04/objects/ProductVariant): ProductVariant! The variant that owns this inventory item. ## Examples ### Get details about a specified inventory item Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query inventoryItem { inventoryItem(id: \\\"gid://shopify/InventoryItem/30322695\\\") { id tracked sku } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "inventoryItem": { "id": "gid://shopify/InventoryItem/30322695", "tracked": true, "sku": "element-151" } } } ### Get inventory item levels and product/variant information Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query inventoryItemToProductVariant { inventoryItem(id: \\\"gid://shopify/InventoryItem/30322695\\\") { id inventoryLevels(first: 1) { edges { node { id location { id name } quantities(names: [\\\"available\\\", \\\"committed\\\", \\\"incoming\\\", \\\"on_hand\\\", \\\"reserved\\\"]) { name quantity } } } } variant { id title product { id title } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\n }\n }\n }\n }`,\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "inventoryItem": { "id": "gid://shopify/InventoryItem/30322695", "inventoryLevels": { "edges": [ { "node": { "id": "gid://shopify/InventoryLevel/523463154?inventory_item_id=30322695", "location": { "id": "gid://shopify/Location/346779380", "name": "Ottawa Store" }, "quantities": [ { "name": "available", "quantity": 2 }, { "name": "committed", "quantity": 1 }, { "name": "incoming", "quantity": 0 }, { "name": "on_hand", "quantity": 33 }, { "name": "reserved", "quantity": 30 } ] } } ] }, "variant": { "id": "gid://shopify/ProductVariant/30322695", "title": "151cm", "product": { "id": "gid://shopify/Product/20995642", "title": "Element" } } } } }