Skip to content

Subjects API

The subjects endpoints, each in TypeScript, Python, the CLI and curl.

Terminal window
npm install @limitry/sdk
export LIMITRY_API_KEY="lim_test_…"

To pass the key yourself, use createClient({ apiKey: key }) in TypeScript or Limitry(api_key=key) in Python.

GET /v1/subjects/{subjectKind}/{subjectId} Try it in the API playground (opens in a new tab)

Scope: limits:read.

Returns a subject: its billing date, the day its billing_date limits start each new period, its name and labels if you gave it any, its budgets, and the subjects it’s checked with.

import { createClient } from "@limitry/sdk";
// Uses the LIMITRY_API_KEY environment variable.
const limitry = createClient();
const subject = await limitry.subjects.get("team", "team_42");
console.log(subject);

Returns:

{
"subject": {
"kind": "user",
"id": "user_123"
},
"billingAnchorAt": "2026-03-17T14:30:00.000Z",
"name": "Sara Khan",
"labels": {
"plan": "pro"
},
"budgets": [
{
"limitId": "lmt_6f1c2a9e-4b7d-4e3a-9c5f-8d2b1a0e7c34",
"limitName": "AI budget",
"unit": "cents",
"window": "month",
"amount": 200,
"used": 120,
"remaining": 80,
"credited": 0,
"resetsAt": "2026-12-01T00:00:00.000Z"
}
],
"links": [
{
"subject": {
"kind": "user",
"id": "user_123",
"name": "Sara Khan"
},
"direction": "within",
"limitId": "lmt_6f1c2a9e-4b7d-4e3a-9c5f-8d2b1a0e7c34",
"limitName": "Team AI budget",
"unit": "cents",
"periodStart": "2026-11-01T00:00:00.000Z",
"spent": 120,
"allowed": 4,
"refused": 1
}
]
}
Field Description
subjectKind string, path, required The subject kind's ID.
subjectId string, path, required The subject's ID.
More about this endpoint

A subject is one of yours, such as a user, a team or an agent. It exists once a check names it. Its links say what was spent within each budget this period: within another subject’s budget, or another subject within its own.

PATCH /v1/subjects/{subjectKind}/{subjectId} Try it in the API playground (opens in a new tab)

Scope: limits:write.

Sets a subject’s billing date, its name, its labels, or any of them.

import { createClient } from "@limitry/sdk";
// Uses the LIMITRY_API_KEY environment variable.
const limitry = createClient();
const subject = await limitry.subjects.update("team", "team_42", {
billingAnchorAt: "2026-03-17T14:30:00Z",
name: "Design team",
labels: {
plan: "pro",
},
});
console.log(subject);

Returns:

{
"subject": {
"kind": "user",
"id": "user_123"
},
"billingAnchorAt": "2026-03-17T14:30:00.000Z",
"name": "Sara Khan",
"labels": {
"plan": "pro"
}
}
Field Description
subjectKind string, path, required The subject kind's ID.
subjectId string, path, required The subject's ID.
billingAnchorAt string The moment the subject's periods start from, in ISO 8601, such as a subscription's start.
name string A name people can read, up to 200 characters. Optional. Names don't have to be unique. Send null to clear it.
labels object Labels to filter by, such as a plan or a region: up to 20 keys of up to 40 characters, with values of up to 200. Optional. They replace the subject's labels. Send null to clear them.
More about this endpoint

A field you leave out stays as it is, and null clears a name or labels. Labels you send replace the subject’s labels. The billing date is the moment the subject’s billing_date limits count their periods from, usually the subscription’s start, set from your billing system’s webhook. The subject’s allowance then resets on its own billing day, and a monthly limit still resets monthly on an annual plan. A name and labels are optional, and checks never need them. With a personal access token, the owner and admins can call this. Members can call it in test only, and guests can’t. A workspace API key with this scope can.

GET /v1/subjects/{subjectKind}/{subjectId}/standing Try it in the API playground (opens in a new tab)

Scope: limits:read.

Returns where one subject stands on every enabled limit, exact as of now.

import { createClient } from "@limitry/sdk";
// Uses the LIMITRY_API_KEY environment variable.
const limitry = createClient();
const result = await limitry.subjects.standing("team", "team_42");
console.log(result);

Returns:

{
"subject": {
"kind": "user",
"id": "user_123"
},
"limits": [
{
"limitId": "lmt_6f1c2a9e-4b7d-4e3a-9c5f-8d2b1a0e7c34",
"limitName": "AI budget",
"subject": {
"kind": "user",
"id": "user_123"
},
"action": "ai-call",
"unit": "cents",
"window": "month",
"rolling": false,
"amount": 200,
"used": 5,
"remaining": 195,
"credited": 0,
"resetsAt": "2026-12-01T00:00:00.000Z"
}
]
}
Field Description
subjectKind string, path, required The subject kind's ID.
subjectId string, path, required The subject's ID.
shared string, query Shared subjects to include, as comma-separated kind:id pairs. Send up to 4.
More about this endpoint

It covers the subject’s own limits and the limits on its shared subjects. List the shared subjects in shared, such as team:team_42. Each limit shows what’s used, what’s left and when it resets. Use it to show your users where they stand. Call it from your server with your key, never from a browser. It isn’t a check, so it counts nothing. A subject with no limits returns an empty limits list.

POST /v1/subjects/{subjectKind}/{subjectId}/reset Try it in the API playground (opens in a new tab)

Scope: limits:write.

Resets one limit on a subject now, or every limit on it.

import { createClient } from "@limitry/sdk";
// Uses the LIMITRY_API_KEY environment variable.
const limitry = createClient();
const result = await limitry.subjects.reset("team", "team_42", {
limitId: "lmt_6f1c2a9e-4b7d-4e3a-9c5f-8d2b1a0e7c34",
});
console.log(result);

Returns:

{
"subject": {
"kind": "user",
"id": "user_123"
},
"limitIds": [
"lmt_6f1c2a9e-4b7d-4e3a-9c5f-8d2b1a0e7c34"
]
}
Field Description
subjectKind string, path, required The subject kind's ID.
subjectId string, path, required The subject's ID.
limitId string The one limit to reset. Default: every limit on the subject.
More about this endpoint

Send limitId for one limit, or {} for all of them. Use it for goodwill, a promotion or support. The schedule doesn’t move, so the next reset still happens when it normally would. A balance goes back to its amount, and the reset skips concurrent limits. With an Idempotency-Key, a repeated request resets only once. With a personal access token, the owner and admins can call this. Members can call it in test only, and guests can’t. A workspace API key with this scope can.

DELETE /v1/subjects/{subjectKind}/{subjectId}/names Try it in the API playground (opens in a new tab)

Scope: limits:write.

Erases the name and labels you gave a subject.

import { createClient } from "@limitry/sdk";
// Uses the LIMITRY_API_KEY environment variable.
const limitry = createClient();
await limitry.subjects.names.delete("team", "team_42");

Returns nothing (204).

Field Description
subjectKind string, path, required The subject kind's ID.
subjectId string, path, required The subject's ID.
More about this endpoint

Its limits, usage and billing date stay, because they’re kept by its ID. Use it when one of your users asks you to delete their data. Erasing a subject with no name or labels succeeds too. With a personal access token, the owner and admins can call this. Members can call it in test only, and guests can’t. A workspace API key with this scope can.

Scope: limits:write.

Sets the name and labels of up to 1,000 subjects at once, such as when you first connect your user list.

import { createClient } from "@limitry/sdk";
// Uses the LIMITRY_API_KEY environment variable.
const limitry = createClient();
const result = await limitry.subjects.import({
items: [
{
kind: "team",
id: "team_42",
name: "Design team",
labels: {
plan: "pro",
},
},
],
});
console.log(result);

Returns:

{
"imported": 1
}
Field Description
items array, required The subjects to name, from 1 to 1,000: each its kind and ID, and its name, its labels or both.
More about this endpoint

Each item works like updating that subject’s name and labels: a field you leave out stays as it is, and null clears it. Limitry checks every item before it saves any, so a bad item saves nothing. With a personal access token, the owner and admins can call this. Members can call it in test only, and guests can’t. A workspace API key with this scope can.

Scope: limits:read.

Lists every subject your checks have named in this environment, and every one you named, most recently checked first.

import { createClient } from "@limitry/sdk";
// Uses the LIMITRY_API_KEY environment variable.
const limitry = createClient();
const subjects = await limitry.subjects.list();
console.log(subjects);

Returns:

{
"items": [
{
"subject": {
"kind": "user",
"id": "user_123"
},
"name": "Sara Khan",
"labels": {
"plan": "pro"
},
"lastCheckedAt": "2026-11-21T14:00:00.000Z"
}
],
"nextCursor": null
}
Field Description
limit number, query Items per page, 1–100 (default 25).
cursor string, query Opaque token from a previous page's nextCursor.
kind string, query Only subjects of this kind.
label string, query Only subjects with this label, as key:value.
q string, query Only subjects whose name or ID contains this text, in any case.
More about this endpoint

Filter by kind or by one label, and search the name or the ID with q. Results come a page at a time.