# rebuildInventoryStock

Audience: Programmer

Recomputes the acting tenant's stock rows from its movement history.

Recomputes the acting tenant's stock rows from its movement history.
Requires ROLE_ADMIN on the acting tenant. Event emission is suppressed
for the rebuild: only a system caller may opt back in with
X-Pyck-Feature: syncupdates, and a tenant caller sending that header
is refused with "system caller required". A rebuild whose replay of an
executed repository movement would place a repository under itself or
one of its descendants, because a parent was changed outside repository
movements since, is refused with "unable to place a repository under
itself or one of its descendants" and leaves the stock rows unchanged.

**Served by:** [inventory](https://docs.pyck.cloud/latest/api/services/inventory.md)

## Returns

[RebuildStockOutput](https://docs.pyck.cloud/latest/api/types/rebuildstockoutput.md)

## Example

Recomputes the acting tenant's stock rows from its movement history. Requires the admin role on the tenant.

```graphql
mutation RebuildInventoryStock {
  rebuildInventoryStock {
    success
  }
}
```
