# inventoryDeactivate - admin-graphql - MUTATION Version: 2024-10 ## Description Removes an inventory item's quantities from a location, and turns off inventory at the location. ### Access Scopes `write_inventory` access scope. Also: The user must have a permission to deactivate an inventory. ## Arguments * [inventoryLevelId](/docs/api/admin-graphql/2024-10/scalars/ID): ID! - The ID of the inventory level to deactivate. ## Returns * [userErrors](/docs/api/admin-graphql/2024-10/objects/UserError): UserError! The list of errors that occurred from executing the mutation. ## Examples ### Deletes an inventory level from a location 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\": \"mutation inventoryDeactivate($inventoryLevelId: ID!) { inventoryDeactivate(inventoryLevelId: $inventoryLevelId) { userErrors { message } } }\",\n \"variables\": {\n \"inventoryLevelId\": \"gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation inventoryDeactivate($inventoryLevelId: ID!) {\n inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {\n userErrors {\n message\n }\n }\n }`,\n \"variables\": {\n \"inventoryLevelId\": \"gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926\"\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 mutation inventoryDeactivate($inventoryLevelId: ID!) {\n inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {\n userErrors {\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"inventoryLevelId\": \"gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation inventoryDeactivate($inventoryLevelId: ID!) {\n inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {\n userErrors {\n message\n }\n }\n }`,\n {\n variables: {\n \"inventoryLevelId\": \"gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation inventoryDeactivate($inventoryLevelId: ID!) {\n inventoryDeactivate(inventoryLevelId: $inventoryLevelId) {\n userErrors {\n message\n }\n }\n}" #### Graphql Input { "inventoryLevelId": "gid://shopify/InventoryLevel/820859520?inventory_item_id=826867926" } #### Graphql Response { "data": { "inventoryDeactivate": { "userErrors": [] } } }