> ## 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.

# Storage billed by GB-month

> Bill storage by the GB-month, time-weighted and in arrears, with a free amount on each plan.

> **Pro:** \$29 a month. 10 GB of storage free, then 25 cents a GB-month.

Bill storage for what customers really held over the month, time-weighted, past a free amount on each plan.

Storage is a [held feature](https://docs.integrateledger.com/pricing/limits.md) with a `measured` price. Your app sets the amount the customer holds whenever it changes. At each renewal, Ledger bills the month that just ended for its time-weighted average, past the free amount, on the renewal invoice.

## The catalog

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

export default defineCatalog({
	features: [feature({ id: "storage_mb", name: "Storage", type: "held" })],
	plans: [
		plan({
			id: "pro",
			name: "Pro",
			monthlyCredits: 1000,
			priceCents: 2900,
			items: [
				{
					featureId: "storage_mb",
					unlimited: true,
					price: {
						model: "measured",
						billingUnits: 1024,
						includedQuantity: 10,
						unitAmountCents: 25,
					},
				},
			],
		}),
	],
	creditPacks: [],
});
```

```json ledger.catalog.json theme={"system"}
{
  "schemaVersion": 1,
  "features": [{ "id": "storage_mb", "name": "Storage", "type": "held" }],
  "plans": [
    { "id": "pro", "name": "Pro", "monthlyCredits": 1000, "priceCents": 2900,
      "items": [{ "featureId": "storage_mb", "unlimited": true,
        "price": { "model": "measured", "billingUnits": 1024, "includedQuantity": 10, "unitAmountCents": 25 } }] }
  ],
  "addOns": []
}
```

* `price.model` is `measured`: billed in arrears for the amount held over each period.
* `billingUnits` is how many held units make one billed unit (default 1). Held counts are whole numbers, so count storage in MB and bill per GB: 1,024 MB in a GB.
* `includedQuantity` is the free GB-months each period (default 0).
* `unitAmountCents` is the price of one GB-month. For prices that fall with volume, use `tiers` and `tiersMode` instead, as [seat tiers](https://docs.integrateledger.com/pricing/tiers.md) do.
* `included` (or `unlimited: true`) is still the most the customer may hold: an add past it is refused with `limit_reached`.

## Set the amount

Send what the customer holds now with `count`, whenever it changes: an upload, a delete, or a nightly sync.

```typescript TypeScript theme={"system"}
await billing.trackUsage({
	customerId: "user_123",
	featureId: "storage_mb",
	requestId: "storage_sync_2026_11_23",
	count: 51200, // 50 GB
});
```

```python Python theme={"system"}
billing.track_usage(
    customer_id="user_123",
    feature_id="storage_mb",
    request_id="storage_sync_2026_11_23",
    count=51200,  # 50 GB
)
```

```bash cURL theme={"system"}
curl https://api.integrateledger.com/v1/track \
  -H "Authorization: Bearer $LEDGER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"customerId": "user_123", "featureId": "storage_mb", "request_id": "storage_sync_2026_11_23", "count": 51200}'
```

`quantity: 1024` adds a GB and `quantity: -1024` removes one, as on any held feature. [Limits](https://docs.integrateledger.com/pricing/limits.md#add-remove-and-set-the-count) has the calls.

## How it's billed

* **Time-weighted.** 100 GB for half the month, then nothing, is 50 GB-months. What's held at the end of a period carries into the next.
* **Past the free amount, rounded up.** 50 GB-months less 10 free is 40, at 25 cents: \$10. 10.2 GB-months, with 10 free, bills 1.
* **On the renewal invoice.** One line for the period that ended, under the plan's product: "Pro – Storage, 40 unit-months". A period within the free amount adds no line, and a redelivered invoice event adds nothing.

## Annual plans, upgrades and cancellations

* **An annual plan that resets monthly** bills each month's GB-months when the month ends, on the month's own invoice, as [overage on an annual plan](https://docs.integrateledger.com/pricing/annual.md#overage-billed-monthly) is. The year's last month goes on the renewal invoice.
* **An upgrade** ends the old plan's period. Its GB-months up to the upgrade bill at the old plan's price on the new plan's next renewal, beside the new plan's own.
* **A cancellation** bills the GB-months held up to the end on the final invoice.
* **A cut-short period counts against its full length.** 100 GB for 20 days of a 30-day month is 66.7 GB-months.

## What the customer API returns

`GET /v1/customers?customerId=` adds `measured` to a measured held feature: its price and the GB-months held so far this period, what the renewal would bill on if the period ended now.

```json Response theme={"system"}
{
  "featureId": "storage_mb",
  "type": "held",
  "unlimited": true,
  "balance": { "included": null, "used": 51200, "remaining": null, "overageAllowed": false, "resetsAt": null },
  "measured": { "unitAmountCents": 25, "billingUnits": 1024, "includedQuantity": 10, "unitMonthsSoFar": 25 }
}
```

`balance.used` is what's held now, in MB. `unitAmountCents` is `null` when tiers price it. [`GET /v1/plans`](https://docs.integrateledger.com/api-reference/plans/list) lists the price with its `model` and `billingUnits`.

## Rules

* **Measured prices go on held items.** A measured price takes `unitAmountCents` or `tiers`, one of the two, with no `proration`; metered, credits and boolean items take no `price`.
* **Annual plans reset monthly.** An [annual plan](https://docs.integrateledger.com/pricing/annual.md) with a measured price sets `resetInterval: "month"` (`annual_measured_not_supported`).
* **Measured prices recur.** They go on monthly and annual plans; a [lifetime plan](https://docs.integrateledger.com/pricing/lifetime.md) refuses them (`one_off_plan_cannot_bill_later`).
* **A price change is a new version.** Changing the price publishes a new [plan version](https://docs.integrateledger.com/billing/plan-versions.md).

## Related

* [Per-seat pricing](https://docs.integrateledger.com/pricing/per-seat.md): a held count billed in advance.
* [Limits](https://docs.integrateledger.com/pricing/limits.md): a held count without a price.
* [Tiered pricing](https://docs.integrateledger.com/pricing/tiers.md): bands that fall with volume.


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