# Update an activity configuration

`PUT /api/configuration/activities/{id}`

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

HTML version: [Update an activity configuration](https://support.gladstonesoftware.cloud/reference/configuration/update-an-activity-configuration)

## Overview

Rewrites the configurable details of one activity: its display names, its booking party size limits,
the activity group it belongs to, its localised text and its tags.

**This is a full replacement, not a partial update.** Every writable field is assigned from the body
on every call, and the two collections are replaced as whole sets:

- `translations` — the activity's existing translations are deleted and re-created from the
  array you send. Omit the array and the activity is left with no translations at all.
- `tags` — the activity's existing tag mappings are deleted and re-created from the array you send.
  Omit the array and the activity ends up with no tags.

A request carrying only the required fields returns `204 No Content`, and afterwards the activity
has no translations and no tags. Read the activity first and send back everything you want to keep.

The same applies to the scalar fields. `description` is written unconditionally, so omitting it
clears the activity's long description; `maxBookees` defaults to `0`,
so omitting it sets the maximum party size to zero rather than leaving it alone.

Validation runs before anything is written and the call is all-or-nothing — a rejected request
leaves the activity, its translations and its tags exactly as they were. Checks are applied in this
order: the activity must exist; `activityGroupId` must exist; `minBookees` must be allowed for the
activity's type; `maxBookees` must be at least `minBookees`; every tag must be valid.

An activity's identifier, its site and its type (activity or class) cannot be changed here. On
success the response is `204 No Content`, and a subsequent read of the site's or the tenant's
activities reflects the change.

## Endpoint

`PUT {base_url}/api/configuration/activities/{id}`

`{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 activity to rewrite, as returned by `GET /api/configuration/activities`. If no activity has this identifier the request fails with `404` and the message `Unable to find the activity {id} to update`. |

## Request body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `id` | string | No | Ignored. The `{id}` from the path is always used instead, so an activity cannot be renamed or re-keyed through this call. Sending a different value is not an error: the request succeeds with `204` and the activity's identifier is unchanged. |
| `name` | string | Yes | The activity's short display name — the text listings and booking screens show, returned as `name` by `GET /api/configuration/activities`. Mandatory: blank or missing fails with `400 Name cannot be blank`. Maximum 25 characters (`Name cannot be more than 25 characters`), which is short enough to catch integrations that assume a longer field. |
| `description` | string | No | The activity's longer descriptive text, returned as `description` by `GET /api/configuration/activities`. Maximum 255 characters (`Description cannot be more than 255 characters`). Written on every call, so omitting it or sending null clears any existing text — send the current value if you only mean to change something else. |
| `activityGroupId` | string | Yes | The activity group this activity is filed under, taken from `GET /api/configuration/activity-groups`. Mandatory (`ActivityGroupId is required`), and the group must already exist or the request fails with `400 The Activity Group ID in the request is not valid`. Because it is always written, this field is also how you move an activity between groups — send the existing group when you do not intend to move it. |
| `minBookees` | integer (int32) | No | Minimum number of bookees a booking of this activity must have. Must be between 0 and 1000 (`MinBookees must be between 0 and a 1000`); negatives are rejected by the same message. **Only class-type activities may exceed 0.** For an activity-type record any value above 0 fails with `The activity {id} is an activity type and can not have a minBookees greater than 0. Only Class types may have a minBookees greater than 0` — and the type belongs to the stored activity, so it cannot be changed here to make the value legal. Omit the field and it is written as `0`; send an explicit null and the request fails with `400`. |
| `maxBookees` | integer (int32) | No | Maximum number of bookees a booking of this activity may have. Must be between 0 and 1000 (`MaxBookees must be between 0 and a 1000`) and must be greater than or equal to `minBookees`, or the request fails with `Max Bookees must be equal to or a larger amount than Min Bookees`. **Omitting it writes `0`** rather than preserving the current limit; an explicit null fails with `400`. |
| `translations` | array of object | No | The complete set of localised text for this activity. The existing translations are deleted and rebuilt from this array on every call, so it is a full-set replace: omit it, or send an empty array, and the activity is left with no translations. There is no way to add or amend a single translation — read the current set and send it back with your change applied. No server-side validation is applied to the entries. |
| `translations[].Type` | string | No | Which piece of text this entry localises. Note the capital `T`: the property name is `Type`, so `type` in lower case is not recognised. Known values are `name` and `description`, matching the two translatable fields above. |
| `translations[].culture` | string | No | The culture the text is written in, as a `language-REGION` culture code — for example `cy-GB` for Welsh. Not validated by this endpoint, so an unrecognised culture is accepted rather than rejected, and the text simply never surfaces. The culture likely needs to be configured elsewhere in the platform for the translation to be used. |
| `translations[].text` | string | No | The translated text itself, for the `Type` and `culture` in the same entry. Not length-validated by this endpoint, unlike `name` and `description`. |
| `tags` | array of object | No | The complete set of tags to associate with the activity. Existing tag mappings are removed and replaced by this array on every call, so it is a full-set replace: omit it, or send an empty array, and every tag is unmapped from the activity. Validation is all-or-nothing across the array — if any single tag is rejected the entire request fails and no part of the update is written. |
| `tags[].id` | integer (int32) | No | The numeric identifier of an existing tag, from `GET /api/configuration/tags`. This is the only part of the entry that is used. Each tag must exist and belong to a tag group of type `ACTIVITIES` or `SYSTEM`. If some ids fail that test the request fails with `The tag(s) {ids} are invalid`, listing the offending ids; if none pass, the message is `None of the tag IDs in the request are valid`. A non-numeric value is rejected with `400`, reporting the position, for example `could not convert string to integer: fake_id. path 'tags[3].id'`. |
| `tags[].description` | string | No | Ignored. Only the validated ids are used, so a tag's description cannot be changed here — use the tag configuration endpoints for that. |
| `tags[].tagGroupId` | integer (int32) | No | Ignored, in the same way as `tags[].description`. The tag's existing group is used when its type is checked; sending a different group here neither moves the tag nor affects that check. |

## Sample request

```bash title="cURL"
curl -X PUT '{base_url}/api/configuration/activities/{id}' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "string",
  "name": "string",
  "description": "string",
  "activityGroupId": "string",
  "minBookees": 1,
  "maxBookees": 1,
  "translations": [
    {
      "Type": "string",
      "culture": "string",
      "text": "string"
    }
  ],
  "tags": [
    {
      "id": 12345,
      "description": "string",
      "tagGroupId": 12345
    }
  ]
}'
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | Body validation failed — `Name cannot be blank`, `Name cannot be more than 25 characters`, `Description cannot be more than 255 characters`, `ActivityGroupId is required`, or `MinBookees`/`MaxBookees must be between 0 and a 1000`. |
| `400` | Bad request | The body could not be read, typically a string or null where an integer is expected: `could not convert string to integer: ten. path 'minbookees'`, `could not convert string to integer: fake_id. path 'tags[3].id'`, or `Error converting value {null} to type 'System.Int32'`. |
| `400` | Bad request | `activityGroupId` does not match an existing activity group — `The Activity Group ID in the request is not valid`. |
| `400` | Bad request | `minBookees` is above 0 on an activity-type record — `The activity {id} is an activity type and can not have a minBookees greater than 0. Only Class types may have a minBookees greater than 0`. |
| `400` | Bad request | `maxBookees` is lower than `minBookees` — `Max Bookees must be equal to or a larger amount than Min Bookees`. |
| `400` | Bad request | No tag in `tags` exists as an `ACTIVITIES` or `SYSTEM` tag — `None of the tag IDs in the request are valid`. |
| `400` | Bad request | Some tags in `tags` are valid and some are not — `The tag(s) {ids} are invalid`. The valid ones are **not** applied; the whole update is abandoned. |
| `403` | Forbidden | The token is a member or non-member token. This endpoint is administrative, and both token types get `403`. |
| `404` | Not found | No activity matches the path identifier — `Unable to find the activity {id} to update`. Checked before any other validation. |
| `500` | Internal server error | An unexpected server-side failure, including a failure while saving the activity, its translations or its tag mappings. No detail is returned. |
