---
title: "ResourceShark resources"
description: "Learn how a resource defines its unit, identifies what it counts, and sets rules for supply and shortages."
url: "https://agentpost.tools/docs/resourceshark/concepts/resources"
kind: concept
---

# Resources

A resource defines one thing your product counts, such as roasted coffee, game credits, or court hours. It sets the unit of measure, the [scopes](/docs/resourceshark/concepts/scopes.md) that keep separate balances, and the rules [supply](/docs/resourceshark/concepts/supply.md) and [claims](/docs/resourceshark/concepts/claims.md) follow.

## Units

Quantities are integers in the smallest unit that the resource’s `unit.precision` allows. A resource measured in meters with precision `2` takes `125` for 1.25 meters. Precision runs from 0 to 6.

`settings.identity: 'count'` counts like units together. `settings.identity: 'instance'` gives each unit its own ID, such as the ID of a numbered bag or room. A line on that resource sends `scope.instanceId` and a quantity of `1`. The resource uses precision `0` and sets no `capacity`. It sets `settings.supplyExpiry` and `tracking` to `none`. Keep a best-before date in the unit’s attributes, and retire the unit to take it off sale. A hold or consume that names an unavailable unit answers [`assignment_infeasible`](/docs/resourceshark/errors.md#assignment_infeasible).

At the ResourceShark API root, `GET /resources/:id/free-instances` lists the units a line could take. Your app picks the unit. A page scans at most 1,000 instances, so follow `next` even when a page is empty. [Bookings](/docs/resourceshark/concepts/claims.md#bookings) covers units with calendars.

## Balances and shortages

With `settings.time: 'none'`, a resource keeps a balance for each scope. With `settings.time: 'buckets'`, it keeps a balance for each bucket in that scope. [Schedules](/docs/resourceshark/concepts/schedules.md) explains what a bucket holds.

-   `shortage: 'deny'` limits a take to the supply available now.
-   `shortage: 'backorder'` counts expected supply toward what is available.
-   `shortage: 'negative'` allows a take even if it puts the balance below zero. An individually tracked resource uses `deny` or `backorder`. A take on backorder can leave the unit’s `onHand` at `-1` until its expected supply arrives.

`settings.supplyExpiry: 'expiring'` keeps balances for individual supply entries. It requires `identity: 'count'`, `time: 'none'`, and `shortage: 'deny'` or `'negative'`. Batch tracking, `tracking: 'batch'`, requires expiring supply and `shortage: 'deny'`. [Owing](/docs/resourceshark/concepts/supply.md#owing) explains how expiring supply goes below zero.

## Changes

Tags and attributes help you find resources and select them for reports. A patch sends the resource’s version in `If-Match`. The first supply, stock write, claim, schedule save, or exception save locks the resource’s unit code and precision, `settings`, `scope`, and `tracking`, and `shortage` when its supply expires. Changing a locked field answers [`settings_locked`](/docs/resourceshark/errors.md#settings_locked). Archiving a resource takes it out of the resource list. Its record and movement history stay readable.

## Where to act on it

-   The [ResourceShark quickstart](/docs/resourceshark/quickstart.md) defines a resource that counts grams at a roastery.
-   [Resources](/docs/resourceshark/reference/resources.md) defines and edits resources. [Instances](/docs/resourceshark/reference/instances.md) records units and lists which ones are free.
