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

# Update Inventory Repository

Update Inventory Repository Mutation

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

## Arguments

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

## Return Type

`InventoryRepositoryOutput` - Contains the updated repository and any related workflows.

## Input Fields

`UpdateRepositoryInput`:

| Field                                     | Type             | Description                                            |
| ----------------------------------------- | ---------------- | ------------------------------------------------------ |
| `dataTypeID`                              | `UUID`           | Optional data type ID to associate with the repository |
| `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 repository             |
| `clearData`                               | `Boolean`        | Clear the existing custom data                         |
| `locationID`                              | `UUID`           | Location ID                                            |
| `clearLocationID`                         | `Boolean`        | Clear the location ID                                  |
| `name`                                    | `String`         | Name of the repository                                 |
| `layout`                                  | `String`         | Layout configuration for the repository                |
| `clearLayout`                             | `Boolean`        | Clear the existing layout configuration                |
| `type`                                    | `RepositoryType` | Type of repository (dynamic or static)                 |
| `parentID`                                | `ID`             | ID of the parent repository (edge reference)           |
| `clearParent`                             | `Boolean`        | Clear the parent repository association                |
| `addChildIDs`                             | `[ID!]`          | IDs of child repositories to add                       |
| `removeChildIDs`                          | `[ID!]`          | IDs of child repositories to remove                    |
| `clearChildren`                           | `Boolean`        | Clear all child repository associations                |
| `addItemMovementToRepositoryIDs`          | `[ID!]`          | IDs of item movements (incoming) to add                |
| `removeItemMovementToRepositoryIDs`       | `[ID!]`          | IDs of item movements (incoming) to remove             |
| `clearItemMovementToRepositories`         | `Boolean`        | Clear all incoming item movements                      |
| `addItemMovementFromRepositoryIDs`        | `[ID!]`          | IDs of item movements (outgoing) to add                |
| `removeItemMovementFromRepositoryIDs`     | `[ID!]`          | IDs of item movements (outgoing) to remove             |
| `clearItemMovementFromRepositories`       | `Boolean`        | Clear all outgoing item movements                      |
| `addRepositoryMovementToRepositoryIDs`    | `[ID!]`          | IDs of repository movements (incoming) to add          |
| `removeRepositoryMovementToRepositoryIDs` | `[ID!]`          | IDs of repository movements (incoming) to remove       |

## Return Fields

`InventoryRepositoryOutput`:

| Field                 | Type                 | Description                                    |
| --------------------- | -------------------- | ---------------------------------------------- |
| `inventoryRepository` | `Repository`         | The updated repository                         |
| `workflows`           | `[TemporalWorkflow]` | Related workflow instances that were triggered |

## Repository Types

Common repository types include:

* `warehouse` - Main storage facility
* `zone` - Area within a warehouse
* `aisle` - Row within a zone
* `shelf` - Storage shelf
* `bin` - Individual storage container
* `staging` - Temporary staging area
* `dock` - Loading/unloading area

## Usage Example

```graphql
mutation {
  updateInventoryRepository(
    id: "repo_123"
    input: {
      name: "Updated Warehouse A - Electronics Section",
      layout: "grid_layout_v2",
      data: {
        "capacity": 10000,
        "climate_controlled": true,
        "security_level": "high",
        "operating_hours": {
          "monday": "06:00-18:00",
          "tuesday": "06:00-18:00",
          "wednesday": "06:00-18:00",
          "thursday": "06:00-18:00",
          "friday": "06:00-18:00",
          "saturday": "08:00-16:00",
          "sunday": "closed"
        },
        "equipment": ["forklifts", "conveyor_belts", "barcode_scanners"],
        "special_handling": ["ESD_protection", "temperature_monitoring"]
      },
      dataTypeSlug: "electronics_warehouse"
    }
  ) {
    inventoryRepository {
      id
      name
      type
      layout
      parentID
      data
      dataTypeSlug
      updatedAt
      updatedBy
    }
    workflows {
      id
      type
      status
      runID
    }
  }
}
```

## JavaScript Example

```javascript
const UPDATE_INVENTORY_REPOSITORY = gql`
  mutation UpdateInventoryRepository($id: ID!, $input: UpdateRepositoryInput!) {
    updateInventoryRepository(id: $id, input: $input) {
      inventoryRepository {
        id
        name
        type
        layout
        parentID
        data
        dataTypeSlug
        updatedAt
        updatedBy
      }
      workflows {
        id
        type
        status
        runID
      }
    }
  }
`;

const { data } = await client.mutate({
  mutation: UPDATE_INVENTORY_REPOSITORY,
  variables: {
    id: "repo_123",
    input: {
      name: "Updated Warehouse A - Electronics Section",
      layout: "grid_layout_v2",
      data: {
        capacity: 10000,
        climate_controlled: true,
        security_level: "high",
        operating_hours: {
          monday: "06:00-18:00",
          tuesday: "06:00-18:00",
          wednesday: "06:00-18:00",
          thursday: "06:00-18:00",
          friday: "06:00-18:00",
          saturday: "08:00-16:00",
          sunday: "closed"
        },
        equipment: ["forklifts", "conveyor_belts", "barcode_scanners"],
        special_handling: ["ESD_protection", "temperature_monitoring"]
      },
      dataTypeSlug: "electronics_warehouse"
    }
  }
});
```

## Breaking Changes

The following breaking changes were introduced in this version:

1. **parentID field type changed**: The `parentID` field changed from `UUID` to `ID` (edge reference).
2. **clearParentID renamed to clearParent**: The field to clear the parent association has been renamed from `clearParentID` to `clearParent`.
3. **New child management fields**: Added `addChildIDs`, `removeChildIDs`, and `clearChildren` fields for managing child repository relationships.

## Usage Example: Managing Parent-Child Relationships

### Set a Parent Repository

```graphql
mutation {
  updateInventoryRepository(
    id: "shelf-123"
    input: {
      parentID: "warehouse-456"
    }
  ) {
    inventoryRepository {
      id
      name
      parentID
      parent {
        id
        name
      }
    }
  }
}
```

### Clear Parent Association

```graphql
mutation {
  updateInventoryRepository(
    id: "shelf-123"
    input: {
      clearParent: true
    }
  ) {
    inventoryRepository {
      id
      name
      parentID
    }
  }
}
```

### Add Child Repositories

```graphql
mutation {
  updateInventoryRepository(
    id: "warehouse-456"
    input: {
      addChildIDs: ["shelf-789", "shelf-101"]
    }
  ) {
    inventoryRepository {
      id
      name
      children {
        id
        name
      }
    }
  }
}
```

### Remove Child Repositories

```graphql
mutation {
  updateInventoryRepository(
    id: "warehouse-456"
    input: {
      removeChildIDs: ["shelf-789"]
    }
  ) {
    inventoryRepository {
      id
      name
      children {
        id
        name
      }
    }
  }
}
```

## Important Notes

* **Hierarchy Changes**: Updating the `parentID` changes the repository's position in the storage hierarchy
* **Layout Updates**: Changing the layout may affect how items are organized within the repository
* **Workflow Triggers**: Updates may trigger workflows for capacity planning or reorganization
* **Movement Associations**: Be careful when modifying movement associations as it affects inventory tracking
* **Data Validation**: The system validates that repository configurations are consistent with business rules
* **Child Management**: Use `addChildIDs` and `removeChildIDs` to manage child repositories. Using `clearChildren` will disassociate all child repositories.


---

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