Skip to content

Checks

Terminal window
npm install @limitry/sdk
import { createClient } from "@limitry/sdk";
const limitry = createClient(); // reads LIMITRY_API_KEY

POST /v1/checks

Asks whether subject may do action at cost, given every enabled limit that applies, and — in consume mode — uses it.

await limitry.checks.create({
subject: {
kind: "user",
id: "usr_123",
},
action: "ai-call",
});
FieldDescription
subjectobject, requiredWho is acting, as {"kind": "user", "id": "usr_123"}.
sharedarrayShared subjects it also draws from — a team's, org's or project's pool (at most 4). Every limit on every subject must fit; all are charged, or none.
actionstring, requiredWhat the subject wants to do.
costnumberUnits it would use. Default 1.
modestringconsume (default) decides and uses; preview decides without using; reserve decides and HOLDS cost (an estimate) until you commit the actual amount or release it — see reservation in the answer. Only a reservation takes a slot of a concurrent limit.
ttlSecondsnumberWith reserve: how long the hold lasts before it releases itself. Default 300, at most 3600.
More about this endpoint

Always 200 for a decision: read allowed; remaining shows what is left per limit and retryAfterSeconds when to try again. An Idempotency-Key header makes a retried check return the same decision without using twice. Its API-key check is cached briefly for speed: a revoked key can keep working here for up to 60 seconds.