# Mutations / Stocktakes

# Stocktakes

**Mutation**
## adjustInventory — Returns [ProductInventory](/documentation/Objects/Products#ProductInventory)

**Scopes required:** express_stocktake

| Arguments | Type | Description |
| --- | --- | --- |
| product | [ID!](/documentation/Types/UUID#UUID) | The product to adjust the inventory of |
| outlet | [ID!](/documentation/Types/UUID#UUID) | The outlet that should be affected by the adjustment |
| cases | *Float* | Amount of cases to adjust, defaults to 0 |
| items | *Float* | Amount of items to adjust, defaults to 0 |
| override | *Boolean* | Whether the adjust overrides the current inventory or adds to the current inventory, defaults to `true` |
| barcode | *String* | The barcode that was used in this adjustment |

**Example Mutation**

```graphql
mutation AdjustInventory($product: ID!, $outlet: ID!) {
    adjustInventory(product: $product, outlet: $outlet) {
        quantity,
        singleLevel,
        caseLevel,
        reorderLevel,
        reorderLevelSingles
    }
}

# Example variables
{
    "product": "<PRODUCT>",
    "outlet": "<OUTLET>"
}
```

**Mutation**
## applyStocktake — Returns [Stocktake](/documentation/Objects/Stocktake#Stocktake)

<p class="scopes"><span class="scope scope--none">No scope required</span></p>

Updates product counts in completed stocktakes

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The id of the stocktake |
| zero | *Boolean!* | Whether the inventory of the products not in the stocktake should be zeroed or not |

**Example Mutation**

```graphql
mutation ApplyStocktake($id: ID!, $zero: Boolean!) {
    applyStocktake(id: $id, zero: $zero) {
        id,
        name,
        type,
        status,
        displayExpected
    }
}

# Example variables
{
    "id": "<ID>",
    "zero": "<ZERO>"
}
```

**Mutation**
## cancelStocktake — Returns [Stocktake](/documentation/Objects/Stocktake#Stocktake)

**Scopes required:** perform_stocktake

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The id of the stocktake to cancel |

**Example Mutation**

```graphql
mutation CancelStocktake($id: ID!) {
    cancelStocktake(id: $id) {
        id,
        name,
        type,
        status,
        displayExpected
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## completeExternalStocktake — Returns [ExternalStocktake](/documentation/Objects/Stocktake#ExternalStocktake)

**Scopes required:** perform_stocktake

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the external stocktake to complete |

**Example Mutation**

```graphql
mutation CompleteExternalStocktake($id: ID!) {
    completeExternalStocktake(id: $id) {
        id,
        zeroStock,
        overrideStock,
        status,
        timestamp
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## completeStocktake — Returns [Stocktake](/documentation/Objects/Stocktake#Stocktake)

**Scopes required:** perform_stocktake

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The id of the stocktake |
| fullStocktake | *Boolean* | Whether the stocktake is a full stocktake or a partial stocktake |
| categories | [[ID]](/documentation/Types/UUID#UUID) | The categories to include when completing the stocktake (partial stocktake only) |

**Example Mutation**

```graphql
mutation CompleteStocktake($id: ID!) {
    completeStocktake(id: $id) {
        id,
        name,
        type,
        status,
        displayExpected
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## createStocktake — Returns [Stocktake](/documentation/Objects/Stocktake#Stocktake)

**Scopes required:** perform_stocktake

| Arguments | Type | Description |
| --- | --- | --- |
| name | *String!* | The name of the stocktake |
| outlet | [ID!](/documentation/Types/UUID#UUID) | The outlet the stocktake is being performed on |
| displayExpected | *Boolean* | Whether the stocktake should display the expected inventory for the product |
| type | [StocktakeTypeEnum](/documentation/Enums/Stocktake-Type-Enum#StocktakeTypeEnum) | The type of the stocktake, Determines what happens when the stocktake is applied |

**Example Mutation**

```graphql
mutation CreateStocktake($name: String!, $outlet: ID!) {
    createStocktake(name: $name, outlet: $outlet) {
        id,
        name,
        type,
        status,
        displayExpected
    }
}

# Example variables
{
    "name": "<NAME>",
    "outlet": "<OUTLET>"
}
```

**Mutation**
## deleteExternalStocktake — Returns [ExternalStocktake](/documentation/Objects/Stocktake#ExternalStocktake)

**Scopes required:** perform_stocktake

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The ID of the external stocktake to delete |

**Example Mutation**

```graphql
mutation DeleteExternalStocktake($id: ID!) {
    deleteExternalStocktake(id: $id) {
        id,
        zeroStock,
        overrideStock,
        status,
        timestamp
    }
}

# Example variables
{
    "id": "<ID>"
}
```

**Mutation**
## stocktakeCount — Returns [Stocktake](/documentation/Objects/Stocktake#Stocktake)

**Scopes required:** perform_stocktake

| Arguments | Type | Description |
| --- | --- | --- |
| stocktake | [ID!](/documentation/Types/UUID#UUID) | The id of the stocktake |
| items | [[StocktakeCountInput]](/documentation/Inputs/Stocktake-Count-Input#StocktakeCountInput) | The list of items that are being counted |

**Example Mutation**

```graphql
mutation StocktakeCount($stocktake: ID!) {
    stocktakeCount(stocktake: $stocktake) {
        id,
        name,
        type,
        status,
        displayExpected
    }
}

# Example variables
{
    "stocktake": "<STOCKTAKE>"
}
```

**Mutation**
## updateExternalStocktakeBarcode — Returns [ExternalStocktake](/documentation/Objects/Stocktake#ExternalStocktake)

**Scopes required:** perform_stocktake

| Arguments | Type | Description |
| --- | --- | --- |
| stocktake | [ID!](/documentation/Types/UUID#UUID) | The ID of the stocktake |
| barcode | *String!* | The barcode to update the association of |
| product | [ID!](/documentation/Types/UUID#UUID) | The new product to associate the barcode within the stocktake to |
| quantity | *Float!* | The barcode quantity to use |

**Example Mutation**

```graphql
mutation UpdateExternalStocktakeBarcode($stocktake: ID!, $barcode: String!, $product: ID!, $quantity: Float!) {
    updateExternalStocktakeBarcode(stocktake: $stocktake, barcode: $barcode, product: $product, quantity: $quantity) {
        id,
        zeroStock,
        overrideStock,
        status,
        timestamp
    }
}

# Example variables
{
    "stocktake": "<STOCKTAKE>",
    "barcode": "<BARCODE>",
    "product": "<PRODUCT>",
    "quantity": "<QUANTITY>"
}
```

**Mutation**
## updateStocktake — Returns [Stocktake](/documentation/Objects/Stocktake#Stocktake)

**Scopes required:** perform_stocktake

Updates product counts in completed stocktakes

| Arguments | Type | Description |
| --- | --- | --- |
| id | [ID!](/documentation/Types/UUID#UUID) | The id of the stocktake |
| items | [[StocktakeUpdateInput]](/documentation/Inputs/Stocktake-Update-Input#StocktakeUpdateInput) | The list of items that are being updated |

**Example Mutation**

```graphql
mutation UpdateStocktake($id: ID!) {
    updateStocktake(id: $id) {
        id,
        name,
        type,
        status,
        displayExpected
    }
}

# Example variables
{
    "id": "<ID>"
}
```