Skip to navigation

Update a customer unit

Changes only the fields sent; externalId can’t be changed, and an archived unit can’t be changed. Changing parent moves the unit with everything under it, and fails for the root or a move under the unit’s own subtree; the unit’s spend in the running period moves with it toward its new ancestors’ spending limits. A change to billable applies to usage received afterwards, the root is always billable, and billable: false needs non-billable units enabled on your account. metadata replaces the whole map, so send every key to keep; it is refused for a unit whose saved metadata holds values other than strings, which a replace would lose. An update that changes nothing returns the unit as it is. {customer} takes the customer’s cus_ ID, your externalId, or one of its aliases. {unit} takes the unit’s cu_ ID or your unit externalId, resolved within that customer; a value starting cu_ is tried as a Paid ID first.

Authentication

AuthorizationBearer
API Key authentication using Bearer token

Path parameters

customerstringRequired1-255 characters

The customer’s cus_ ID, your externalId, or one of its aliases.

unitstringRequired1-255 characters

The unit’s cu_ ID or your externalId, within that customer. A value starting cu_ is tried as a Paid ID first.

Headers

Paid-BetaenumRequired

This endpoint is in the customer_units=v1 beta. Send this header to use it.

Allowed values:

Request

Body
billablebooleanOptional

Whether usage on the unit is billable. false makes the unit, and everything under it, non-billable, and needs non-billable units enabled on your account. The root is always billable, and a change applies to usage received afterwards.

kindstring or nullOptional1-64 characters

Your label for the unit’s level, such as team, environment or user, or null. Paid gives it no meaning. Null clears it.

metadatamap from strings to stringsOptional

Replaces the unit’s whole metadata map; keys left out are removed. Refused for a unit whose saved metadata holds values other than strings.

namestringOptional1-255 characters
Shown in the dashboard and reports. Never used to look the unit up.
parentstringOptional1-255 characters

Moves the unit, with everything under it, under this active unit of the same customer: its cu_ ID or your externalId. The root can’t move, and a unit can’t move under itself or a unit below it.

Response

200
idstring
The unit's ID.
objectenum

The type of object. Always customerUnit.

Allowed values:
createdAtdatetime
When the object was created.
archivedAtdatetime or null

When the unit was archived, or null. An archived unit stays readable and in reports, and its externalId stays reserved.

billableboolean

The unit’s own setting: whether usage on it is billable. The root is always billable.

customerstring

The customer the unit belongs to, by its cus_ ID.

effectiveBillableboolean

Whether usage on the unit is billed: false when the unit or any unit above it has billable: false. Usage on a unit that isn’t billable is recorded and reported, but costs nothing.

externalIdstring

Your 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. Can’t change.

isRootboolean

Whether this is the customer’s root unit, which stands for the whole customer. A customer created with an externalId gets its root automatically.

kindstring or null

Your label for the unit’s level, such as team, environment or user, or null. Paid gives it no meaning.

livemodeboolean

true for an object on a live account, false on a test account.

metadatamap from strings to strings

String key-value pairs of your own. Values saved before the Date Versioned API that aren’t strings, numbers or booleans are left out.

namestring
Shown in the dashboard and reports. Never used to look the unit up.
parentstring or null

The unit this one sits under, in the same customer. Null for the root. By cu_ ID.

updatedAtdatetime
When the object was last changed.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
429
Too Many Requests Error
500
Internal Server Error