Skip to main content

Organisation units

Base: https://crm-service.<domain>/api/v2/entity/ou.

Create​

POST/api/v2/entity/oucrm-service
curl -s https://crm-service.scenid.cloud/api/v2/entity/ou \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"data": { "ouType": "ou", "name": "Nordlicht Holding GmbH", "legalForm": "gmbh" },
"parent": "SC-PARENT1",
"employees": [{ "humanId": "SC-PERSON1", "roles": [{ "role": "ceo", "status": "active" }] }],
"groups": [{ "humanId": "SC-GROUP1" }],
"return": true
}'
BodyDescription
dataRequired. Validated against the full OU schema by default (same fields PUT accepts)
parenthumanId of the parent OU
employees[{ humanId, roles: [{ role, status }] }]
groups[{ humanId }]. (Group humanIds. The SDK converts names.)
schema"minimal": validate against just ouType, name (≥ 3 characters) and legalForm instead
stricttrue: reject the request if data contains any field not in the schema being validated against
returntrue: respond with the entity

Response 201: { "result": "OK", "humanId": "..." }, or the entity with return.

Errors: entity/data-missing, entity/data-invalid, entity/parent-not-found, entity/invalid-parent, relationship/roles-required, relationship/role-missing, relationship/invalid-status, or { "errors": [{ "message", "path" }] }.

Full schema by default

Create validates data against the full OU schema — the same one PUT uses — so address, contacts, and every other field can be set at creation time. Pass "schema": "minimal" to validate against just ouType, name and legalForm instead, matching the old create-only behavior.

Update​

PUT/api/v2/entity/ou/{humanId}crm-service
curl -s -X PUT https://crm-service.scenid.cloud/api/v2/entity/ou/SC-ZW2VEG \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{
"data": {
"hasAddress": true, "street": "Hafenstraße", "houseNo": "12",
"zipCode": "20457", "city": "Hamburg", "countryCode": "DE",
"website": "https://nordlicht-holding.example",
"contacts": [{ "contactType": "email", "value": { "email": "info@nordlicht-holding.example" }, "isFavorite": true }]
}
}'
BodyDescription
dataNew data. Merged into the existing data by default
overwritetrue: replace the entity's data entirely instead of merging. Fields present on the entity but absent from data are deleted
stricttrue: reject the request if data contains any field not in the OU schema
employees, groupsReplace the complete list when present
returnRespond with the entity

Response 200 { "result": "OK", "humanId": "..." }. Errors include entity/wrong-entity-type.

Delete​

DELETE/api/v2/entity/ou/{humanId}crm-service

200 { "result": "deleted", "humanId": "..." }.

Move (set or remove parent)​

PUT/api/v2/entity/ou/{humanId}/parent/{targetHumanId}crm-service
DELETE/api/v2/entity/ou/{humanId}/parentcrm-service

Errors: entity/parent-not-found, entity/invalid-parent.

Add or change an employee​

POST/api/v2/entity/ou/{ouHumanId}/employees/{personHumanId}crm-service
curl -s -X POST https://crm-service.scenid.cloud/api/v2/entity/ou/SC-COMPANY/employees/SC-PERSON \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{ "data": { "roles": [{ "role": "employee", "status": "active" }] } }'

PUT on the same path does the same. Errors: entity/wrong-entity-type, entity/wrong-target-entity-type, role validation errors.

Remove an employee​

DELETE/api/v2/entity/ou/{ouHumanId}/employees/{personHumanId}crm-service

200 { "result": "deleted", "humanId": "..." }.

Set employees in bulk​

POST/api/v2/entity/ou/{humanId}/employeescrm-service

Body: an array [{ "humanId": "<person>", "roles": [...] }]. The SDK does not wrap this endpoint.