Zum Hauptinhalt springen
PUT
/
customers
/
{customerId}
/
set-parent
cURL
curl -X PUT \
 /customers/{customerId}/set-parent \
 --header "Content-Type: application/json" \
 --header "Authorization: Bearer <token>" \
 --data '{
    "parentCustomerId": "00000000-0000-0000-0000-000000000000"
}'
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "parentCustomerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "parentCustomerName": "<string>"
}
Establishes a parent-child relationship between two customers. This is used to model organizational structures such as a company with departments, a clinic with specialized units, or a retail chain with individual stores.

Validation

The following rules are enforced when assigning a parent customer:
  • The parent and child customer must belong to the same tenant
  • A customer cannot be its own parent
  • Circular references are not permitted (e.g., A → B → A)
  • The hierarchy supports a maximum of 3 levels (root → child → grandchild)
  • The parent customer must be active (not archived)
If any validation rule is violated, the API returns a 400 Bad Request with a descriptive error message.

Feature Flag

This endpoint requires the customer.hierarchy feature to be enabled. If the feature is not active, a 501 Not Implemented response is returned.

Webhooks

A successful assignment dispatches the customer.parent.assigned webhook event, which includes the full customer and parent customer payloads.

Autorisierungen

Authorization
string
header
erforderlich

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Pfadparameter

customerId
string<uuid>
erforderlich

The ID of the customer to assign a parent to

Body

application/json

The parent customer assignment

parentCustomerId
string<uuid>
erforderlich

The ID of the customer to set as parent

Beispiel:

"00000000-0000-0000-0000-000000000000"

Antwort

Parent customer assigned successfully

id
string<uuid>

The ID of the customer

parentCustomerId
string<uuid>

The ID of the assigned parent customer

parentCustomerName
string

The name of the assigned parent customer