stockRecords
query · in the family Reading your records
What it does
The stock balances — what you own, where, in which bucket.
One InventoryItem StockRecord shard rows — where its stock sits in bins (zero rows = everything un-binned). Requires authentication; a cross-tenant/missing id reads as an empty list; a doomed item keeps readable shards.
Before you call
A bearer session from an API key (see Authentication and key hygiene) or a signed-in user.
Capability area: Reading your records — Looking up and listing the records of your organization.
Roles that may call it:
- Owner
- System Administrator
- Manager
- Associate Manager
- Warehouse Associate
- Sales Associate
- Cashier
- An API key whose scope allows
api:stockRecords
What happens
Reads only.
Arguments
| Name | Type | Required | Notes |
|---|---|---|---|
inventoryItemId | ID ID! | yes |
Returns
StockRecord [StockRecord!]! — Carries only the three locatable buckets (reserved is a claim overlay, in_transit is not physically here — both stay on the item caches); quantities are non-negative (a relocate refuses driving a record negative — CONFLICT/INSUFFICIENT_STOCK). The derived un-binned pool = item caches minus the record sums (see verifyInventoryItem). Records persist at zero; a zeroed record does NOT block its bin.
Example request
query ExampleStockRecords($inventoryItemId: ID!) {
stockRecords(inventoryItemId: $inventoryItemId) {
inventoryItemId
binId
lotCode
lotExpiresAt
onHandQty
damagedQty
heldQty
createdAt
updatedAt
revisionNum
}
}Variables:
{
"inventoryItemId": "01900000-0000-7000-8000-ab0d13b80000"
}Example response
{
"data": {
"stockRecords": [
{
"inventoryItemId": "01900000-0000-7000-8000-ab0d13b80000",
"binId": "01900000-0000-7000-8000-bfd16c5e0000",
"lotCode": "BJ-001",
"lotExpiresAt": "2028-01-31T00:00:00.000Z",
"onHandQty": "<on hand qty>",
"damagedQty": "<damaged qty>",
"heldQty": "<held qty>",
"createdAt": "2027-01-31T00:00:00.000Z",
"updatedAt": "2027-01-31T00:00:00.000Z",
"revisionNum": 1
}
]
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": null,
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}Errors this call can answer
VALIDATION/INVALID— Something in the request is not valid. Retry: no. (VALIDATION)AUTHN/REQUIRED— Sign in to do this. Retry: no. (AUTHN)AUTHZ/FORBIDDEN— Your role does not allow this action. Retry: no. (AUTHZ)RATE_LIMIT/THROTTLED— Too many requests in a short time. Retry: yes. (RATE_LIMIT)NOT_FOUND/*— That record could not be found. Retry: no. (NOT_FOUND)