cURL
curl -X PUT \
/customers/{customerId}/set-parent \
--header "Content-Type: application/json" \
--header "Authorization: Bearer <token>" \
--data '{
"parentCustomerId": "00000000-0000-0000-0000-000000000000"
}'import requests
url = "https://coreapi.io/customers/{customerId}/set-parent"
payload = { "parentCustomerId": "00000000-0000-0000-0000-000000000000" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({parentCustomerId: '00000000-0000-0000-0000-000000000000'})
};
fetch('https://coreapi.io/customers/{customerId}/set-parent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/customers/{customerId}/set-parent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'parentCustomerId' => '00000000-0000-0000-0000-000000000000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parentCustomerId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"parentCustomerName": "<string>"
}Hierarchy
Set parent customer
Assigns a parent customer to establish an organizational hierarchy. The hierarchy supports a maximum of 3 levels. Circular references and self-assignment are not permitted. Both the parent and child customer must belong to the same tenant, and the parent customer must be active (not archived).
This endpoint requires the customer.hierarchy feature to be enabled.
customer:writePUT
/
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"
}'import requests
url = "https://coreapi.io/customers/{customerId}/set-parent"
payload = { "parentCustomerId": "00000000-0000-0000-0000-000000000000" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({parentCustomerId: '00000000-0000-0000-0000-000000000000'})
};
fetch('https://coreapi.io/customers/{customerId}/set-parent', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://coreapi.io/customers/{customerId}/set-parent",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'parentCustomerId' => '00000000-0000-0000-0000-000000000000'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"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)
400 Bad Request with a descriptive error message.
Availability
The organization hierarchy must be enabled for your organization. Contact support. Until then, this endpoint returns501 Not Implemented.
Webhooks
A successful assignment dispatches thecustomer.parent.assigned webhook event, which includes the full customer and parent customer payloads.Autorisierungen
Body
application/json
The parent customer assignment
War diese Seite hilfreich?