Connect · Teams
List teams
Returns a paginated list of teams for an organization, with a count and parent, subteam and activity information. You can filter by search term, parent team or up to 30 team IDs, and control pagination and sorting. The default and maximum page size is 30.
Permissions
Send an API key of the organization in the path, using the X-API-Key header.
Who may call it
- The caller must have organization access.
- The caller must have
team.read.
Request
Path parameters
-
organizationIdidrequired
Query parameters
-
sortobject of stringascdescKeys: one of 5 values
createdAtnameroleNamecontactCountlatestActivityAt -
limitinteger0–30 · default
30 -
offsetintegerat least 0 · default
0 -
returnCountbooleandefault
false -
searchTermstring -
parentTeamidnullable -
teamIdsid[]at most 30 items
curl --fail-with-body --silent --show-error --max-time 30 --globoff \
--request GET 'https://cloud.campai.com/api/connect/organizations/YOUR_ORGANIZATION_ID/teams' \
--header 'X-API-Key: YOUR_API_KEY'const response = await fetch("https://cloud.campai.com/api/connect/organizations/YOUR_ORGANIZATION_ID/teams", {
method: "GET",
headers: {
"X-API-Key": "YOUR_API_KEY"
},
redirect: 'error',
signal: AbortSignal.timeout(30_000),
});
if (!response.ok) throw new Error(`campai HTTP ${response.status}`);
const text = await response.text();
const result = text ? JSON.parse(text) : null;
console.log(JSON.stringify(result, null, 2));<?php
$context = stream_context_create(['http' => [
'method' => 'GET',
'header' => [
'X-API-Key: YOUR_API_KEY',
],
'timeout' => 30,
'follow_location' => 0,
'ignore_errors' => true,
]]);
$text = @file_get_contents('https://cloud.campai.com/api/connect/organizations/YOUR_ORGANIZATION_ID/teams', false, $context);
preg_match('/^HTTP\/\S+ (\d{3})/', $http_response_header[0] ?? '', $match);
$status = (int) ($match[1] ?? 0);
if ($text === false || $status < 200 || $status >= 300) {
throw new RuntimeException("campai HTTP $status (0 means no response)");
}
$result = $text === '' ? null : json_decode($text, true, 512, JSON_THROW_ON_ERROR);
echo json_encode($result, JSON_PRETTY_PRINT | JSON_THROW_ON_ERROR), PHP_EOL;
Response
200 Successful response
Content-Type: application/json
-
countintegerat least 0
-
teamsobject[]24 properties
-
_idid -
updatedAtstring · date-timenullable -
removedAtstring · date-timenullable -
updatedByobjectnullableWhen an actor is masked, its name is replaced with a no-permission name. Depending on the actor field's schema, other actor details may be removed or its image set to null.
A non-contact
teams[].updatedByactor other than the current actor is masked withoutuser.read.An API
teams[].updatedByactor is masked withoutapiKey.read, even if it is the current actor. -
removedByobjectnullableWhen an actor is masked, its name is replaced with a no-permission name. Depending on the actor field's schema, other actor details may be removed or its image set to null.
A non-contact
teams[].removedByactor other than the current actor is masked withoutuser.read.An API
teams[].removedByactor is masked withoutapiKey.read, even if it is the current actor. -
__ignoreTriggersstringnullable -
organizationid -
namestring1–80 characters
-
parentTeamidnullable -
descriptionstringat most 256 characters
-
avatarobjectnullable4 properties
-
resourcestringat least 1 characters
-
fileNamestringat most 128 characters
-
contentTypestringat most 75 characters
-
fileSizeBytesintegerat least 0
-
-
membershipobject4 properties
-
contactTypesstring[]memberaddresscustomersponsorcontributoremployeesupplier -
segmentsstring[]each 1–30 characters
-
departmentsid[] -
tagsstring[]at most 20 items · each 1–40 characters
-
-
memberRoleid -
roleNamestring1–32 characters
-
contactCountintegerat least 0
-
joinedContactCountintegerat least 0
-
userCountintegerat least 0
-
membershipRevisionintegerat least 0
-
latestActivityAtstring · date-timenullable -
synchronizationobject4 properties
-
statusstringpendingfailedcompleted -
revisionintegerat least 0
-
notifyUserIdstringnullable -
contactCursoridnullable
-
-
deletionCleanupobject1 property
-
statusstringpendingfailedcompleted
-
-
activityCountsobject2 properties
-
messageintegerat least 0
-
interactiveintegerat least 0
-
-
subteamCountintegerat least 0
-
parentobjectnullableThis is null when the team has no parent or its parent is not found.
2 properties
-
_idid -
namestring1–80 characters
-
-
{
"count": 0,
"teams": [
{
"_id": "000000000000000000000001",
"organization": "000000000000000000000001",
"name": "string",
"parentTeam": "000000000000000000000001",
"description": "string",
"avatar": {
"resource": "string"
},
"membership": {
"contactTypes": [
"member"
],
"segments": [
"string"
],
"departments": [
"000000000000000000000001"
],
"tags": [
"string"
]
},
"memberRole": "000000000000000000000001",
"roleName": "string",
"contactCount": 0,
"joinedContactCount": 0,
"userCount": 0,
"membershipRevision": 0,
"latestActivityAt": "2026-06-15T22:30:00Z",
"activityCounts": {
"message": 0,
"interactive": 0
},
"subteamCount": 0,
"parent": {
"_id": "000000000000000000000001",
"name": "string"
}
}
]
}
Errors
No errors of its own are known for this endpoint.
Errors nearly every request can meet are listed under Errors.