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
| Field | Type | Description |
|---|---|---|
unit_id | string | Unique Organizational Unit identifier |
org_id | string | Parent organization identifier |
name | string | Display name |
slug | string | URL-friendly identifier |
external_ref | string or null | Reference ID from an external system (e.g., Salesforce business unit ID) |
is_default | boolean | Whether this is the default OU for the organization |
Example
curl -X GET "https://api.leadvibe.com/org-units" \
-H "Authorization: Bearer <token>"
Common Errors
| Status | Meaning | Solution |
|---|---|---|
| 401 | Unauthorized | Check authentication credentials |
POST /org-units
Create a new Organizational Unit.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Display 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
| Status | Meaning | Solution |
|---|---|---|
| 400 | Bad Request | Name is required |
| 401 | Unauthorized | Check authentication credentials |
PUT /org-units/{id}
Update the name (and slug) of an existing Organizational Unit.
Request
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string | Yes | OU identifier (path parameter) |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Updated 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
| Status | Meaning | Solution |
|---|---|---|
| 400 | Bad Request | Name is required |
| 401 | Unauthorized | Check authentication credentials |
| 404 | Not Found | OU 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
| Field | Type | Required | Description |
|---|---|---|---|
ouId | string | Yes | The OU identifier to activate |
{
"ouId": "unit_emea"
}
Response
204 No Content
The response includes headers confirming the selection:
| Header | Description |
|---|---|
X-Active-OU-ID | The active OU identifier |
X-Active-OU-Name | The active OU display name |
X-Active-OU-Slug | The 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
| Status | Meaning | Solution |
|---|---|---|
| 400 | Bad Request | ouId is required |
| 401 | Unauthorized | Check authentication credentials |
| 403 | Forbidden | You 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
Related Endpoints
- Members - Manage organization members
- Credentials - API credentials scoped to OUs