# Update membership type restrictions

`PUT /api/configuration/membership-types/{id}/restrictions`

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

HTML version: [Update membership type restrictions](https://support.gladstonesoftware.cloud/reference/configuration/update-membership-type-restrictions)

## Overview

Sets how many members a group membership of this type may contain in total, and how that total may
be split across price levels — for example a family membership capped at five members, of whom at
most two may be adults.

**This only works on group membership types.** A membership type that is not configured to apply to
links as a group is rejected with `422 Price level restrictions can only be assigned to group
memberships`.

**Both parts are full replacements, not partial updates.** `maxCapacity` is written on every call,
and the existing price level restrictions are deleted and rebuilt from the `priceLevels` array — so an
entry you leave out is removed. Send the complete intended set every time; an empty array removes
all price level restrictions and leaves only the overall capacity.

`maxCapacity` of `0` means unlimited. When it is `0` the per-price-level values are not checked
against it; for any other value, no price level may allow or require more members than the total.

Two practical limits worth knowing:

- `priceLevels` must be present. Sending null, or omitting it, is not treated as an empty list — the
  call fails with `500`. Send `[]`.
- Although validation accepts any `maxCapacity` up to `2147483647`, only values up to 32767 are
  kept correctly. **Keep `maxCapacity` between 0 and
  32767**; larger values are silently stored as something else.

Validation order matters when reading errors: the capacity and price level checks run **before** the
membership type is looked up, so an invalid body returns `422` even when the membership type in the
path does not exist. Nothing is written unless every check passes.

On success the response is `204 No Content`.

## Endpoint

`PUT {base_url}/api/configuration/membership-types/{id}/restrictions`

`{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 |
|------|------|----------|-------------|
| `id` | string | Yes | Identifier of the membership type to restrict. If it matches nothing the request fails with `404 Unable to find Membership Type {id} to update.` — but only after the body has passed the checks described in the Overview. |

## Request body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `maxCapacity` | integer (int32) | No | Total number of members a group membership of this type may hold. `0` means unlimited, and also switches off the check that each price level's figures fit within the total. Negative values are rejected (`Max capacity must be 0 or higher`). **Omitting it writes `0`** — unlimited — rather than leaving the current cap in place. Keep it within 0–32767: larger values are accepted by validation and stored incorrectly. |
| `priceLevels` | array of object | Yes | The complete set of per-price-level limits for this membership type. Existing restrictions are deleted and rebuilt from this array, so an entry you omit is removed; send `[]` to remove them all. Must be present — null or a missing property fails with `500`, not `400`. Each price level may appear only once (`422 You can not supply duplicate price levels`), and every price level must already exist (`422 One or more price levels don't exist`). |
| `priceLevels[].id` | string | Yes | Identifier of an existing price level, from `GET /api/configuration/price-levels`. Mandatory (`A price level ID must be supplied`). Existence is checked for the whole array at once, so one unknown id fails the entire request with `422 One or more price levels don't exist` without naming which. |
| `priceLevels[].minimumMembersPerPriceLevel` | integer (int32) | No | Smallest number of members on this price level a group membership must have — for example at least one adult. Nullable: omit it or send null for no minimum. When supplied it must be 0 or higher (`Minimum required must be 0 or higher`), must not exceed `maximumMembersPerPriceLevel` (`422 The minimum required value for a price level can not be larger than the maximum allowed`) and, unless `maxCapacity` is `0`, must not exceed `maxCapacity` (`422 Max allowed and min required values for a price level can not be greater than the total max capacity`). |
| `priceLevels[].maximumMembersPerPriceLevel` | integer (int32) | Yes | Largest number of members on this price level a group membership may have. Mandatory (`A max value must be supplied`) and 0 or higher (`Max value must be 0 or higher`). Unless `maxCapacity` is `0`, it must not exceed `maxCapacity`, or the request fails with `422 Max allowed and min required values for a price level can not be greater than the total max capacity`. Note that `0` here means no members on this price level are allowed — it is not a synonym for unlimited, unlike `maxCapacity`. |

## Sample request

```bash title="cURL"
curl -X PUT '{base_url}/api/configuration/membership-types/{id}/restrictions' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -H 'Content-Type: application/json' \
  -d '{
  "maxCapacity": 1,
  "priceLevels": [
    {
      "id": "string",
      "minimumMembersPerPriceLevel": 1,
      "maximumMembersPerPriceLevel": 1
    }
  ]
}'
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | Validation failed: `maxCapacity` negative, a price level entry missing `id` or `maximumMembersPerPriceLevel`, or either members figure negative. The body is a validation problem document keyed by field and array index. |
| `404` | Not found | No membership type matches the path identifier — `Unable to find Membership Type {id} to update.` Raised only after the body has passed validation, so a `422` can mask it. |
| `422` | Unprocessable entity | A price level allows or requires more members than `maxCapacity`, where `maxCapacity` is not `0` — `Max allowed and min required values for a price level can not be greater than the total max capacity`. |
| `422` | Unprocessable entity | A price level's minimum exceeds its maximum — `The minimum required value for a price level can not be larger than the maximum allowed`. |
| `422` | Unprocessable entity | The same price level appears more than once — `You can not supply duplicate price levels`. |
| `422` | Unprocessable entity | One or more price level ids do not exist — `One or more price levels don't exist`. The offending ids are not named. |
| `422` | Unprocessable entity | The membership type is not a group membership — `Price level restrictions can only be assigned to group memberships`. |
| `500` | Internal server error | `priceLevels` was null or omitted. Also any other unexpected server-side failure while saving. No detail is returned. |
