Skip to content

When limits reset

A limit’s allowance resets at the end of each period. Three settings decide when:

Setting Decides Example
window The unit: minute, hour, day, week, month or year month
every How many units a period lasts (default 1) every: 3 with month is a quarter
start Where each period begins calendar, billing_date or first_use

How often your customers pay doesn’t matter here. An annual plan can still reset its allowance every month. All three settings are fixed once a limit exists: to change one, create a new limit and archive the old one (see What can change).

The examples on this page give each team credits that its members spend on reports, at 25 credits a report. Unlike a prepaid balance, which never resets (see Pools, balances and budgets), these credits come back each period.

start: "calendar" is the default. Periods begin on UTC boundaries, the same for every subject:

  • day at midnight, week on Monday, month on the 1st, year on 1 January.
  • every: 3 with month resets on 1 January, April, July and October.
import { createClient } from "@limitry/sdk";
const limitry = createClient();
await limitry.limits.create({
name: "Quarterly credits",
subject: { kind: "team" },
action: "report",
amount: 15000,
unit: "credits",
window: "month",
every: 3,
});

start: "billing_date" resets each subject on its own date, its billing date. A team that subscribed on 17 March resets on the 17th of every month. Set a subject’s billing date when its subscription starts, usually from your billing webhook:

import { createClient } from "@limitry/sdk";
const limitry = createClient();
await limitry.limits.create({
name: "Monthly credits",
subject: { kind: "team" },
action: "report",
amount: 5000,
unit: "credits",
window: "month",
start: "billing_date",
});
// When the team's subscription starts (Stripe's start_date is in seconds)
await limitry.subjects.update("team", "team_42", {
billingDate: new Date(1773757800 * 1000).toISOString(),
});
  • No billing date yet: the subject’s first counted check becomes its billing date, so billing_date limits work before you set one. A reservation counts as a check here, even one you release later.
  • Annual plans: an annual subscription that started on 17 March still resets a monthly allowance on the 17th of every month. Set the billing date once, when the subscription starts.
  • Month ends: a billing date on the 31st resets on the last day of shorter months, then on the 31st again. A billing date on 29 February resets on 28 February in other years.
  • A new billing date never hands out a fresh allowance. The current period runs on until the new date, and what was used in it still counts. From then on, periods follow the new date. To start a fresh period now, for an upgrade or a re-subscribe, set the new date and then reset now.

limitry subjects get team team_42 (or limitry.subjects.get("team", "team_42") in the SDKs) shows a subject’s billingDate.

start: "first_use" starts a period at a subject’s first check and resets it a period later. Nothing runs while the subject is idle. This is how AI chat products allow “45 messages per 5 hours, starting from your first message”:

import { createClient } from "@limitry/sdk";
const limitry = createClient();
await limitry.limits.create({
name: "Messages per 5 hours",
subject: { kind: "user" },
action: "chat",
amount: 45,
window: "hour",
every: 5,
start: "first_use",
});

Before a subject’s first check, its resetsAt is null. The check that starts the period already answers when it ends. A reservation starts the period too, even one you release later.

Reset a subject’s allowance at once, for goodwill, a promotion or support. Name one limit, or send {} to reset every limit on the subject:

import { createClient } from "@limitry/sdk";
const limitry = createClient();
await limitry.subjects.reset(
"team",
"team_42",
{ limitId: "lmt_3f0c…" },
{ idempotencyKey: "ticket-8812" },
);
  • The schedule doesn’t move: the next reset is still the usual one.
  • A balance (total) goes back to its amount. Credits added before the reset no longer count.
  • A concurrent limit is skipped. Its slots belong to work that’s still running.
  • With an idempotency key, a repeated request resets once.

In the app, owners and admins can click Reset next to a subject on the Usage page.

Every limit that matches a check applies, and each resets on its own schedule. Monthly credits with a daily cap against abuse are two limits:

Limit amount window start
Monthly credits 5000 month billing_date
Daily cap 500 day calendar

Limitry refuses a team after 500 credits in a day (20 reports), even with credits left for the month. See Offer a free plan with a daily cap.

A check’s limits[].resetsAt and usage.standing say when that subject’s own period ends. For billing_date and first_use limits, that’s different for every subject. The Usage page’s Right now table shows each subject’s use and refusals in its own current period, resets included.