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

# Execute Inventory Item Movement

Execute Inventory Item Movement Mutation

Executes a pending item movement, transferring the inventory and updating stock levels.

## Arguments

| Name | Type    | Description                   |
| ---- | ------- | ----------------------------- |
| `id` | `UUID!` | ID of the movement to execute |

## Return Type

`InventoryItemMovementOutput` - Contains the executed movement and any triggered workflows.

| Field          | Type                 | Description                               |
| -------------- | -------------------- | ----------------------------------------- |
| `itemMovement` | `ItemMovement!`      | The executed item movement                |
| `workflows`    | `[TemporalWorkflow]` | Any workflows triggered by this operation |

## Usage Example

```graphql
mutation {
  executeInventoryItemMovement(
    id: "movement-123"
  ) {
    itemMovement {
      id
      quantity
      executedAt
      executedBy
      fromRepository {
        id
        name
      }
      toRepository {
        id
        name
      }
      item {
        id
        sku
      }
      transactions {
        id
        quantity
        repositoryID
      }
    }
    workflows {
      id
      type
      status
      runID
    }
  }
}
```

## What Happens During Execution

1. **Validation**: Checks if movement can be executed
   * Movement must be pending (not already executed)
   * Not blocked by business rules
   * Sufficient stock available (unless from virtual repository)
2. **Stock Updates**:
   * Decreases stock in source repository
   * Increases stock in destination repository
   * Updates parent repository aggregations
3. **Transaction Creation**:
   * Creates outgoing transaction in source repository
   * Creates incoming transaction in destination repository
4. **Movement Update**:
   * Sets `executedAt` timestamp
   * Records `executedBy` user ID

## Error Cases

* Movement already executed
* Movement is blocked
* Insufficient stock in source repository
* Movement not found

## Notes

* Execution is atomic - either fully completes or rolls back
* Virtual repositories bypass stock validation
* Triggers any configured workflows
* Cannot be undone - create reverse movement to undo


---

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