# Get site group by ID

`GET /api/configuration/site-groups/{all}`

- **Success:** `200 OK`
- **Products:** Operator (`FOH`)
- **Features:** Front of House Generic Access (`FOHGENERIC`)

HTML version: [Get site group by ID](https://support.gladstonesoftware.cloud/reference/configuration/get-site-group-by-id)

## Overview

Returns one site group and the sites that belong to it.

A **site group** is a named set of leisure centres that an operator configures together. It exists because most configuration in the platform is not attached to an individual centre: a resource product carries a `siteGroupId` rather than a site id, and discounts are mapped to site groups, so the group is what decides which centres a piece of configuration reaches. Membership is many-to-many — a site can sit in several groups at once — so a group is best read as "these centres, for this purpose" rather than as a place in a hierarchy.

Reach for this when you have a `siteGroupId` from another response and need to know which physical sites it covers. The commonest route in is the `siteGroupId` on a resource product from [Get resource product by ID](get-resource-product-by-id.md); the full list of groups comes from [Retrieves all site groups](retrieves-all-site-groups-with-their-configuration-details.md).

One caveat on the site list: `sites[].isActive` is not populated by this endpoint and is always `true`. The endpoint returns only each site's description, not its active state, so the value you get back is a default rather than the site's real state. If you need to know whether a site is trading, read it from [Get site by ID](get-site-by-id.md) or the site list instead.

## Endpoint

`GET {base_url}/api/configuration/site-groups/{all}`

`{base_url}` is the environment URL issued to your integration. See [Authenticating with Gladstone APIs](../../guides/authenticating-with-gladstone-apis.md).

## Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `siteGroupId` | string | Yes | The site group to read, maximum 15 characters. Take it from `siteGroupId` on a resource product, or from `id` on [Retrieves all site groups](retrieves-all-site-groups-with-their-configuration-details.md). Ids are uppercase and auto-generated ones use the prefix `STGP`, so send back exactly what you received. An id with no matching group returns `404`. |

## Sample request

```bash title="cURL"
curl -X GET '{base_url}/api/configuration/site-groups/{all}' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true'
```

## Response fields

| Field | Type | Description |
|-------|------|-------------|
| `id` | string | The site group's identifier, maximum 15 characters, always returned uppercase. This is the value that appears as `siteGroupId` on resource products and on discount site-group mappings, and the value to send back on update and delete. |
| `description` | string | The operator's name for the group — this is the only label it has, so show this rather than the id. Create and update reject a description longer than 255 characters with `The description cannot be more than 255 characters`, and reject an empty one with `The description cannot be null or empty`. A description longer than 25 characters may not survive a write intact, so do not assume it does. |
| `eftCollection` | boolean | Flags the group as one used for grouping direct debit (EFT) collections. Derived from a numeric setting, and `true` only when that value is exactly `1` — any other non-zero value is reported as `false`, so treat this strictly as a boolean rather than as a code. |
| `sites` | array of object | The sites belonging to this group. Empty array when the group has no sites, never null. Ordering is not specified — sort client-side if you need stable display. A site may appear in more than one group, so do not treat these lists as a partition of the estate. |
| `sites[].id` | string | The site's identifier, maximum 15 characters. This is the `siteId` you pass to the site-scoped endpoints — for example [Get site defaults](get-site-defaults.md) — and to [Get site by ID](get-site-by-id.md) for the site's full record. |
| `sites[].name` | string | The site's display name, taken from the site's own description field. Use it for labelling; it is the same text the site endpoints return as the site description. |
| `sites[].isActive` | boolean | **Always `true` on this endpoint, whatever the site's real state.** This endpoint does not look at the site's inactive flag, so every site comes back active. Get the real state from [Get site by ID](get-site-by-id.md) or the site list rather than from here. |

## Sample response

```json title="200 OK"
{
  "id": "string",
  "description": "string",
  "eftCollection": true,
  "sites": [
    {
      "id": "string",
      "name": "string",
      "isActive": true
    }
  ]
}
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | `siteGroupId` could not be read as a valid value; the body is a validation error object keyed by field name. Hard to provoke in practice, because `siteGroupId` is a string and almost any value binds — an unknown group gives `404`, not `400`. |
| `404` | Not found | No site group exists with that id. The body is a plain-text message in the form `GetSiteGroup could not find the id {siteGroupId}` — it echoes the id you sent — not a JSON error object. Note that other Configuration lookups, such as [Get resource product by ID](get-resource-product-by-id.md), report a missing record as `400`; this one uses `404`, so do not share error handling between them. |
| `500` | Internal server error | An unexpected server-side failure while reading the group. The response has no body, so there is nothing in the response to diagnose from — retry, then raise it with support quoting the time of the call. |
