Skip to content
Agentpost robot in sunglasses on a red circleAgentpost

Scopes

A scope picks the balance a line reads or changes. Each resource sets which dimensions apply. A resource refuses dimensions it does not use. A resource with no place, holder, or unit dimension uses an empty scope. Each resource and scope has its own balance, or one balance per bucket when the resource counts time.

Places and condition labels

A resource with scope.places: true requires the ID of a place in scope.placeId on each line. Each location is a place record, such as a shelf or a warehouse.

scope.condition picks a separate balance at that place, such as sample. Omit it to select the unlabeled balance. Different labels select different balances. After trimming, a label has 1 to 64 characters and uses lowercase ASCII letters, digits, underscores, and hyphens.

Holders

A resource with scope.holders: true requires a scope.holderRef on each write line. A holder reference is your app’s name for the principal, team, or other record with that balance. The holderRef at the top of a hold says who the hold is for. The one on a line selects the balance it reserves. Each line sends its own: a line without one is refused with invalid_request, and details.field is scope.holderRef.

A signed-in principal’s user token limits supported reads to the holder principal: followed by their principal ID. A supported read uses that holder when the request omits it. The token cannot read a different holder’s balance or shared stock.

Named units

A resource with settings.identity: 'instance' requires the unit ID as scope.instanceId on each line. A stock unit occupies one scope at a time. A unit that has a calendar keeps one calendar of its own, so a bucketed resource that tracks named units has both scope.places and scope.holders set to false.

Availability

A balance gives onHand, held, expected, and available for the scope. Expired holds do not count toward held. On a resource with a running balance, available subtracts what is held and includes expected supply for backorder. Reads give asOf and a balance version.

An availability query checks each line’s resource and scope without reserving anything. On resources that count time, availability answers with the smallest available quantity across the line’s buckets.

Where to act on it