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

# Create Inventory Repository

createInventoryRepository Mutation

Creates a new Repository in the inventory system.

## Arguments

| Name    | Type                     | Description                            |
| ------- | ------------------------ | -------------------------------------- |
| `input` | `CreateRepositoryInput!` | Input data for creating the repository |

## Return Type

`InventoryRepositoryOutput` - Contains the created repository and any associated workflows.

## Input Fields

`CreateRepositoryInput`:

| Field                                 | Type              | Description                                                                |
| ------------------------------------- | ----------------- | -------------------------------------------------------------------------- |
| `dataTypeID`                          | `UUID`            | Optional data type ID                                                      |
| `dataTypeSlug`                        | `String`          | Optional data type slug                                                    |
| `data`                                | `Map`             | Custom data associated with the repository                                 |
| `locationID`                          | `UUID`            | Optional location ID                                                       |
| `name`                                | `String!`         | Required name of the repository                                            |
| `layout`                              | `String`          | Optional layout information for the repository                             |
| `type`                                | `RepositoryType!` | Required type of the repository (dynamic or static)                        |
| `virtualRepo`                         | `Boolean`         | Whether this is a virtual repository (non-physical location)               |
| `parentID`                            | `ID`              | Optional parent repository ID (edge reference) for hierarchical structures |
| `childIDs`                            | `[ID!]`           | Optional array of child repository IDs to associate                        |
| `itemmovementtorepositoryIDs`         | `[ID!]`           | Optional item movement IDs (incoming)                                      |
| `itemmovementfromrepositoryIDs`       | `[ID!]`           | Optional item movement IDs (outgoing)                                      |
| `repositorymovementtorepositoryIDs`   | `[ID!]`           | Optional repository movement IDs (incoming)                                |
| `repositorymovementfromrepositoryIDs` | `[ID!]`           | Optional repository movement IDs (outgoing)                                |
| `repositorymovementrepositoryIDs`     | `[ID!]`           | Optional repository movement IDs                                           |
| `repositorytransactionIDs`            | `[ID!]`           | Optional transaction IDs                                                   |
| `repositorystockIDs`                  | `[ID!]`           | Optional stock IDs                                                         |

## Breaking Changes

The `parentID` field type has changed from `UUID` to `ID`. This is an edge reference field that establishes a parent-child relationship between repositories. If you were previously passing a UUID string, you should now pass the repository's GraphQL ID.

Additionally, a new `childIDs` field has been added to allow specifying child repositories during creation.

## Usage Example

```graphql
mutation {
  createInventoryRepository(
    input: {
      name: "North Warehouse",
      type: static,
      virtualRepo: false,
      data: {
        "address": {
          "street": "123 Industrial Blvd",
          "city": "Springfield",
          "postalCode": "12345",
          "country": "US"
        },
        "manager": "John Smith",
        "contactPhone": "+1-555-123-4567",
        "operatingHours": "8:00 AM - 5:00 PM"
      }
    }
  ) {
    inventoryRepository {
      id
      name
      type
      virtualRepo
      data
    }
    workflows {
      type
      id
      runID
      status
    }
  }
}
```

### Create a Child Repository

```graphql
mutation {
  # Create a child repository (shelf in a warehouse)
  createInventoryRepository(
    input: {
      name: "Shelf A1",
      type: static,
      parentID: "550e8400-e29b-41d4-a716-446655440000",
      virtualRepo: false,
      layout: "North Wall"
    }
  ) {
    inventoryRepository {
      id
      name
      type
      parentID
      parent {
        id
        name
      }
    }
  }
}
```

### Create Repository with Children

```graphql
mutation {
  # Create a repository and assign existing children
  createInventoryRepository(
    input: {
      name: "Zone A",
      type: static,
      virtualRepo: false,
      childIDs: [
        "shelf-1-id",
        "shelf-2-id"
      ]
    }
  ) {
    inventoryRepository {
      id
      name
      children {
        id
        name
      }
    }
  }
}
```


---

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