# Set site defaults

`PATCH /api/configuration/sites/{siteId}/defaults`

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

HTML version: [Set site defaults](https://support.gladstonesoftware.cloud/reference/configuration/set-site-defaults)

## Overview

Sets the two site-level defaults the platform exposes: the site's default pricing time band and its default membership type group. Read the current values with [Get site defaults](get-site-defaults.md).

Despite being a `PATCH`, **this replaces both values every time.** The endpoint assigns whatever the body contains to both settings without checking whether the field was supplied, so a field you leave out is written as null and the existing default is cleared. Sending `{"timeBandId": "PEAK"}` does not just set the time band — it also wipes the site's default membership type group. Always send both fields, even when you are only changing one.

Only ids you actually name are validated. A non-null `timeBandId` is checked against the pricing time bands and a non-null `membershipTypeGroupId` against the membership type groups; a null skips its check, which is how clearing a default is allowed to succeed. Both checks happen before anything is written, so a bad id leaves both settings untouched.

The two settings are configuration entries held against the site rather than fields of the site itself, and **the entries must already exist**. A site that has never had these defaults initialised returns `500`, not `404` — the site itself is found, but there is nothing to update. If you hit that, the defaults need creating by Gladstone rather than by this call.

Success is `204 No Content` with an empty body.

## Endpoint

`PATCH {base_url}/api/configuration/sites/{siteId}/defaults`

`{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 |
|------|------|----------|-------------|
| `siteId` | string | Yes | The site code whose defaults you are setting, as returned in the `id` field of [Get all sites with optional filtering](get-all-sites-with-optional-filtering.md). A code that does not match a site returns `404` with the body `Site ID: {siteId} cannot be found`. |

## Request body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `timeBandId` | string | No | The pricing time band this site falls back to when nothing more specific applies, using the id from [Get all pricing timebands](get-all-pricing-timebands.md). Validated only when you send a non-null value: an id that does not exist returns `404` carrying the time band lookup's own message, and nothing is written. **Omitting the field, or sending null, clears the site's default time band** rather than leaving it as it was — so send the current value back whenever you are changing only `membershipTypeGroupId`. It is the site configuration setting `DefaultTimeBand`. |
| `membershipTypeGroupId` | string | No | The membership type group this site offers by default, using the id from [Get all membership type groups](get-all-membership-type-groups.md). Validated only when you send a non-null value: an id that does not exist returns `404` carrying the membership type group lookup's own message, and nothing is written. **Omitting the field, or sending null, clears the site's default membership type group** rather than leaving it alone — so send the current value back whenever you are changing only `timeBandId`. It is the site configuration setting `DefaultSubTypeGroup`. |

## Sample request

```bash title="cURL"
curl -X PATCH '{base_url}/api/configuration/sites/{siteId}/defaults' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -H 'Content-Type: application/json' \
  -d '{
  "timeBandId": "string",
  "membershipTypeGroupId": "string"
}'
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `204` | No content | Success. The body is empty; re-read the site defaults if you need to confirm what was stored. |
| `404` | Not found | The `siteId` does not match a site — body `Site ID: {siteId} cannot be found`. Also returned when a non-null `timeBandId` or `membershipTypeGroupId` does not exist, in which case the body is the message the time band or membership service produced, not one written here. Nothing is written in any of these cases. |
| `500` | Internal server error | Most usefully: the site exists but has no default configuration entries to update, so there is nothing for the write to change. It is also the catch-all for an unexpected server-side failure, and for any lookup status this endpoint does not translate — a `400` from the time band or membership lookup surfaces here as a `500` rather than as a `400`. The body is empty. |
| `503` | Service unavailable | The pricing time band or membership service could not be reached while validating an id. Body: `At least one of the services is unavailable.` Nothing is written, so this is safe to retry. |
