Create a customer unit
Creates a unit for this customer. externalId is your own key for it: required, immutable, and unique within the organization (no other customer's unit id, external id or alias may be the same, ignoring letter case); every unit route addresses the unit by it, and name defaults to it. Omit parentExternalId to create the customer's root unit (its first unit; 409 ROOT_EXISTS if it already has one — a customer created with an external id usable as a unit key already has its root, keyed by that external id, so name it as the parent instead); otherwise the parent must exist (409 PARENT_NOT_FOUND) and be ACTIVE. A create whose externalId is one of this customer's DRAFT units promotes the draft in place: same unit, same id, now ACTIVE with the request's name, type, metadata and parent (parentExternalId is required; a draft sits under the root). A signal that names a unit before it exists is accepted; with draft units enabled for your organization it creates a DRAFT unit under the customer's root that holds the key, and creating the unit with that key later promotes the draft; otherwise its spend attaches to the unit once you create it with that key. 409 also when the externalId is taken on this customer (CUSTOMER_UNIT_EXISTS) or by another customer of the organization (EXTERNAL_ID_IN_USE), the tree would get too deep, the customer is on seat-based billing, or a root unit is sent with billable: false (ROOT_UNIT_ALWAYS_BILLABLE). 403 FEATURE_NOT_ENABLED for billable: false when non-billable units are not enabled for your organization. Use the value returned as customer.id, for example cus_abc123; if you have your own customer ID, use the /api/v2/customers/external/{externalId}/… twin.
Request
- Base URL: https://api.agentpaid.io/api/v2
- URL: https://api.agentpaid.io/api/v2/customers/{id}/customer-units
- Auth: HTTP bearer
Path parameters
Paid customer display id
Request body
Response
201
Changes
No recorded changes to this operation across all 1 revision of this API.