> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getlurk.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Resets, supply and expiry

> Set a unit back to 0, limit how much can ever be given, and make what is given expire after some days or on a date.

Four switches on a [unit](https://docs.getlurk.com/units.md) limit it over time: `resets`, `supply`, `expires_after_days` and `expires_at`.

## Resets

A unit with `resets` on can be set back to 0 by a rule, whichever way the unit goes: a season's XP, a month's visit count. Pair it with a schedule.

```json theme={null}
{
  "name": "Season ends",
  "when": { "schedule": { "every": "month", "at": "00:00", "on": 1 } },
  "do": [{ "unit": "xp", "reset": true }]
}
```

It writes one receipt for each person it changed, with the balance after (0). A person already at 0 gets none. A streak's own `reset` is on [Rules](https://docs.getlurk.com/rules.md#a-streak-counts-days-in-a-row).

## A limited supply

`switches.supply` is the most that can ever be given in all, across everyone: "40 in all".

```json theme={null}
{ "name": "Founder", "group": "badge", "switches": { "cap": 1, "supply": 40 } }
```

* It counts what is given from when the supply is set. `stats.issued` says how much.
* When it has run out, a rule that would give it is skipped with the reason `supply_gone`, and a give by hand that is more than is left is refused whole.
* Taking it back (an undo) does not give the supply back: it was given.
* A supply cannot be set below what has already been given.

## Expiry

`switches.expires_after_days` takes back what was given after that many days.

```json theme={null}
{ "name": "Beans", "group": "points", "switches": { "expires_after_days": 30 } }
```

* It applies to what is given from now on. What was there before keeps its place and never expires.
* Spending uses what expires first, so what is spent does not expire.
* Each hour the worker takes back what has expired, one receipt per person (`via: "system"`, by `system:expiry`), so balances and receipts always agree.
* An undo of a take gives the balance back without an expiry.
* Turning it off forgets the clock: what is already given stays.

## An end date

`switches.expires_at` ends the whole unit at a moment: a ticket for an event on a date. Nothing is given after it, and what is held then expires and is taken back, whatever `expires_after_days` says. It must be in the future when you set it; `null` removes it.

```json theme={null}
{ "name": "Summer ticket", "group": "perk", "shows_as": "thing", "switches": { "expires_at": "2027-06-30T23:59:00Z" } }
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.