Organisation units
Base: https://crm-service.<domain>/api/v2/entity/ou.
Create
/api/v2/entity/oucrm-service- curl
- JavaScript
- Python
- R
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
}'
const response = await fetch('https://crm-service.scenid.cloud/api/v2/entity/ou', {
method: 'POST',
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
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
})
})
console.log(response.status, await response.json())
import requests
response = requests.post(
"https://crm-service.scenid.cloud/api/v2/entity/ou",
headers={"Authorization": f"Bearer {token}"},
json={
"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,
},
)
print(response.status_code, response.json())
library(httr2)
response <- request("https://crm-service.scenid.cloud/api/v2/entity/ou") |>
req_auth_bearer_token(token) |>
req_body_json(list(
data = list(ouType = "ou", name = "Nordlicht Holding GmbH", legalForm = "gmbh"),
parent = "SC-PARENT1",
employees = list(
list(
humanId = "SC-PERSON1",
roles = list(list(role = "ceo", status = "active"))
)
),
groups = list(list(humanId = "SC-GROUP1")),
return = TRUE
)) |>
req_error(is_error = \(r) FALSE) |>
req_perform()
resp_status(response)
resp_body_json(response)
| Body | Description |
|---|---|
data | Required. Validated against the full OU schema by default (same fields PUT accepts) |
parent | humanId 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 |
strict | true: reject the request if data contains any field not in the schema being validated against |
return | true: 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" }] }.
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
/api/v2/entity/ou/{humanId}crm-service- curl
- JavaScript
- Python
- R
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 }]
}
}'
const response = await fetch('https://crm-service.scenid.cloud/api/v2/entity/ou/SC-ZW2VEG', {
method: 'PUT',
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
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
}
]
}
})
})
console.log(response.status, await response.json())
import requests
response = requests.put(
"https://crm-service.scenid.cloud/api/v2/entity/ou/SC-ZW2VEG",
headers={"Authorization": f"Bearer {token}"},
json={
"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,
},
],
},
},
)
print(response.status_code, response.json())
library(httr2)
response <- request("https://crm-service.scenid.cloud/api/v2/entity/ou/SC-ZW2VEG") |>
req_auth_bearer_token(token) |>
req_method("PUT") |>
req_body_json(list(
data = list(
hasAddress = TRUE,
street = "Hafenstraße",
houseNo = "12",
zipCode = "20457",
city = "Hamburg",
countryCode = "DE",
website = "https://nordlicht-holding.example",
contacts = list(
list(
contactType = "email",
value = list(email = "info@nordlicht-holding.example"),
isFavorite = TRUE
)
)
)
)) |>
req_error(is_error = \(r) FALSE) |>
req_perform()
resp_status(response)
resp_body_json(response)
| Body | Description |
|---|---|
data | New data. Merged into the existing data by default |
overwrite | true: replace the entity's data entirely instead of merging. Fields present on the entity but absent from data are deleted |
strict | true: reject the request if data contains any field not in the OU schema |
employees, groups | Replace the complete list when present |
return | Respond with the entity |
Response 200 { "result": "OK", "humanId": "..." }. Errors include entity/wrong-entity-type.
Delete
/api/v2/entity/ou/{humanId}crm-service200 { "result": "deleted", "humanId": "..." }.
Move (set or remove parent)
/api/v2/entity/ou/{humanId}/parent/{targetHumanId}crm-service/api/v2/entity/ou/{humanId}/parentcrm-serviceErrors: entity/parent-not-found, entity/invalid-parent.
Add or change an employee
/api/v2/entity/ou/{ouHumanId}/employees/{personHumanId}crm-service- curl
- JavaScript
- Python
- R
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" }] } }'
const response = await fetch('https://crm-service.scenid.cloud/api/v2/entity/ou/SC-COMPANY/employees/SC-PERSON', {
method: 'POST',
headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ data: { roles: [{ role: 'employee', status: 'active' }] } })
})
console.log(response.status, await response.json())
import requests
response = requests.post(
"https://crm-service.scenid.cloud/api/v2/entity/ou/SC-COMPANY/employees/SC-PERSON",
headers={"Authorization": f"Bearer {token}"},
json={"data": {"roles": [{"role": "employee", "status": "active"}]}},
)
print(response.status_code, response.json())
library(httr2)
response <- request("https://crm-service.scenid.cloud/api/v2/entity/ou/SC-COMPANY/employees/SC-PERSON") |>
req_auth_bearer_token(token) |>
req_body_json(list(
data = list(roles = list(list(role = "employee", status = "active")))
)) |>
req_error(is_error = \(r) FALSE) |>
req_perform()
resp_status(response)
resp_body_json(response)
PUT on the same path does the same. Errors: entity/wrong-entity-type, entity/wrong-target-entity-type, role validation errors.
Remove an employee
/api/v2/entity/ou/{ouHumanId}/employees/{personHumanId}crm-service200 { "result": "deleted", "humanId": "..." }.
Set employees in bulk
/api/v2/entity/ou/{humanId}/employeescrm-serviceBody: an array [{ "humanId": "<person>", "roles": [...] }]. The SDK does not wrap this endpoint.