> For the complete documentation index, see [llms.txt](https://docs.pyck.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pyck.cloud/graphql-api/mutations/deleteinventoryitem.md).

# Delete Inventory Item

Delete Inventory Item Mutation

Deletes an existing InventoryItem object from the system.

## Arguments

| Name | Type  | Description                                           |
| ---- | ----- | ----------------------------------------------------- |
| `id` | `ID!` | The unique identifier of the inventory item to delete |

## Return Type

`InventoryItemDeletePayload!` - Contains information about the deleted item and related workflows.

## Return Fields

`InventoryItemDeletePayload`:

| Field       | Type                 | Description                                            |
| ----------- | -------------------- | ------------------------------------------------------ |
| `deletedID` | `ID`                 | The ID of the deleted inventory item                   |
| `workflows` | `[TemporalWorkflow]` | Workflow instances that were triggered by the deletion |

## Usage Example

```graphql
mutation {
  deleteInventoryItem(id: "item_123") {
    deletedID
    workflows {
      id
      type
      status
      runID
    }
  }
}
```

## JavaScript Example

```javascript
const DELETE_INVENTORY_ITEM = gql`
  mutation DeleteInventoryItem($id: ID!) {
    deleteInventoryItem(id: $id) {
      deletedID
      workflows {
        id
        type
        status
        runID
      }
    }
  }
`;

const { data } = await client.mutate({
  mutation: DELETE_INVENTORY_ITEM,
  variables: {
    id: "item_123"
  }
});

console.log(`Deleted inventory item with ID: ${data.deleteInventoryItem.deletedID}`);

// Check for any triggered workflows
if (data.deleteInventoryItem.workflows.length > 0) {
  console.log('Triggered workflows:', data.deleteInventoryItem.workflows);
}
```

## Important Notes

* **Cascading Effects**: Deleting an inventory item may affect related stock records, movements, and transactions
* **Workflow Triggers**: The deletion may trigger cleanup workflows or business process workflows
* **Authorization**: Ensure you have proper permissions before deleting inventory items
* **Data Integrity**: The system will prevent deletion if the item is referenced in active orders or movements
* **Audit Trail**: Deletion events are typically logged for compliance and audit purposes
* **Recovery**: Once deleted, the inventory item cannot be recovered through the API

## Related Operations

After deleting an inventory item, you may need to:

* Update stock levels in affected repositories
* Cancel or modify related movements
* Notify stakeholders about the item removal
* Update item sets that contained this item


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.pyck.cloud/graphql-api/mutations/deleteinventoryitem.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
