Skip to navigation

Create a customer unit

Creates a unit (a team, department, workspace or environment) under an active unit of the same customer, named in parent. A customer created with an externalId already has its root; creating a root while the customer has an active one is root_unit_exists, so use the root as the parent. The externalId must be unique across the account, ignoring case, among unit IDs, customer external IDs and aliases; only the root may share its customer’s externalId. Units nest at most 16 levels deep, the root included. billable: false makes the unit and everything under it non-billable, and needs non-billable units enabled on your account. A customer billed per seat can’t have units. {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.

Headers

Paid-BetaenumRequired

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

Allowed values:

Request

Body
externalIdstringRequired1-255 characters

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. Can’t be . or ...

namestringRequired1-255 characters
Shown in the dashboard and reports. Never used to look the unit up.
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. Defaults to true.

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. Defaults to null.

metadatamap from strings to stringsOptional

String key-value pairs of your own, up to 500 characters per value. Always updatable.

parentstring or nullOptional1-255 characters

The active unit of the same customer to create this one under: its cu_ ID or your externalId. Leave it out, or send null, only to create the root of a customer that has none.

Response

201
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