# Update form profile

`PUT /api/configuration/form-profiles/{formProfileId}`

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

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

## Overview

Rewrites a form profile: its name, and the whole definition of which sections and fields appear on
the form it drives. A form profile describes a member-facing form — sign-up or account management —
as eight fixed sections, each switched on or off, with each field inside a section switched on or
off.

**This is a full replacement, and the request must describe the entire form.** The definition in
your body overwrites the previous one, and validation insists that:

- **all eight sections are present, exactly once each** — `profileDetails`, `contactDetails`,
  `addressDetails`, `medicalDetails`, `userFields`, `emergencyDetails`, `vehicleDetails` and
  `acceptanceDetails`. Sending fewer, or sending one twice, is a `400`.
- **every field belonging to a section is present**, with a boolean value. You cannot send a section
  with only the field you want to change.

In practice the only safe way to use this endpoint is to read the profile with
`GET /api/configuration/form-profiles/{formProfileId}`, change the booleans you care about in the
returned form, and send the result back.

A form profile's form type is fixed at creation and cannot be changed here. The type also determines
what the request is validated against: only the sign-up and account-management types are supported,
and a profile of any other type cannot be updated at all — it fails with
`The form type identifier can't be used to validate the given form profile.`

Validation runs after the profile is confirmed to exist and before anything is written, so a
rejected request changes nothing. On success the response is `204 No Content`.

## Endpoint

`PUT {base_url}/api/configuration/form-profiles/{formProfileId}`

`{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 |
|------|------|----------|-------------|
| `formProfileId` | integer (int32) | Yes | Numeric identifier of the form profile to rewrite, as returned by `GET /api/configuration/form-profiles`. If it matches nothing the request fails with `404 No form profile could be found with the ID of {id}`. |

## Request body

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| `formProfileName` | string | Yes | The profile's name, used to identify it when profiles are listed and assigned. Mandatory (`The form profile name cannot be empty.`) and limited to 100 characters. Always overwritten, so send the existing name when you only mean to change the form. |
| `form` | array of object | Yes | The complete form definition — one entry per section. Mandatory (`The form cannot be empty.`). Must contain **exactly** the eight sections listed under `form[].sectionName`, each once: any missing produce `The following section names : {names} are missing for the given form type.`, and a count that does not match eight produces `The section names in the form don't match the given form type.`. Order does not matter. The array replaces the stored definition wholesale. |
| `form[].objectFields` | string | No | Not part of the request — do not send it. Anything you send here is ignored. |
| `form[].arrayFields` | string | No | Not part of the request — do not send it. Like `objectFields`, anything you send here is ignored. |
| `form[].sectionName` | string (enum) | Yes | One of: `profileDetails`, `contactDetails`, `addressDetails`, `userFields`, `medicalDetails`, `emergencyDetails`, `vehicleDetails`, `acceptanceDetails`. |
| `form[].display` | boolean | Yes | Whether this section is shown on the form. Mandatory (`The display field cannot be empty.`). It controls the section as a whole and is independent of the individual field switches in `fields` — turning a section off does not change them. |
| `form[].fields` | string | No | The field-level switches for this section. For every section except `userFields` this is an object whose properties are that section's field names with boolean values, and **all of them must be present**: a missing one gives `The following field names: {names} are missing for the section name called {section}.`, an extra or renamed one gives `The fields for the section name called {section} don't match with the required by the given form type.`, and a null or non-boolean value gives `The following properties names: {names} for the section name called {section} can only be a boolean type and can't have a null value.`. Omitting `fields` for such a section is also rejected, naming every field it expected. Get the exact field names for each section from `GET /api/configuration/form-profiles/{formProfileId}`. For `userFields` the shape is different: an array of `{ "id": <user field id>, "membershipTypeIds": [ … ] }`, and it is the one section where `fields` may be omitted or null. Each `id` must be an existing user field between 1 and 32767, each membership type must exist, and neither user field ids nor the membership type ids within one entry may repeat. |

## Sample request

```bash title="cURL"
curl -X PUT '{base_url}/api/configuration/form-profiles/{formProfileId}' \
  -H 'Authorization: Bearer {accessToken}' \
  -H 'X-Use-SSO: true' \
  -H 'Content-Type: application/json' \
  -d '{
  "formProfileName": "string",
  "form": [
    {
      "sectionName": "profileDetails",
      "display": true
    }
  ]
}'
```

## Errors

| Status | Meaning | When |
|--------|---------|------|
| `400` | Bad request | `formProfileName` is missing or empty (`The form profile name cannot be empty.`), longer than 100 characters, `form` is missing (`The form cannot be empty.`), or a section omits `sectionName` (`The section name field cannot be empty.`) or `display` (`The display field cannot be empty.`). These are validation failures, so the body is a validation problem document. |
| `400` | Bad request | A section's `fields` could not be parsed as either an object or an array — `Unable to parse the form as a valid input`. |
| `400` | Bad request | One or more of the eight sections is absent — `The following section names : {names} are missing for the given form type.` |
| `400` | Bad request | The number of sections sent is not eight, typically a duplicate — `The section names in the form don't match the given form type.` |
| `400` | Bad request | A section omits one or more of its fields, or omits `fields` entirely — `The following field names: {names} are missing for the section name called {section}.` |
| `400` | Bad request | A section's `fields` contains a property that is not a boolean, or is null — `The following properties names: {names} for the section name called {section} can only be a boolean type and can't have a null value.` |
| `400` | Bad request | A section's `fields` contains more properties than the section defines — `The fields for the section name called {section} don't match with the required by the given form type.` |
| `400` | Bad request | `userFields` problems, each with its own message: `A user field ID was given as null which is not valid`; `A user field ID {id} is invalid and must be between 1 and 32767`; `Duplicate user field IDs have been provided, ensure that a user field only occurs once in the request`; `A user field (with the ID {id}) was given MembershipTypeIds as null but expects at least an empty array`; `Duplicate membership type IDs have been provided (where user field ID is {id}), ensure that a membership type only occurs once per user field`; `The user field(s) with the ID(s) {ids} don't match any found in the database`; `The membership type(s) with the ID(s) {ids} don't match any found in the database`. |
| `400` | Bad request | The profile's form type is neither sign-up nor account management, so it cannot be validated or updated — `The form type identifier can't be used to validate the given form profile.` |
| `404` | Not found | No form profile has that identifier — `No form profile could be found with the ID of {id}`. Checked before the body is validated. |
| `500` | Internal server error | An unexpected server-side failure. No detail is returned. |
