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

# Limits

> Give each plan its own cap on projects, members or repos, enforced in one call, so every limit becomes an upgrade moment.

> **Free:** 1 project. **Pro:** 10 projects. **Business:** unlimited projects.

Give each plan its own cap on projects, members or connected repos, and Ledger enforces it: a customer at their limit is stopped before they create one more, right when an upgrade makes sense.

A `held` feature is a count the customer holds at once. It carries from period to period, unlike a metered allowance. Your app adds to the count when the customer creates one and removes from it when they delete one, and Ledger holds the count to the plan's limit. To bill for the count as well, give the item a [seat price](https://docs.integrateledger.com/pricing/per-seat.md).

## The catalog

```ts ledger.config.ts theme={"system"}
import { defineCatalog, feature, plan } from "integrateledger-cli";

export default defineCatalog({
	features: [feature({ id: "projects", name: "Projects", type: "held" })],
	plans: [
		plan({
			id: "free",
			name: "Free",
			monthlyCredits: 0,
			priceCents: 0,
			items: [{ featureId: "projects", included: 1 }],
		}),
		plan({
			id: "pro",
			name: "Pro",
			monthlyCredits: 0,
			priceCents: 2000,
			items: [{ featureId: "projects", included: 10 }],
		}),
		plan({
			id: "business",
			name: "Business",
			monthlyCredits: 0,
			priceCents: 9900,
			items: [{ featureId: "projects", unlimited: true }],
		}),
	],
	creditPacks: [],
});
```

```json ledger.catalog.json theme={"system"}
{
  "schemaVersion": 1,
  "features": [{ "id": "projects", "name": "Projects", "type": "held" }],
  "plans": [
    { "id": "free", "name": "Free", "monthlyCredits": 0, "priceCents": 0,
      "items": [{ "featureId": "projects", "included": 1 }] },
    { "id": "pro", "name": "Pro", "monthlyCredits": 0, "priceCents": 2000,
      "items": [{ "featureId": "projects", "included": 10 }] },
    { "id": "business", "name": "Business", "monthlyCredits": 0, "priceCents": 9900,
      "items": [{ "featureId": "projects", "unlimited": true }] }
  ],
  "addOns": []
}
```

For a held item, `included` is the most the customer may hold at once.

## Add, remove and set the count

* **Check before creating one.** `check` with `quantity` asks whether the customer can hold that many more (default 1).
* **Add** with `track` and `quantity: 1` once the project exists.
* **Remove** with `track` and `quantity: -1` when it's deleted. A remove at 0 applies nothing.
* **Set the count outright** with `count`, to reconcile with your app's own records. It applies even above the limit, since it reports what exists.

Each track needs its own `request_id`, as any track does, so a retried add or remove counts once.

```typescript TypeScript theme={"system"}
// Can this customer create one more project?
const { allowed } = await billing.checkCredits({
	customerId: "user_123",
	featureId: "projects",
	quantity: 1,
});

// A project was created.
await billing.trackUsage({
	customerId: "user_123",
	featureId: "projects",
	requestId: "project_created_p_81",
	quantity: 1,
});

// A project was deleted.
await billing.trackUsage({
	customerId: "user_123",
	featureId: "projects",
	requestId: "project_deleted_p_81",
	quantity: -1,
});

// Reconcile: the customer has 4 projects.
await billing.trackUsage({
	customerId: "user_123",
	featureId: "projects",
	requestId: "projects_sync_2026_11_23",
	count: 4,
});
```

```python Python theme={"system"}
# Can this customer create one more project?
decision = billing.check_credits(
    customer_id="user_123", feature_id="projects", quantity=1
)

# A project was created.
billing.track_usage(
    customer_id="user_123",
    feature_id="projects",
    request_id="project_created_p_81",
    quantity=1,
)

# A project was deleted.
billing.track_usage(
    customer_id="user_123",
    feature_id="projects",
    request_id="project_deleted_p_81",
    quantity=-1,
)

# Reconcile: the customer has 4 projects.
billing.track_usage(
    customer_id="user_123",
    feature_id="projects",
    request_id="projects_sync_2026_11_23",
    count=4,
)
```

```bash cURL theme={"system"}
# Can this customer create one more project?
curl https://api.integrateledger.com/v1/check \
  -H "Authorization: Bearer $LEDGER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"customerId": "user_123", "featureId": "projects", "quantity": 1}'

# A project was created.
curl https://api.integrateledger.com/v1/track \
  -H "Authorization: Bearer $LEDGER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"customerId": "user_123", "featureId": "projects", "request_id": "project_created_p_81", "quantity": 1}'

# A project was deleted.
curl https://api.integrateledger.com/v1/track \
  -H "Authorization: Bearer $LEDGER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"customerId": "user_123", "featureId": "projects", "request_id": "project_deleted_p_81", "quantity": -1}'

# Reconcile: the customer has 4 projects.
curl https://api.integrateledger.com/v1/track \
  -H "Authorization: Bearer $LEDGER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"customerId": "user_123", "featureId": "projects", "request_id": "projects_sync_2026_11_23", "count": 4}'
```

## What check and track return

For a held feature, `balance.used` is the count held now and `remaining` is how many more fit. A Pro customer who holds 3 projects and adds one gets:

```json Response theme={"system"}
{
  "allowed": true,
  "availableCredits": 0,
  "chargedCredits": 0,
  "overageCredits": 0,
  "overageRemainingCents": null,
  "request_id": "project_created_p_81",
  "idempotent": false,
  "featureType": "held",
  "chargedQuantity": 1,
  "balance": { "included": 10, "used": 4, "remaining": 6, "overageAllowed": false, "resetsAt": null }
}
```

`chargedQuantity` is the change applied: `-1` for a remove, `0` for a remove at 0, and the difference for a `count`. `resetsAt` is always `null`, since a held count never resets.

When the customer holds 10 and asks for one more, `check` answers `allowed: false` with `reason: "limit_reached"`, and the track is refused:

```json Response (409) theme={"system"}
{
  "error": "limit_reached",
  "message": "This use would pass the feature's allowance or limit for customer \"user_123\"; nothing was charged. Its balance says what's left. Wait for the next period, or move the customer to a plan with more.",
  "balance": { "included": 10, "used": 10, "remaining": 0, "overageAllowed": false, "resetsAt": null }
}
```

The count stays as it was, so this is the moment to offer the upgrade, before the project is created. A customer whose plan has no item for the feature gets `feature_not_in_plan`, and one with no plan `no_plan`. On an unlimited item, `included` and `remaining` are `null` and every add is allowed.

## Rules

* **The count carries over.** It carries from period to period and across plan changes. It's the customer's, not the plan's.
* **Downgrades keep what the customer holds.** A customer who holds 8 projects and moves to a plan with 1 keeps all 8: `remaining` is 0, removes work, and adds resume once the count is under the new limit. Your app decides whether to archive the extras.
* **Charge per unit with a seat price.** A held item bills through a [seat price](https://docs.integrateledger.com/pricing/per-seat.md) rather than an overage price, and an add past the limit is refused.
* **Entity plans set limits by scope.** An entity's `own` plans give a limit only it uses, then it draws on the shared limit; see [held limits by scope](https://docs.integrateledger.com/pricing/entity-plans.md#held-limits-by-scope).
* **Check without `reserve`.** A held feature answers `check` directly; `reserve` on it returns `400 reserve_not_supported`.
* **Send `quantity` or `count`, one of the two.** `count` is for held features, and a held feature's `quantity` is non-zero.

## Related

* [Per-seat pricing](https://docs.integrateledger.com/pricing/per-seat.md): bill for the count held.
* [Feature flags](https://docs.integrateledger.com/pricing/feature-flags.md): on or off, with no count.
* [Metered allowances](https://docs.integrateledger.com/pricing/metered.md): a count of uses that resets each period.


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