# Manage customers in Limitr Cloud

> Find customers, see their usage, limits, balances, and bill, change one customer (plan, limit overrides, giving or taking an entitlement, caps, top-ups, custom prices, metadata, billing), and group them into accounts that can be billed as one invoice.

# Customers

**Customers** lists everyone your engines meter in the current mode: users, orgs, agents, or any type your policy
uses. They appear as your app creates them through the SDK, or when you add one with **New customer** (it fills in a
new unique ID and the type `user`; change either, Ex. to the ID your app already uses). Changes you make here reach
your connected engines.

## Finding customers

Search by ID or name, filter by plan and type, and sort by recently active, newest, or ID. **Usage columns** adds up
to six metered entitlements to the table. With a [segment](./segments) selected in the top bar, only its customers
show. The list stays live: with no search or filter, new customers appear at the top as your app makes them.

## One customer

A customer's page shows:

- **Usage and limits:** each entitlement this period, with a bar against its limit, what happens past it, and when it
  resets. Tags show where it differs from the plan: given, taken, or override (their own), given by or limit from a
  rule, or via the customer they refer to (Ex. their org).
- **Usage over time**, by day, for each metered entitlement.
- **Features:** the on or off entitlements they have.
- **This period:** usage, overage, and your cost per entitlement, what's been billed so far, the projected bill, and
  the margin.
- **Account:** which account they're billed in, the chain of refs that puts them there, how it's billed, and its
  latest invoices. See [Accounts](#accounts) and [Invoices](#invoices).
- **Rules** (Scale and Enterprise): the rules they have and where each comes from: given to them, a rule's
  [segment](./segments) that matches them, or a contract. Give them a rule of their own here, or take one off.
- **Contracts** (Scale and Enterprise): the contracts that reach them (by name, through their org, or through a segment), with
  the rules each puts in force now. See [Contracts](./contracts).
- **Invoices and payments**, **Balances** (grants and caps), **Related** customers (an org and its users),
  **Metadata**, **Plan history**, **Recent denials** (calls past a hard limit, a cap, or a rate limit), and
  **Activity**.

## Changing a customer

These need the **Change customers** permission (see [Team](./team#permissions)), except deleting. Customers start on
[Pay as you go](./plans-and-billing).

| Action | What it does |
|---|---|
| **Change plan** | Moves them to another plan, keeping or starting over this period's usage. Charges for the change (Ex. prorated seats) follow your plans' billing settings. |
| **Override the limit** | One customer's limit, mode, or end date for an entitlement, without a new plan. Ex. 250,000 requests instead of 100,000 for a deal. **Remove the override** goes back to the plan. |
| **Give an entitlement** | An entitlement their plan doesn't have, from another plan (optionally until a date), or back after it was taken. Ex. SSO for a two-week trial. |
| **Take it away** | Turns off an entitlement their plan has, keeping its usage. Ex. pause exports while an invoice is unpaid. |
| **Adjust usage** | Adds to, removes from, or sets a meter, Ex. to correct a mistake. |
| **Add a topup** | A topup from their plan, given at no charge or charged to them. |
| **Add a cap** | A ceiling on what they spend or what they cost you, monthly, weekly, or for good. It can deny past the ceiling, or only record and notify. |
| **Edit name, type, and IDs** | Their name, type, the customers they refer to (Ex. a user's org), and other IDs your app knows them by. |
| **Metadata** | Key and value fields on the customer, which [segments](./segments) and dashboards can use. |
| **Delete customer** | Removes them from Limitr Cloud with their meters and balances; invoices and payments are kept. If your app uses them again, it creates them again. Needs **Delete customers**. |

You can also ask the Analyst ("give Acme SSO until the end of the month"): it proposes the change on a card, and nothing
changes until you apply it. The Analyst can't adjust usage or delete customers. See [Changes you apply](./agent#changes-you-apply).

For how these work in the engine, see [Trials and custom deals](/docs/how-to/custom-deals) and
[spend caps](/docs/reference/spend-caps).

### Custom prices

On Scale and Enterprise, **Custom prices** sets a price for one customer in place of the list price (a percent change, a flat
change, or a new price), Ex. a negotiated rate on AI tokens. It comes before any rule's price. For a group of
customers, give a rule to a [segment](./policies) instead, and for a deal with a start and an end, use a
[contract](./contracts).

## Accounts

An **account** is who's billed. It's a top-level customer (one with no refs of their own, Ex. a company) and
everyone whose refs lead to it, at any depth and of any type: its teams, their users, a project. Refs decide
membership, not types.

**You don't set accounts up.** An org with users is an account as soon as its users ref it, and it's billed as one
invoice a period, with a line per user, charged to the org with the org's own billing settings (a card, approval
first, or manual billing). That covers both:

- **Self-serve:** connect the org to Stripe (it's added when it's first charged) and ref its users to it.
- **Sales-led:** put the org on a plan billed manually (or turn on manual billing on its page). Its invoice is
  collected outside Limitr, due 30 days after the period, and you **Mark paid** it on the Invoices tab.

A customer nobody refs is an account of its own, charged its invoice as always.

### Account records, for the exceptions

The **Accounts** tab lists every account with more than one customer: the defaults (marked "No record: the
default") and account records. Make a record (**New account**, or **Make an account record** on an account) when
an account needs something else:

- **Several top-level customers together** (Ex. a reseller's clients, a holding company's subsidiaries), by ID or
  by a [segment](./segments).
- **Another payer:** a member, or a Stripe customer of the account's own (Ex. a holding company with no customer of
  its own).
- **How it's collected** (**Collect by**):
  - **Card:** charged to the payer's saved card when the period closes, optionally held for approval. Charges as
    usage happens (Ex. seats) go to the payer's card too.
  - **Stripe invoice:** your Stripe sends the payer an invoice when the period closes, due in **Days to pay** (Ex.
    30 for net 30), paid by card, ACH, or bank transfer. Nothing is charged along the way: it's all on the invoice.
  - **Outside Limitr:** you collect it your way (Ex. wire or PO), with its due date in **Days to pay**, and **Mark
    paid** when it is.
- **Each member pays:** each member is charged its own invoice, as if it were on its own.
- **When periods start** (**Start on**).

Making and changing accounts needs **Change customers**; choosing who pays needs **Manage billing**. The Analyst can
propose records too ("bill Acme and its subsidiaries as one invoice, net 30"), and they change when you apply the
card.

### How an account works

- **The first ref decides.** A customer whose refs lead to more than one place belongs where its first ref leads.
  The account flags customers whose other refs lead into another account.
- **Periods line up.** Members' billing periods start on the account's dates (a record's **Start on** date, or the
  top-level customer's periods), each as long as its plan's period. A member moves onto them at its next close, with
  one shorter period, so the account's period closes together.
- **Contracts bill there.** A [contract](./contracts)'s fees and a [commitment](./contracts#commitments)'s true-up
  or prepaid draw are on its account's invoice.
- A customer's page shows its **Account**: the chain of refs that puts it there, how it's billed, and its latest
  invoices, with **Open the account**.

## Invoices

There are two kinds, and they answer different questions:

| | What it is | Where |
|---|---|---|
| **A customer's invoice** | One customer's usage and charges for its period, with its cost and margin. Every customer has one each period, for analytics, whether or not it's charged on its own. | The customer's page |
| **An account's invoice** (a group invoice) | The bill: every member's invoice for the period, added up, with the account's contract lines, what's due, and what's paid. | **Customers**, **Invoices** tab, and the account |

For an org with users, the account's invoice is what's charged, and each member's own invoice says **billed with the
account** (it links to the account's invoice). For a customer on its own, the account's invoice is just its own
invoice. For **Each member pays**, each member is charged its own invoice, and the account's invoice adds them up.

The **Invoices** tab lists every bill, newest first, with what's outstanding and overdue: filter by where each stands
(overdue, due, open while members' periods are still closing, paid), and open one to see its members, lines, and
charges, **Open in Stripe** for a Stripe invoice, **Approve** and **Retry** for charges, and **Mark paid** for one
collected outside Limitr. Top-up purchases are charged when they're bought, so they're on the customer's payments,
not on an invoice.

### Overdue invoices

An account's invoice paid by Stripe invoice or outside Limitr is due **Days to pay** after its period closes. Past
that and still unpaid, it's **overdue**: the Invoices tab marks it with how many days, and Limitr tells your team
once, through a [notification](./notifications) on **An account's invoice is overdue** (to remind the payer of a
Stripe invoice, turn on reminders in your Stripe invoice settings). Card charges that fail are retried and alerted as payments, as before.

To change service while an account owes, give its record a rule under **While an invoice is overdue**: a
[rule](./contracts#what-a-rule-can-change) from your policy (Ex. one that takes a feature, or puts a hard limit on usage). Every
customer in the account gets it while any of its invoices is overdue, and loses it as soon as they're all paid
(marked paid, or the Stripe invoice settles). Without one, nothing about service changes.

### Credits and refunds

- **Credits** (an SLA credit, goodwill, a billing mistake): on an account, **Give a credit** with an amount and why.
  It comes off the account's next bills until it's used up, however they're collected (card, Stripe invoice, or
  outside Limitr), and each bill it comes off shows it. What was billed doesn't change, only what's due. A credit
  counts against revenue when it's given; one under a [contract](./contracts#recognition) is on its recognition
  schedule. **Void** stops what's left of one.
- **A credit against one invoice:** open a bill that's still due and **Credit this invoice** ("this invoice was
  wrong"). What's due on it goes down now; a Stripe invoice gets a credit note, so the payer owes less there too, and
  a card charge that failed is retried for what's left.
- **Refunds:** **Refund** on a charge (an account's, a customer's invoice, or a topup) or a paid Stripe invoice, all
  of it or part, with why. It goes back the way it was paid, and the bill isn't owed again. A refunded topup takes
  back the refunded share of its credits, from what's still unused. A refund made in Stripe is recorded too.

Credits and refunds need **Manage billing**. The Analyst can propose either on a card ("credit Acme $500 for the
outage"), and nothing changes until you apply it.

Before accounts, a customer could be set to follow another and be charged to its card (the `conf_limitr_follower`
metadata). A follower under a top-level customer is now billed with it; for another payer, make an account record
with that customer as its payer.

## Billing a customer

Invoices close at the end of each period and are charged through your connected [Stripe](./stripe) account. On a
customer's page, **Billing settings** (with the **Manage billing** permission) can turn on manual billing or ask for
approval before charges, for that customer only. A payment waiting for approval has **Approve**; a failed one has
**Retry**.

### Changing plans mid-period

When a customer moves to another plan mid-period, the period's usage is billed at the plan it's on when the period
closes: its prices and what it includes. A plan's fee (its `subscription` entitlement, billed `on_increment`) is
prorated:

- **Each plan's fee for its part of the period**, on the invoice, with the split in the line's details.
- **An upgrade** is charged the difference for the rest of the period right away.
- **A downgrade** charges nothing. What was paid for the rest of the period is a [credit](#credits-and-refunds) on the
  customer's account, and it comes off their next charges.

A fee billed at the end of the period (`end_of_period`) isn't prorated: the period bills the plan in force at the
close.
