---
title: "ResourceShark scopes"
description: "Learn how places, condition labels, holders, and named units determine which balance a request uses."
url: "https://agentpost.tools/docs/resourceshark/concepts/scopes"
kind: concept
---

# Scopes

A scope picks the balance a line reads or changes. Each [resource](/docs/resourceshark/concepts/resources.md) 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`](/docs/resourceshark/errors.md#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

-   The [ResourceShark quickstart](/docs/resourceshark/quickstart.md) holds stock at a named place.
-   [Sell prepaid credits](/docs/resourceshark/guides/prepaid-credits.md) keeps one balance per holder. [Cap a holder’s open holds](/docs/resourceshark/guides/hold-cap.md) uses a holder’s balance to enforce a cap. [Label stock conditions](/docs/resourceshark/guides/conditions.md) keeps samples in their own balance.
-   [Places](/docs/resourceshark/reference/places.md) records locations. [Availability](/docs/resourceshark/reference/availability.md) reads a scope or holder balance and checks what a line could take.
