# Subgroups | Signal House API Docs

> Create and manage subgroups within a Signal House group through the API.

Source: https://docs.signalhouse.io/subgroups

---

## Subgroups

### GET /subgroup/counts

Retrieve resource counts grouped by subgroup. Results include only groups the authenticated caller can access.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Optional | Restrict results to an accessible Group ID. |
| `subgroupId` | Query Param | Optional | Restrict results to a subgroup. |
| `limit` | Query Param | Optional | Maximum rows to return (1–1000). |
| `offset` | Query Param | Optional | Rows to skip; requires limit. |

#### Example Response 200

Response

```json
{
  "data": [
    {
      "groupId": "G1234567",
      "subgroupId": "S1234567",
      "endpoints": 3,
      "api_keys": 1,
      "brands": 1,
      "campaigns": 1,
      "phone_numbers": 2
    }
  ],
  "total": 1,
  "page": 1,
  "limit": 20,
  "totalPages": 1
}
```

### GET /subgroup

Retrieve subgroup records. Customer roles must pass at least one filter (id or groupId) — an unfiltered read-all is restricted to internal use.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | Query Param | Optional | Specific Subgroup ID. |
| `groupId` | Query Param | Optional | Filter by parent Group ID. |
| `search` | Query Param | Optional | With groupId: free text finds part of the subgroup ID, name or company name. \`field:\` names subgroupId, subgroupName or subgroupCompanyName. Repeat the param to send several values; every value must match. Each value is free text, or \`field:term\` to search one field. Each term is 3 to 100 characters, with at most 5 values; a shorter term returns 400. Works with the scoping filters above. |
| `page` | Query Param | Optional | Page number for pagination. |
| `limit` | Query Param | Optional | Results per page. |

#### Example Response 200

Response

```json
[
  {
    "_id": "60f7b2a1c9e77c001a2b3c5e",
    "groupId": "G1234567",
    "subgroupId": "S1234567",
    "subgroupName": "Marketing Team",
    "contactFirstName": "Jane",
    "contactLastName": "Smith",
    "subgroupCompanyName": "Acme Marketing Division",
    "status": "active",
    "carrierIdFamily": "Default",
    "carrierIdRegion": null,
    "createdAt": "2024-01-15T12:00:00.000Z",
    "updatedAt": "2024-01-15T12:00:00.000Z"
  }
]
```

### GET /subgroup/ghl-location-lookup

Resolve the mapping between a GoHighLevel location and a Signal House subgroup, in either direction. Provide exactly one of ghlLocationId or subgroupId — passing both or neither returns 400. groupId is optional: customer roles default to their own accessible group(s) and are rejected (403) only if they explicitly name a group they don't belong to. A subgroupId or ghlLocationId that belongs to a different group than the caller's returns 404 — identical to a nonexistent one, so a cross-group id never reveals that it exists elsewhere. A subgroup with no linked GHL location returns 200 with ghlLocationId and ghlLocationName both null.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | Query Param | Optional | Restrict the lookup to an accessible Group ID. |
| `ghlLocationId` | Query Param | Optional | GHL location ID to resolve to its subgroup. Mutually exclusive with subgroupId. |
| `subgroupId` | Query Param | Optional | Subgroup ID to resolve to its GHL location. Mutually exclusive with ghlLocationId. |

#### Example Response 200

Response

```json
{
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "subgroupName": "Marketing Team",
  "ghlLocationId": "abc123locid",
  "ghlLocationName": "Acme Marketing"
}
```

### POST /subgroup

Create a new Subgroup.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `groupId` | String | Required | Parent Group ID. |
| `subgroupName` | String | Required | Name of the subgroup. |
| `subgroupCompanyName` | String | Optional | Associated company name. |
| `contactFirstName` | String | Optional | Contact first name. |
| `contactLastName` | String | Optional | Contact last name. |
| `contactMiddleName` | String | Optional | Contact middle name. |
| `addressLine1` | String | Optional | Address line 1. |
| `addressLine2` | String | Optional | Address line 2. |
| `city` | String | Optional | City. |
| `state` | String | Optional | State. |
| `country` | String | Optional | Country. |
| `postalCode` | String | Optional | Postal code. |
| `phone` | String | Optional | Phone number. |
| `carrierIdFamily` | String | Optional | Deprecated. Accepted, stored and returned, with no effect on billing. One of "Default", "ATT", "TMobile", "Verizon", "USCellular", "GoogleVoice", "ClearSky", "Interop". Setting this field requires signalhouse\_api, signalhouse\_admin, signalhouse\_user, api, admin, developer, or billing role. |
| `carrierIdRegion` | String|null | Optional | Deprecated. Accepted, stored and returned, with no effect on billing. One of "PRClaro", "GuamDocomo", "GuamGTA", "GuamITE" or null, and only valid when carrierIdFamily is "ClearSky". Setting this field requires signalhouse\_api, signalhouse\_admin, signalhouse\_user, api, admin, developer, or billing role. |

#### Example Request

Request

```json
{
  "groupId": "G1234567",
  "subgroupName": "Marketing Team"
}
```

#### Example Response 201

Response

```json
{
  "_id": "60f7b2a1c9e77c001a2b3c5e",
  "groupId": "G1234567",
  "subgroupId": "S1234567",
  "subgroupName": "Marketing Team",
  "status": "active",
  "carrierIdFamily": "Default",
  "carrierIdRegion": null,
  "createdAt": "2024-01-15T12:00:00.000Z",
  "updatedAt": "2024-01-15T12:00:00.000Z"
}
```

### PUT /subgroup/:id

Update an existing subgroup.

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Subgroup ID to update. |
| `subgroupName` | String | Optional | Name of the subgroup. |
| `subgroupCompanyName` | String | Optional | Associated company name. |
| `contactFirstName` | String | Optional | Contact first name. |
| `contactLastName` | String | Optional | Contact last name. |
| `contactMiddleName` | String | Optional | Contact middle name. |
| `addressLine1` | String | Optional | Address line 1. |
| `addressLine2` | String | Optional | Address line 2. |
| `city` | String | Optional | City. |
| `state` | String | Optional | State. |
| `country` | String | Optional | Country. |
| `postalCode` | String | Optional | Postal code. |
| `phone` | String | Optional | Phone number. |
| `status` | String | Optional | Subgroup status — "active" or "inactive". |
| `carrierIdFamily` | String | Optional | Deprecated. Accepted, stored and returned, with no effect on billing. One of "Default", "ATT", "TMobile", "Verizon", "USCellular", "GoogleVoice", "ClearSky", "Interop". Setting this field requires signalhouse\_api, signalhouse\_admin, signalhouse\_user, api, admin, developer, or billing role. |
| `carrierIdRegion` | String|null | Optional | Deprecated. Accepted, stored and returned, with no effect on billing. One of "PRClaro", "GuamDocomo", "GuamGTA", "GuamITE" or null, and only valid when carrierIdFamily is "ClearSky". Setting this field requires signalhouse\_api, signalhouse\_admin, signalhouse\_user, api, admin, developer, or billing role. |
| `cnamAutoApply` | Boolean | Optional | Caller name (CNAM) auto-apply. When true, every eligible number in the subgroup shows its brand's registered name on outbound calls: its campaign's brand, else the default caller-ID brand below. Turning it on needs a verified brand in the subgroup. Requires signalhouse\_api, signalhouse\_admin, signalhouse\_user, api, admin, or developer role. |
| `cnamBrandId` | String|null | Optional | Default caller-ID brand for numbers with no campaign (e.g. voice-only numbers). Must be a verified brand in this subgroup. Chosen automatically when the subgroup has exactly one verified brand; required when turning cnamAutoApply on with two or more. Same roles as cnamAutoApply. |

#### Example Request

Request

```json
{
  "subgroupName": "Marketing Team Updated"
}
```

#### Example Response 200

Response

```json
{
  "_id": "60f7b2a1c9e77c001a2b3c5e",
  "subgroupId": "S1234567",
  "subgroupName": "Marketing Team Updated",
  "status": "active",
  "carrierIdFamily": "Default",
  "carrierIdRegion": null,
  "updatedAt": "2024-01-16T14:00:00.000Z"
}
```

### DELETE /subgroup/:id

Inactivate a subgroup (must not have active brands).

**The following roles are required to use this endpoint:** `admin`, `developer`, `api`, `billing`, `user`

#### Request Body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | URL Param | Required | Subgroup ID to delete. |

#### Example Response 200

Response

```json
{
  "message": "Subgroup S1234567 inactivated successfully"
}
```
