Skip to navigation

Customer units

A customer unit is a part of a customer: a team, department, workspace, environment or person. Each customer can have a tree of units, and every event can name the unit it was for. Units change how usage is attributed and reported, never how it’s priced: a unit shares its customer’s orders, prices and invoices, so the customer gets one bill however you split it.

Use a customer unit to:

  • Report usage per team by naming the unit on each event and filtering or grouping usage summaries by it.
  • Keep test environments off the invoice by marking a unit, and everything under it, non-billable.
  • Report usage per person, because a person can be a unit too, under their team.
  • Accept usage from systems that only know a team, by giving the unit a customer alias.

Customer units are in the customer_units=v1 private beta: send Paid-Beta: customer_units=v1 with each request.

How units work

  1. Each customer has one root unit. It stands for the whole customer and is always billable. A customer created with an externalId gets its root automatically, with the same externalId.
  2. Every other unit has a parent in the same customer, up to 16 levels deep including the root. You label each level in your own words with kind, such as practiceGroup, environment or user. Paid has no fixed layers.
  3. Events name the customer, and optionally the unit. Usage on a unit counts towards its customer, and towards every unit above it in reports.
  4. Billing happens at the customer. Prices, pricing tiers and commits apply to the customer’s total, not to each unit.

A unit is the right model for part of one company that shares its contract. If part of a company signs its own contract, pays its own invoices or needs its own prices, make it a separate customer. If it still belongs to a group that pays for it, such as a subsidiary, give it the group as its parent.

Build a customer’s tree

Clausebase sells contract review, priced per page. Its customer Halberd LLP wants usage split by practice group, and runs a sandbox it shouldn’t be billed for. Clausebase builds Halberd’s tree: the firm at the root, a unit for each practice group, and a non-billable sandbox.

Halberd was created with the externalId halberd, so its root unit already exists, with the ID cu_2Rr8Wd and the same externalId. List Halberd’s units to find it: it is the one with isRoot: true. Create each unit under it, naming the parent by its cu_ ID or your externalId:

{
"externalId": "litigation",
"parent": "cu_2Rr8Wd",
"name": "Litigation",
"kind": "practiceGroup"
}

The sandbox is created the same way, with billable: false:

POST /v1/customers/cus_4Lp9Hd/units
{
"externalId": "halberd-sandbox",
"parent": "cu_2Rr8Wd",
"name": "Sandbox",
"kind": "environment",
"billable": false
}
FieldWhat it’s for
externalIdYour ID for the unit, unique across your account ignoring letter case, among unit IDs, customer external IDs and aliases. Only the root may share its customer’s externalId. Required, and can’t change.
parentThe unit it sits under: an active unit of the same customer. The customer’s root already exists, so name it to place a unit at the top of the tree.
nameShown in the dashboard and reports. Never used to look the unit up.
kindYour label for the level, up to 64 characters. Filter lists and reports by it.
billablefalse records the unit’s usage without billing it. Defaults to true.

Anywhere the API asks for a unit, pass its cu_ ID or your externalId. Your ID is resolved within the customer, ignoring letter case, so a unit path always includes the customer. A value that starts cu_ is looked up as a Paid ID first, then as your ID.

Attribute usage to a unit

Name the unit in customerUnit when you send an event. The event still names its customer:

POST /v1/events
{
"eventName": "document.reviewed",
"customer": "cus_4Lp9Hd",
"customerUnit": "litigation",
"product": "contract_review",
"dedupeKey": "doc_8f2k1q",
"payload": { "pages": 42 }
}

A unit is only ever looked up within the event’s customer, so usage can’t land on another customer’s unit. A cu_ ID that belongs to a different customer fails for that event.

If the event names a unit that doesn’t exist yet, the event is accepted but no unit is created: its usage is held until you create the unit with the same externalId, and then lands on that unit.

Report usage by unit

Usage summaries take a customerUnit filter. By default it includes everything under the unit (includeDescendants), so filtering on Litigation includes any teams you later add under it. Send includeDescendants=false for the unit’s own usage only, or groupBy=customerUnit to see every unit side by side.

Exclude a unit from billing

Set billable: false on a unit to record its usage without billing it, such as a customer’s development or QA environment. It applies to everything under the unit too: effectiveBillable is false when the unit or any unit above it has billable: false, and a unit can’t make itself billable under a non-billable one.

Usage on a unit with effectiveBillable: false:

  • adds nothing to invoices,
  • spends no credits,
  • counts towards no commit,
  • still appears in usage summaries, with zero spend.

billable: false needs non-billable units enabled on your account; ask Paid to turn them on. A change to billable applies to usage received afterwards. Usage already received keeps the billability it had. The root is always billable: a customer you never want to bill simply has no order.

How it bills

Clausebase prices contract review with graduated pricing: the first 2,000 pages in a month at 50¢ each, and every page after that at 30¢. Price amounts are in cents. In November, Halberd’s units send:

UnitPageseffectiveBillable
Litigation3,000true
M&A1,500true
Sandbox400false
StepValue
Billable pages (Litigation and M&A)3,000 + 1,500 = 4,500
Sandbox pages, recorded but not billed400
First pricing tier2,000 × 50¢ = 100,000¢
Second pricing tier(4,500 − 2,000) × 30¢ = 2,500 × 30¢ = 75,000¢
Charge100,000¢ + 75,000¢ = 175,000¢
Invoice lineContract review: $1,750.00

The pricing tiers apply to Halberd’s total. Rating each practice group on its own would have charged Litigation 2,000 × 50¢ + 1,000 × 30¢ = 130,000¢ and M&A 1,500 × 50¢ = 75,000¢, a total of $2,050.00. Units never change the price: they only change how the $1,750.00 is reported.

People and seats

A person is a unit too, usually with kind: "user" under their team. Give them their email as a customer alias, so systems that only know the email can still attribute their usage. Seats have no link to units yet; a later release may let a person’s unit hold a seat.

Change or archive a unit

Update a unit with only the fields to change: name, kind, parent, billable or metadata. externalId can’t change. metadata replaces the whole map, so send every key you want to keep. A unit whose metadata was saved with values other than strings, through the legacy API, refuses a metadata update rather than lose them.

Changing parent moves the unit with everything under it. The root can’t move, a unit can’t move under itself or anything below it, and the move can’t take any unit past 16 levels. A move changes the billability of usage received afterwards, by the same rule as changing billable.

Archive a unit when it’s gone. It stays readable and in reports, usage sent to it still lands on it, and its externalId stays reserved. archivedAt says when it was archived. Archiving fails while the unit has active units under it or an active spend cap, and the root can’t be archived. List units with includeArchived=true to see archived ones.