> This page is for version Preview (default).
> For other versions, use one of these documentation indexes:
> - Preview (default): https://docs.preview.paid.ai/preview/llms.txt
> - Current: https://docs.preview.paid.ai/current/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.preview.paid.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.preview.paid.ai/_mcp/server.

# Graduated pricing with an annual minimum

> Bill per page on graduated tiers, apply a negotiated discount, true up an annual minimum and report usage by department.

Brieflens runs an agent that reviews contracts and flags risky clauses. It charges per page reviewed, cheaper at volume: 12¢ a page for the first 50,000 pages a month, 8¢ up to 200,000, and 5¢ above that. Its customer Umbrella Legal, a law firm, signs a \$120,000 annual minimum with 10% off list, and wants its usage split by practice group: litigation, M\&A and employment.

This example uses:

* [Products](../../api-reference/catalog/products/create) for what Brieflens sells
* [Meters](../../api-reference/metering/meters/create) to count pages reviewed
* [Prices](../../api-reference/catalog/prices/create) for the graduated per-page rate
* [Customers](../../api-reference/customers/customers/create) and [customer units](../../api-reference/customers/customer-units/create) for the firm and its practice groups
* [Orders](../../api-reference/billing/orders/create) carrying the discount and the [commit](../../api-reference/billing/commits/create) for the minimum
* [Events](../../api-reference/metering/events/create) for each document reviewed
* [Usage summaries](../../api-reference/metering/usage-summaries/list) for reporting

> **Note**
>
> The calls below show only the request body. Every request also sends the headers listed under [request headers](../../api-reference/introduction#request-headers): `Authorization`, `Paid-Version`, the `Paid-Beta` opt-in each endpoint requires (for example `orders=v1` for orders and `events=v1` for events), and an `Idempotency-Key` on writes so you can [retry them safely](../../api-reference/idempotency).

Money amounts on prices are decimal strings in cents (`"12"` is 12¢). Amounts on commits are integers in cents (`12000000` is \$120,000.00).

## Setup \[#setup]

These calls run once, when Brieflens sets up its catalog.

[Create a product](../../api-reference/catalog/products/create) for document review:

**`POST /v1/products`**

```json title="POST /v1/products"
{
  "externalId": "doc_review",
  "name": "Document review"
}
```

[Create a meter](../../api-reference/metering/meters/create) that sums the `pages` field of every `document.reviewed` event:

**`POST /v1/meters`**

```json title="POST /v1/meters"
{
  "key": "pages_reviewed",
  "name": "Pages reviewed",
  "eventNames": ["document.reviewed"],
  "measure": {
    "type": "events",
    "events": {
      "aggregation": {
        "type": "sum",
        "sum": { "path": "payload.pages" }
      },
      "unit": "page"
    }
  }
}
```

[Create a usage price](../../api-reference/catalog/prices/create) on that meter with graduated tiers. Each tier is charged at its own rate, and the tiers reset every billing period (`tierScope` defaults to `billingPeriod`):

**`POST /v1/prices`**

```json title="POST /v1/prices"
{
  "product": "doc_review",
  "currency": "usd",
  "type": "usage",
  "usage": {
    "meter": "pages_reviewed",
    "pricing": {
      "type": "graduated",
      "graduated": {
        "tiers": [
          { "upTo": "50000", "unitAmount": "12" },
          { "upTo": "200000", "unitAmount": "8" },
          { "upTo": null, "unitAmount": "5" }
        ]
      }
    }
  }
}
```

The response returns the price's ID, `prc_4Lm9Tz` in this example.

## Signing Umbrella Legal \[#signing-umbrella-legal]

[Create the customer](../../api-reference/customers/customers/create):

**`POST /v1/customers`**

```json title="POST /v1/customers"
{
  "externalId": "umbrella-legal",
  "name": "Umbrella Legal",
  "currency": "usd",
  "taxIds": [{ "type": "gbVat", "value": "GB123456789" }]
}
```

[Create an order](../../api-reference/billing/orders/create) for the 2027 term. It carries the page price, Net 45 payment terms, the 10% discount in `negotiatedPricing` and the \$120,000 minimum in `commits`. Both are created with the order and apply to this order only:

**`POST /v1/orders`**

```json title="POST /v1/orders"
{
  "customer": "umbrella-legal",
  "externalId": "umbrella-legal-2027",
  "startsAt": "2027-01-01T00:00:00Z",
  "endsAt": "2028-01-01T00:00:00Z",
  "billingCycle": { "interval": "month" },
  "paymentTerms": "net45",
  "lines": [
    { "type": "price", "price": { "price": "prc_4Lm9Tz" } }
  ],
  "negotiatedPricing": [
    {
      "key": "enterprise_discount",
      "type": "discount",
      "discount": {
        "type": "percentage",
        "percentage": { "percentOff": "10" }
      },
      "target": {
        "type": "product",
        "product": { "product": "doc_review" }
      }
    }
  ],
  "commits": [
    {
      "type": "invoicedMinimum",
      "name": "2027 minimum",
      "amount": 12000000,
      "currency": "usd",
      "period": "term"
    }
  ]
}
```

The discount has no `startsAt` or `endsAt`, so it lasts as long as the order. With `period: "term"`, the minimum is measured once across the whole year rather than each month.

The order is created as a draft. [Activate it](../../api-reference/billing/orders/activate) to start billing; the request has no body:

**`POST /v1/orders/ord_7Hb2Qx/activate`**

```text title="POST /v1/orders/ord_7Hb2Qx/activate"
```

### Practice groups \[#practice-groups]

Model the practice groups as [customer units](../../api-reference/customers/customer-units/create). Create the root unit for the firm first:

**`POST /v1/customers/umbrella-legal/units`**

```json title="POST /v1/customers/umbrella-legal/units"
{
  "externalId": "umbrella-legal",
  "name": "Umbrella Legal",
  "kind": "firm"
}
```

Then one unit per practice group under it:

**`POST /v1/customers/umbrella-legal/units`**

```json title="POST /v1/customers/umbrella-legal/units"
{
  "externalId": "litigation",
  "parent": "umbrella-legal",
  "name": "Litigation",
  "kind": "practiceGroup"
}
```

And the same for `m-and-a` (M\&A) and `employment` (Employment).

Units attribute usage; they don't change pricing. The graduated tiers, the discount and the minimum all apply to the firm's total pages, once.

## Sending usage \[#sending-usage]

[Send an event](../../api-reference/metering/events/create) for every document reviewed, naming the practice group in `customerUnit`. Use the document's ID as the `dedupeKey`, so a retried send isn't counted twice:

**`POST /v1/events`**

```json title="POST /v1/events"
{
  "eventName": "document.reviewed",
  "customer": "umbrella-legal",
  "customerUnit": "litigation",
  "product": "doc_review",
  "dedupeKey": "doc_8f2k1q",
  "payload": { "pages": 42, "documentType": "nda" }
}
```

To send many documents at once, use [create an event batch](../../api-reference/metering/events/create-batch) with up to 1,000 events.

## The month \[#the-month]

In January, Umbrella Legal's lawyers review 180,000 pages. The tiers split them as follows, and the 10% discount comes off each tier:

| Tier                    | Pages   | List        | After 10% off   |
| ----------------------- | ------- | ----------- | --------------- |
| First 50,000 at 12¢     | 50,000  | \$6,000.00  | \$5,400.00      |
| 50,001 to 200,000 at 8¢ | 130,000 | \$10,400.00 | \$9,360.00      |
| **Total**               | 180,000 | \$16,400.00 | **\$14,760.00** |

* **Graduated:** 50,000 × 12¢ = \$6,000.00 and 130,000 × 8¢ = \$10,400.00. No pages reach the 5¢ tier. In February the count starts again at the first tier.
* **Discount:** 10% off \$16,400.00 is \$1,640.00, leaving \$14,760.00 on the invoice.
* **Minimum:** the \$14,760.00 counts toward the \$120,000 term minimum at the discounted price. [Retrieve the commit](../../api-reference/billing/commits/retrieve) (`GET /v1/commits/cmt_3Rv8Wd`) to see the running total in `balance`: after January, `consumed` is `1476000` and `remaining` is `10524000`.

If Umbrella Legal's spend for the year ends at \$112,300.00, the closing invoice adds a \$7,700.00 line for the shortfall (\$120,000.00 − \$112,300.00). At \$120,000.00 or more, it adds nothing.

## Reporting by practice group \[#reporting-by-practice-group]

[List usage summaries](../../api-reference/metering/usage-summaries/list) with `basis=invoice` to get rows that match each invoice exactly. This basis reads the posted usage charges, so a late adjustment shows up on the invoice that carried it:

**`GET /v1/usage-summaries`**

```text title="GET /v1/usage-summaries"
?customer=umbrella-legal
&meters[]=pages_reviewed
&startsAt=2027-01-01T00:00:00Z
&endsAt=2028-01-01T00:00:00Z
&granularity=billingPeriod
&basis=invoice
&groupBy[]=customerUnit
```

Grouping by `customerUnit` splits the same pages and spend by practice group. In January the rows show litigation at 96,000 pages, M\&A at 61,000 and employment at 23,000, which add up to the 180,000 pages and \$14,760.00 on the invoice. To report on one practice group alone, pass `customerUnit=litigation` instead of grouping.