# Create membership type group

`POST /api/configuration/membership-type-groups`

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

HTML version: [Create membership type group](https://support.gladstonesoftware.cloud/reference/configuration/create-membership-type-group)

## Overview

Creates a membership type group — a named bucket that membership types are sorted into, so that configuration which applies to a whole family of memberships (access-control questions, add-on entitlements and cross-sell restrictions) can be attached to the group instead of to every membership type individually.

A successful call returns `201` with the new group's identifier as a bare JSON string in the body, for example `"MEMTG0000000001"`. Take the identifier from the body: the `Location` header on this response is set to the literal text `CreateMembershipTypeGroup` rather than a URL, so it will not resolve to anything.

**You decide whether you choose the identifier or the system does, and that choice determines what a retry does.** Supply `id` and the call is safely repeatable — a second request with the same `id` is rejected with `409` and nothing is written. Omit `id` and the system allocates the next free code in the `MEMTG` sequence on every attempt, so retrying after a timeout leaves you with two groups that differ only by generated code. Only the `id` is unique; two groups may carry the same `description`.

This endpoint creates the group and nothing else — the request body has no membership type list, so a new group starts empty. The group is visible to [Get all membership type groups](get-all-membership-type-groups.md) and [Get membership type group by id](get-membership-type-group-by-id.md) immediately.

One thing to know before you consume group identifiers elsewhere: a group id is not interchangeable with the membership type ids inside it, and most APIs that filter by membership type will not expand a group for you. Resolve the group to its members with [Get membership types by membership type groups](get-membership-types-by-membership-type-groups.md) and pass the individual type ids on.

## Endpoint

`POST {base_url}/api/configuration/membership-type-groups`

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

## Request body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `id` | string | No | The group's code, unique within your tenant and quoted wherever the group is referenced. Maximum 15 characters. Omit it or send an empty string and the system generates the next code in the sequence `MEMTG` followed by 10 digits, for example `MEMTG0000000001`; the counter is derived from the highest existing id that starts with `MEMTG`, so groups you code yourself under a different prefix never disturb it. Supplying an id that is already in use returns `409`. |
| `description` | string | Yes | The group's display name, and the only human-readable label it has — this is what staff and reporting see, since the id is usually a generated code. Required, and no longer than 25 characters; both are enforced by request validation. Descriptions are not checked for uniqueness. |
| `comments` | string | No | Free-text notes about the group, returned as `comments` by the group read endpoints. Maximum 255 characters. Omit it or send null to leave it blank — it is saved verbatim and is not validated or interpreted. |

## Sample request

```bash title="cURL"
curl -X POST '{base_url}/api/configuration/membership-type-groups' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "string",
  "description": "string",
  "comments": "string"
}'
```

## Sample response

The body is the new group's identifier as a JSON string — the id you supplied, or the one the system generated.

```json title="201 Created"
"MEMTG0000000001"
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | Request validation failed: `description` is missing or empty (`Description is required`), `description` is longer than 25 characters, `id` is longer than 15 characters, or `comments` is longer than 255 characters. The body is a validation problem response whose `errors` object is keyed by field name. |
| `400` | Bad request | The request was rejected while saving the group; the body is a message describing why. No documented validation rule produces this, so treat this as an unexpected malformed-request signal rather than a rule you can predict. |
| `409` | Conflict | You supplied an `id` that an existing group already uses — `Membership type group with id {id} already exists.` Nothing is saved; change the id or update the existing group instead. |
| `500` | Internal server error | Any other unexpected server-side failure while saving the group, including a value that breaks a rule request validation does not check. The body is an error message. |
