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

# Overrides

> Give any customer their own overage cap, a negotiated overage rate or their own auto top-up, on the plan they already have.

Per-customer overrides give one customer their own [overage](https://docs.integrateledger.com/pricing/overage.md) cap or a negotiated rate on the plan you already sell, for an enterprise deal or a support fix, while everyone else keeps the plan's terms.

| You want | Call | Changes |
| - | - | - |
| A higher or lower monthly cap, or no overage at all | `setCustomerOverageCap` | The customer's overage cap |
| A negotiated price for extra credits | `setCustomerOverageOverride` | The credit overage rate, and optionally its cap |
| Overage off, a free buffer, or overage recorded but not billed, or their own usage limits and alerts | `setCustomerControls` | The customer's or one entity's [controls](#overage-controls) |

Each takes effect on the customer's next `track`. Usage already recorded keeps the rate it was recorded at.

## Set a customer's cap

```typescript TypeScript theme={"system"}
await billing.setCustomerOverageCap({ customerId, body: { capCents: 5000 } });
```

```python Python theme={"system"}
billing.set_customer_overage_cap(customer_id=customer_id, cap_cents=5000)
```

```bash cURL theme={"system"}
curl "https://api.integrateledger.com/v1/customers/overage-cap?customerId=user_123" \
  -H "Authorization: Bearer $LEDGER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"capCents": 5000}'
```

```json Response theme={"system"}
{
  "customerId": "user_123",
  "capCents": 5000,
  "overage": {
    "credits": 1500,
    "costCents": 1500,
    "unitAmountCents": 1,
    "billingUnits": 1,
    "capCents": 5000,
    "capSource": "customer",
    "remainingCents": 3500,
    "source": "plan",
    "override": null,
    "periodStart": "2026-11-07T07:40:58.000Z",
    "periodEnd": "2026-12-07T07:40:58.000Z"
  }
}
```

* **`0` turns overage off** for the customer: uses past their allowance are refused.
* **`null` clears it.** The cap falls back to the customer's [override](#set-a-negotiated-rate) cap, else the plan's `overageCapCents`.
* [Which cap applies](https://docs.integrateledger.com/pricing/overage.md#which-cap-applies) has how this cap combines with the plan's.
* `overage` is the customer's current period, or `null` when their plan has no overage.

## Set a negotiated rate

An override replaces the plan's price for extra credits: `unitAmountCents` per `billingUnits` credits (default 1). This customer pays $0.01 per 2 credits on Scale, instead of the plan's $0.01 per credit:

```typescript TypeScript theme={"system"}
await billing.setCustomerOverageOverride({
	customerId,
	body: { planId: "scale", unitAmountCents: 1, billingUnits: 2 },
});
```

```python Python theme={"system"}
billing.set_customer_overage_override(
    customer_id=customer_id, plan_id="scale", unit_amount_cents=1, billing_units=2
)
```

```bash cURL theme={"system"}
curl "https://api.integrateledger.com/v1/customers/overage-override?customerId=user_123" \
  -H "Authorization: Bearer $LEDGER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"planId": "scale", "unitAmountCents": 1, "billingUnits": 2}'
```

```json Response theme={"system"}
{
  "customerId": "user_123",
  "planId": "scale",
  "override": {
    "planId": "scale",
    "unitAmountCents": 1,
    "billingUnits": 2,
    "capCents": null,
    "effectiveFrom": "2026-11-23T10:15:00.000Z"
  },
  "overage": {
    "credits": 0,
    "costCents": 0,
    "unitAmountCents": 1,
    "billingUnits": 2,
    "capCents": 2000,
    "capSource": "plan",
    "remainingCents": 2000,
    "source": "override",
    "override": {
      "planId": "scale",
      "unitAmountCents": 1,
      "billingUnits": 2,
      "capCents": null,
      "effectiveFrom": "2026-11-23T10:15:00.000Z"
    },
    "periodStart": "2026-11-07T07:40:58.000Z",
    "periodEnd": "2026-12-07T07:40:58.000Z"
  }
}
```

* **It prices credit overage**, on a plan that has credit overage terms. A metered item keeps its own overage price.
* **Scope.** `planId` applies it to one plan, across all its [versions](https://docs.integrateledger.com/billing/plan-versions.md). Leave `planId` out to apply it to whichever overage plan the customer is on, so it carries across upgrades. A plan-specific override wins over one for any plan.
* **Its own cap.** `capCents` sets a cap for this override, used when the customer has no cap of their own. Leave it out to keep the plan default.
* **Clear it** with the same `planId` and `"unitAmountCents": null`, and no other terms. The plan's rate applies again from the next track.
* **Mid-period changes** bill as a second line: the renewal invoice has one overage line per rate the period recorded.

## Overage controls

A customer's or entity's own controls replace the plan's entry with the same target: turn overage off for one account, give a design partner 10,000 free credits a period, or record a pilot's usage without billing it. The same call sets their own [usage limits](https://docs.integrateledger.com/pricing/usage-limits.md) and [usage alerts](https://docs.integrateledger.com/pricing/usage-alerts.md).

```typescript TypeScript theme={"system"}
await billing.setCustomerControls({
	customerId: "acme",
	body: {
		overage: [{ creditPool: true, freeUnits: 10000 }],
		usageLimits: [{ creditPool: true, limit: 20000, interval: "day" }],
	},
});
```

```python Python theme={"system"}
billing.set_customer_controls(
    customer_id="acme",
    controls={
        "overage": [{"creditPool": True, "freeUnits": 10000}],
        "usageLimits": [{"creditPool": True, "limit": 20000, "interval": "day"}],
    },
)
```

```bash cURL theme={"system"}
curl "https://api.integrateledger.com/v1/customers/controls?customerId=acme" \
  -H "Authorization: Bearer $LEDGER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"overage": [{"creditPool": true, "freeUnits": 10000}], "usageLimits": [{"creditPool": true, "limit": 20000, "interval": "day"}]}'
```

```json Response theme={"system"}
{
  "customerId": "acme",
  "entityId": null,
  "usageLimits": [
    { "creditPool": true, "interval": "day", "filter": null, "limit": 20000, "scope": "customer",
      "source": "customer", "used": 1200, "remaining": 18800,
      "windowStart": "2026-11-23T00:00:00.000Z", "resetsAt": "2026-11-24T00:00:00.000Z" }
  ],
  "usageAlerts": [],
  "overage": [
    { "creditPool": true, "allowed": true, "freeUnits": 10000, "billOverage": true,
      "source": "customer", "billed": 0, "unbilled": 0, "freeLeft": 10000 }
  ]
}
```

* **Each kind you send replaces that kind** at this level; a kind left out stays as it was, and `null` clears it back to the plan's.
* **Entities.** Add `entityId` to set one [entity's](https://docs.integrateledger.com/customers/entities.md) own entries; an entity's entry replaces the customer's with the same target.
* **Read what applies** with `getCustomerControls`: every entry in force, its `source` (`plan`, `customer` or `entity`), and this period's `billed`, `unbilled` and `freeLeft` for overage.

## Read the effective terms

`overage.capSource` says which cap applies: `customer`, `override`, `plan`, or `null` for no cap. [Which cap applies](https://docs.integrateledger.com/pricing/overage.md#which-cap-applies) has the order. `overage.source` says where the rate comes from: `plan`, or `override` with the override in `overage.override`.

Customers see these terms before they pay: the text Ledger adds above Checkout's Subscribe button uses the customer's own cap or rate when they have one. Read them any time with [`getCustomer`](https://docs.integrateledger.com/api-reference/customers/get): `overageCapCents` is the customer's own cap, and `overage` the effective terms this period.

## Auto top-ups

A customer's own [auto top-up](https://docs.integrateledger.com/pricing/top-ups.md#auto-top-up-per-customer) replaces their plan's default the same way: a different threshold or amount, `enabled: false` to turn it off, or `autoTopUp: null` to follow the plan again. Save it with `setCustomerAutoTopUp`.

> [!NOTE]
>
> **Other ways.** Over HTTP, see [Set overage cap](https://docs.integrateledger.com/api-reference/customers/overage-cap.md), [Set overage rate](https://docs.integrateledger.com/api-reference/customers/overage-override.md) and [Set controls](https://docs.integrateledger.com/api-reference/customers/controls.md). How overage is decided and billed is in [Overage](https://docs.integrateledger.com/pricing/overage.md).

## Rules

* Overrides and controls need a key with the **Customers** permission at Write.
* A rate override applies to a plan with credit overage terms; on a plan without them it returns `409 plan_has_no_overage`.
* An unknown `planId` returns `404 plan_not_found`.
* Controls follow the plan's rules: `400 invalid_usage_limit`, `invalid_alert` or `invalid_overage_control`, with each problem in `issues`.


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