# inventoryItems - admin-graphql - QUERY Version: 2024-10 ## Description Returns a list of inventory items. ### Access Scopes ## Arguments * [after](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * [before](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql). * [first](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * [last](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql). * [query](/docs/api/admin-graphql/2024-10/scalars/String): String - A filter made up of terms, connectives, modifiers, and comparators. | name | type | description | acceptable_values | default_value | example_use | | ---- | ---- | ---- | ---- | ---- | ---- | | created_at | time | | id | id | Filter by `id` range. | | | - `id:1234`
- `id:>=1234`
- `id:<=1234` | | sku | string | Filter by the inventory item [`sku`](https://shopify.dev/docs/api/admin-graphql/latest/objects/InventoryItem#field-sku) field. [Learn more about SKUs](https://help.shopify.com/manual/products/details/sku). | | | - `sku:XYZ-12345` | | updated_at | time | You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax). * [reverse](/docs/api/admin-graphql/2024-10/scalars/Boolean): Boolean - Reverse the order of the underlying list. ## Returns * [edges](/docs/api/admin-graphql/2024-10/objects/InventoryItemEdge): InventoryItemEdge! The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node. * [nodes](/docs/api/admin-graphql/2024-10/objects/InventoryItem): InventoryItem! A list of nodes that are contained in InventoryItemEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve. * [pageInfo](/docs/api/admin-graphql/2024-10/objects/PageInfo): PageInfo! An object that’s used to retrieve [cursor information](https://shopify.dev/api/usage/pagination-graphql) about the current page. ## Examples ### Get details about the first 2 inventory items Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query inventoryItems { inventoryItems(first: 2) { edges { node { id tracked sku } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query inventoryItems {\n inventoryItems(first: 2) {\n edges {\n node {\n id\n tracked\n sku\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 inventoryItems {\n inventoryItems(first: 2) {\n edges {\n node {\n id\n tracked\n sku\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 inventoryItems {\n inventoryItems(first: 2) {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query inventoryItems {\n inventoryItems(first: 2) {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "inventoryItems": { "edges": [ { "node": { "id": "gid://shopify/InventoryItem/30322695", "tracked": true, "sku": "element-151" } }, { "node": { "id": "gid://shopify/InventoryItem/43729076", "tracked": true, "sku": "draft-151" } } ] } } } ### Get details about the first inventory item matching an SKU Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query inventoryItems { inventoryItems(first: 1, query: \\\"sku:'\\''element-151'\\''\\\") { edges { node { id tracked sku } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query inventoryItems {\n inventoryItems(first: 1, query: \"sku:'element-151'\") {\n edges {\n node {\n id\n tracked\n sku\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 inventoryItems {\n inventoryItems(first: 1, query: \"sku:'element-151'\") {\n edges {\n node {\n id\n tracked\n sku\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 inventoryItems {\n inventoryItems(first: 1, query: \"sku:'element-151'\") {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query inventoryItems {\n inventoryItems(first: 1, query: \"sku:'element-151'\") {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "inventoryItems": { "edges": [ { "node": { "id": "gid://shopify/InventoryItem/30322695", "tracked": true, "sku": "element-151" } } ] } } } ### Get details about the first two inventory item with created_at or matching sku Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query inventoryItems { inventoryItems(first: 2, query: \\\"(created_at:>2023-10-10) OR (sku:'\\''element-151'\\'')\\\") { edges { node { id tracked sku } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query inventoryItems {\n inventoryItems(first: 2, query: \"(created_at:>2023-10-10) OR (sku:'element-151')\") {\n edges {\n node {\n id\n tracked\n sku\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 inventoryItems {\n inventoryItems(first: 2, query: \"(created_at:>2023-10-10) OR (sku:'element-151')\") {\n edges {\n node {\n id\n tracked\n sku\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 inventoryItems {\n inventoryItems(first: 2, query: \"(created_at:>2023-10-10) OR (sku:'element-151')\") {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query inventoryItems {\n inventoryItems(first: 2, query: \"(created_at:>2023-10-10) OR (sku:'element-151')\") {\n edges {\n node {\n id\n tracked\n sku\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "inventoryItems": { "edges": [ { "node": { "id": "gid://shopify/InventoryItem/30322695", "tracked": true, "sku": "element-151" } }, { "node": { "id": "gid://shopify/InventoryItem/43729076", "tracked": true, "sku": "draft-151" } } ] } } } ### Retrieves a detailed list for inventory items by IDs Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query InventoryItemList { inventoryItems(first: 20, query: \\\"id:>=30322695\\\") { nodes { id createdAt countryCodeOfOrigin harmonizedSystemCode provinceCodeOfOrigin requiresShipping sku tracked unitCost { currencyCode amount } updatedAt countryHarmonizedSystemCodes(first: 250) { nodes { harmonizedSystemCode countryCode } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query InventoryItemList {\n inventoryItems(first: 20, query: \"id:>=30322695\") {\n nodes {\n id\n createdAt\n countryCodeOfOrigin\n harmonizedSystemCode\n provinceCodeOfOrigin\n requiresShipping\n sku\n tracked\n unitCost {\n currencyCode\n amount\n }\n updatedAt\n countryHarmonizedSystemCodes(first: 250) {\n nodes {\n harmonizedSystemCode\n countryCode\n }\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 InventoryItemList {\n inventoryItems(first: 20, query: \"id:>=30322695\") {\n nodes {\n id\n createdAt\n countryCodeOfOrigin\n harmonizedSystemCode\n provinceCodeOfOrigin\n requiresShipping\n sku\n tracked\n unitCost {\n currencyCode\n amount\n }\n updatedAt\n countryHarmonizedSystemCodes(first: 250) {\n nodes {\n harmonizedSystemCode\n countryCode\n }\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 InventoryItemList {\n inventoryItems(first: 20, query: \"id:>=30322695\") {\n nodes {\n id\n createdAt\n countryCodeOfOrigin\n harmonizedSystemCode\n provinceCodeOfOrigin\n requiresShipping\n sku\n tracked\n unitCost {\n currencyCode\n amount\n }\n updatedAt\n countryHarmonizedSystemCodes(first: 250) {\n nodes {\n harmonizedSystemCode\n countryCode\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query InventoryItemList {\n inventoryItems(first: 20, query: \"id:>=30322695\") {\n nodes {\n id\n createdAt\n countryCodeOfOrigin\n harmonizedSystemCode\n provinceCodeOfOrigin\n requiresShipping\n sku\n tracked\n unitCost {\n currencyCode\n amount\n }\n updatedAt\n countryHarmonizedSystemCodes(first: 250) {\n nodes {\n harmonizedSystemCode\n countryCode\n }\n }\n }\n }\n}" #### Graphql Input null #### Graphql Response { "data": { "inventoryItems": { "nodes": [ { "id": "gid://shopify/InventoryItem/30322695", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "DE", "harmonizedSystemCode": "123456", "provinceCodeOfOrigin": "QC", "requiresShipping": true, "sku": "element-151", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "1.23" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [ { "harmonizedSystemCode": "123456999333", "countryCode": "CA" } ] } }, { "id": "gid://shopify/InventoryItem/43729076", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": null, "harmonizedSystemCode": null, "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "draft-151", "tracked": true, "unitCost": null, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/113711323", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "CA", "harmonizedSystemCode": "555555", "provinceCodeOfOrigin": "", "requiresShipping": true, "sku": "element-155", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "15.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/138327650", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": null, "harmonizedSystemCode": null, "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "boots-10", "tracked": true, "unitCost": null, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/236948360", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "FR", "harmonizedSystemCode": "654321", "provinceCodeOfOrigin": "", "requiresShipping": true, "sku": "element-158", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "20.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/330284860", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": null, "harmonizedSystemCode": null, "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "unpublished_boots-12", "tracked": true, "unitCost": null, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/389013007", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "CA", "harmonizedSystemCode": "123456", "provinceCodeOfOrigin": "ON", "requiresShipping": true, "sku": "crappy_shoes_red", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "20.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/419425742", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "DE", "harmonizedSystemCode": "999999", "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "crappy_shoes_pink", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "20.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/438458761", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": null, "harmonizedSystemCode": null, "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "IPOD2008RED", "tracked": true, "unitCost": null, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/445365074", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "IT", "harmonizedSystemCode": "654321", "provinceCodeOfOrigin": "", "requiresShipping": true, "sku": "crappy_shoes_green", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "20.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/498744621", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": null, "harmonizedSystemCode": null, "provinceCodeOfOrigin": null, "requiresShipping": true, "sku": "seo-boots-10", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "15.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } }, { "id": "gid://shopify/InventoryItem/715806386", "createdAt": "2024-11-07T16:22:10Z", "countryCodeOfOrigin": "FR", "harmonizedSystemCode": "555555", "provinceCodeOfOrigin": "", "requiresShipping": true, "sku": "crappy_shoes_blue", "tracked": true, "unitCost": { "currencyCode": "USD", "amount": "20.0" }, "updatedAt": "2024-11-07T16:22:10Z", "countryHarmonizedSystemCodes": { "nodes": [] } } ] } } }