> 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/updateinventoryitem.md).

# Update Inventory Item

Update Inventory Item Mutation

Updates an existing InventoryItem object in the system with new data.

## Arguments

| Name    | Type                        | Description                                           |
| ------- | --------------------------- | ----------------------------------------------------- |
| `id`    | `ID!`                       | The unique identifier of the inventory item to update |
| `input` | `UpdateInventoryItemInput!` | Input data for updating the inventory item            |

## Return Type

`InventoryItemOutput` - Contains the updated inventory item and any related workflows.

## Input Fields

`UpdateInventoryItemInput`:

| Field                       | Type      | Description                                               |
| --------------------------- | --------- | --------------------------------------------------------- |
| `dataTypeID`                | `UUID`    | Optional data type ID to associate with the item          |
| `clearDataTypeID`           | `Boolean` | Clear the existing data type ID                           |
| `dataTypeSlug`              | `String`  | Optional data type slug                                   |
| `clearDataTypeSlug`         | `Boolean` | Clear the existing data type slug                         |
| `data`                      | `Map`     | Custom data associated with the item                      |
| `clearData`                 | `Boolean` | Clear the existing custom data                            |
| `sku`                       | `String`  | Stock keeping unit (SKU) - unique identifier for the item |
| `inventoryJSONData`         | `Map`     | Additional inventory-specific JSON data                   |
| `clearInventoryJSONData`    | `Boolean` | Clear the existing inventory JSON data                    |
| `addItemMovementItemIDs`    | `[ID!]`   | IDs of item movements to add                              |
| `removeItemMovementItemIDs` | `[ID!]`   | IDs of item movements to remove                           |
| `clearItemMovementItems`    | `Boolean` | Clear all associated item movements                       |
| `addItemTransactionIDs`     | `[ID!]`   | IDs of transactions to add                                |
| `removeItemTransactionIDs`  | `[ID!]`   | IDs of transactions to remove                             |
| `clearItemTransactions`     | `Boolean` | Clear all associated transactions                         |
| `addItemStockIDs`           | `[ID!]`   | IDs of stock records to add                               |
| `removeItemStockIDs`        | `[ID!]`   | IDs of stock records to remove                            |
| `clearItemStocks`           | `Boolean` | Clear all associated stock records                        |
| `addItemSetIDs`             | `[ID!]`   | IDs of item sets to add                                   |
| `removeItemSetIDs`          | `[ID!]`   | IDs of item sets to remove                                |

## Return Fields

`InventoryItemOutput`:

| Field           | Type                 | Description                                    |
| --------------- | -------------------- | ---------------------------------------------- |
| `inventoryItem` | `InventoryItem`      | The updated inventory item                     |
| `workflows`     | `[TemporalWorkflow]` | Related workflow instances that were triggered |

## Usage Example

```graphql
mutation {
  updateInventoryItem(
    id: "item_123"
    input: {
      sku: "UPDATED-PRODUCT-456",
      data: {
        "name": "Updated Smartphone X Pro",
        "brand": "TechCorp",
        "model": "X200",
        "description": "Latest smartphone with enhanced features",
        "specifications": {
          "display": "6.7 inch OLED",
          "processor": "Octa-core 3.2GHz",
          "memory": "12GB",
          "storage": "512GB",
          "camera": "108MP Triple Camera"
        },
        "color": "midnight blue",
        "weight": 185
      },
      inventoryJSONData: {
        "minimum_stock": 50,
        "reorder_point": 100,
        "supplier_lead_time": 14,
        "storage_requirements": ["temperature_controlled"],
        "handling_instructions": ["fragile", "keep_upright"]
      },
      dataTypeSlug: "premium_electronics"
    }
  ) {
    inventoryItem {
      id
      sku
      data
      inventoryJSONData
      dataTypeSlug
      updatedAt
      updatedBy
    }
    workflows {
      id
      type
      status
      runID
    }
  }
}
```

## JavaScript Example

```javascript
const UPDATE_INVENTORY_ITEM = gql`
  mutation UpdateInventoryItem($id: ID!, $input: UpdateInventoryItemInput!) {
    updateInventoryItem(id: $id, input: $input) {
      inventoryItem {
        id
        sku
        data
        inventoryJSONData
        dataTypeSlug
        updatedAt
        updatedBy
      }
      workflows {
        id
        type
        status
        runID
      }
    }
  }
`;

const { data } = await client.mutate({
  mutation: UPDATE_INVENTORY_ITEM,
  variables: {
    id: "item_123",
    input: {
      sku: "UPDATED-PRODUCT-456",
      data: {
        name: "Updated Smartphone X Pro",
        brand: "TechCorp",
        model: "X200",
        description: "Latest smartphone with enhanced features",
        specifications: {
          display: "6.7 inch OLED",
          processor: "Octa-core 3.2GHz",
          memory: "12GB",
          storage: "512GB",
          camera: "108MP Triple Camera"
        },
        color: "midnight blue",
        weight: 185
      },
      inventoryJSONData: {
        minimum_stock: 50,
        reorder_point: 100,
        supplier_lead_time: 14,
        storage_requirements: ["temperature_controlled"],
        handling_instructions: ["fragile", "keep_upright"]
      },
      dataTypeSlug: "premium_electronics"
    }
  }
});
```

## Important Notes

* The SKU should remain unique across all inventory items
* Updating an inventory item may trigger related workflows for stock management
* Use the clear flags to explicitly remove optional fields
* The `data` and `inventoryJSONData` fields support flexible JSON structures
* Changes to item associations (movements, transactions, stock) are applied incrementally


---

# 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/updateinventoryitem.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.
