Skip to main content

Organization Units API

Manage Organizational Units (OUs) within your organization. OUs provide data isolation so different teams, regions, or business units can work with their own set of leads, events, and scoring rules without seeing each other's data.

GET /org-units

List all Organizational Units you have access to.

Request

No query parameters required.

Response

200 OK

[
{
"unit_id": "unit_default",
"org_id": "org_abc123",
"name": "Default",
"slug": "default",
"external_ref": null,
"is_default": true
},
{
"unit_id": "unit_emea",
"org_id": "org_abc123",
"name": "EMEA Sales",
"slug": "emea-sales",
"external_ref": "sf_bu_001",
"is_default": false
}
]

Response Fields

FieldTypeDescription
unit_idstringUnique Organizational Unit identifier
org_idstringParent organization identifier
namestringDisplay name
slugstringURL-friendly identifier
external_refstring or nullReference ID from an external system (e.g., Salesforce business unit ID)
is_defaultbooleanWhether this is the default OU for the organization

Example

curl -X GET "https://api.leadvibe.com/org-units" \
-H "Authorization: Bearer <token>"

Common Errors

StatusMeaningSolution
401UnauthorizedCheck authentication credentials

POST /org-units

Create a new Organizational Unit.

Request Body

FieldTypeRequiredDescription
namestringYesDisplay name for the new OU
{
"name": "EMEA Sales"
}

Response

201 Created

{
"unit_id": "unit_emea",
"org_id": "org_abc123",
"name": "EMEA Sales",
"slug": "emea-sales",
"external_ref": null,
"is_default": false
}

Example

curl -X POST "https://api.leadvibe.com/org-units" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"name": "EMEA Sales"}'

Common Errors

StatusMeaningSolution
400Bad RequestName is required
401UnauthorizedCheck authentication credentials

PUT /org-units/{id}

Update the name (and slug) of an existing Organizational Unit.

Request

ParameterTypeRequiredDescription
idstringYesOU identifier (path parameter)

Request Body

FieldTypeRequiredDescription
namestringYesUpdated display name
{
"name": "EMEA & APAC Sales"
}

Response

200 OK

Returns the updated Organizational Unit object.

Example

curl -X PUT "https://api.leadvibe.com/org-units/unit_emea" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"name": "EMEA & APAC Sales"}'

Common Errors

StatusMeaningSolution
400Bad RequestName is required
401UnauthorizedCheck authentication credentials
404Not FoundOU does not exist or you do not have access

POST /org-units/active

Set your active Organizational Unit for subsequent requests. All OU-scoped endpoints use this selection to determine which data to return.

Request Body

FieldTypeRequiredDescription
ouIdstringYesThe OU identifier to activate
{
"ouId": "unit_emea"
}

Response

204 No Content

The response includes headers confirming the selection:

HeaderDescription
X-Active-OU-IDThe active OU identifier
X-Active-OU-NameThe active OU display name
X-Active-OU-SlugThe active OU slug

Example

curl -X POST "https://api.leadvibe.com/org-units/active" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"ouId": "unit_emea"}'

Common Errors

StatusMeaningSolution
400Bad RequestouId is required
401UnauthorizedCheck authentication credentials
403ForbiddenYou do not have access to this OU

Notes

  • Every organization starts with a default OU that cannot be deleted
  • Deletion of Organizational Units is not supported to prevent data loss
  • All data (leads, events, scores, rules) is scoped to the active OU
  • Set the active OU before calling any OU-scoped endpoint
  • The active OU selection is stored server-side via an HttpOnly cookie