Hi,
I noticed there is now an API available in the unstable version of the GraphQL API for inventoryHistory - GraphQL Admin
However, when I try to query it I get “Access denied”, I know unstable means there is no guarantee of it working but it feels like something basic is missing.
- Is is query part of the Physical Inventory preview?
- Does it need a scope that isn’t documented like
read_inventory_history
Thanks
Hey @AdvancedApps - thanks for your patience on this, I wanted to check with the inventory team before replying. You’re right that inventoryHistory shows up in the unstable Admin GraphQL reference, but the field isn’t available to third-party apps.
I confirmed with the team that this isn’t part of the Physical Inventory preview, and there’s no read_inventory_history access scope. It’s an internal query used in some select first-party apps and is visible in unstable due to a quirk in how docs are generated. This query will never make a release candidate or stable version and the team are working on making this clearer - so thanks for flagging this here!
For reading historical inventory adjustments, they shared shopifyqlQuery against the inventory_adjustment_history dataset as the supported path (it requires the read_reports access scope).
This also came up in a previous thread where a working query was shared:
query {
shopifyqlQuery(query: "FROM inventory_adjustment_history SHOW inventory_adjustment_change GROUP BY second, inventory_adjustment_id, product_variant_sku, inventory_change_reason, inventory_state HAVING inventory_adjustment_change != 0 SINCE startOfDay(-30d) UNTIL today ORDER BY second DESC LIMIT 10000") {
parseErrors
tableData {
columns { name dataType }
rows
}
}
}
The ShopifyQL route is analytics-backed rather than real-time, and the dataset doesn’t expose quantityAfterChange. Grouping by day can also drop rows, which is why the query above groups by second and inventory_adjustment_id instead.
If ShopifyQL doesn’t cover what you’re building, share your use case and I can look into whether there’s another path. Thanks again for pointing this out!
Hey @Donal-Shopify, i don’t really get why this would not be exposed.
To illustrate a use case where this is required: As an ERP trying to build a real time 2 way stock sync, it is imperative to confirm the validity of a shared inventory ledger. To ensure that a change has propagated across the distributed system (ERP+Shopify) one needs to compare idempotency keys on ledger entries in each system. Not exposing the ledger on Shopify’s side therefore prohibits a correct stock reconciliation in certain synchronization edge cases.
This is particularly weird since the stock mutations already offer idempotency primitives, suggesting that the team is aware of the importance of ensuring correct stock synchronization across distributed systems.