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

# Delete Inventory Repository

Delete Inventory Repository Mutation

Deletes an existing Repository object from the system.

## Arguments

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

## Return Type

`InventoryRepositoryDeletePayload!` - Contains information about the deleted repository and related workflows.

## Return Fields

`InventoryRepositoryDeletePayload`:

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

## Usage Example

```graphql
mutation {
  deleteInventoryRepository(id: "repo_123") {
    deletedID
    workflows {
      type
      id
      runID
      status
      startedAt
      completedAt
      result
      failure
    }
  }
}
```

## JavaScript Example

```javascript
const DELETE_INVENTORY_REPOSITORY = gql`
  mutation DeleteInventoryRepository($id: ID!) {
    deleteInventoryRepository(id: $id) {
      deletedID
      workflows {
        type
        id
        runID
        status
        startedAt
        completedAt
        result
        failure
      }
    }
  }
`;

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

console.log(`Deleted repository with ID: ${data.deleteInventoryRepository.deletedID}`);

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

## Important Notes

* **Stock Validation**: The system will prevent deletion if the repository contains inventory stock
* **Child Repositories**: Parent repositories cannot be deleted if they have child repositories
* **Active Movements**: Repositories with pending or active movements cannot be deleted
* **Workflow Triggers**: Deletion may trigger workflows for:
  * Stock consolidation and transfer
  * Layout reconfiguration
  * Capacity reallocation
  * System cleanup processes
* **Hierarchical Impact**: Deleting a repository affects the storage hierarchy structure
* **Authorization**: Ensure you have proper permissions before deleting repositories
* **Audit Trail**: Deletion events are logged for compliance and audit purposes
* **Recovery**: Once deleted, the repository cannot be recovered through the API

## Pre-deletion Checklist

Before deleting a repository, ensure:

1. **Empty Stock**: All inventory items have been moved out
2. **No Child Repositories**: All child repositories have been deleted or reassigned
3. **No Pending Movements**: All movements to/from this repository are completed
4. **No Active Orders**: No picking or receiving orders reference this repository
5. **Proper Authorization**: You have the necessary permissions
6. **Business Impact**: Stakeholders are aware of the deletion

## Related Operations

After deleting a repository, you may need to:

* Redistribute stock to other repositories
* Update warehouse layouts and capacity calculations
* Modify picking and receiving processes
* Update location mappings in related systems


---

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