> For the complete documentation index, see [llms.txt](https://fusionauth.io/docs/llms.txt)

# Update a Consent

API documentation for the FusionAuth Update a Consent API.

# Update a Consent

This API is used to update an existing Consent.

You must specify all of the properties of the Consent when calling this API with the `PUT` HTTP method. When used with `PUT`, this API doesn't merge the existing Consent and your new data. It replaces the existing Consent with your new data.

Utilize the `PATCH` HTTP method to send specific changes to merge into an existing Consent.

## Request

[!Global API Key Authentication](https://fusionauth.io/docs/apis/authentication.md#global-api-key-authentication)

Update the Consent with the given Id

PUT/api/consent/{consentId}

OpenAPI Spec

PATCH/api/consent/{consentId}

OpenAPI Spec

note

For backward compatibility, the `PATCH` method accepts the same media type (specified by a `Content-Type` of `application/json`) and body as the `PUT` request. You can also use the following media types for different behavior:

*   [JSON Patch/RFC 6902](https://www.rfc-editor.org/rfc/rfc6902): `application/json-patch+json`
*   [JSON Merge Patch/RFC 7396](https://www.rfc-editor.org/rfc/rfc7396): `merge-patch+json`

For details, see the [PATCH documentation](https://fusionauth.io/docs/apis.md#the-patch-http-method).

Using a media type of `application/json` merges the provided request parameters into the existing object. As a result, all parameters are optional with `PATCH`: only provide the values you want to change. To remove a value, provide a `null` value. Patching an `Array` appends all values in the new list to the old list.

### Request Parameters

`consentId`UUIDrequired

The Id to use for the Consent to update.

#### Request Body

`consent.consentEmailTemplateId`UUIDoptional

The Id of the Email Template that is used to send confirmation to the end user. If this value is omitted an email will not be sent to the user.

`consent.countryMinimumAgeForSelfConsent`Map<Locale, Integer>optional

This property optionally overrides the value provided in **defaultMinimumAgeForSelfConsent** if a more specific value is defined. This can be useful when the age of self consent varies by country.

For example, consider the following definition:

```json
{
"de": 17
}
```

If a user has defined their preferred locale to be Germany (`de`), the age of self consent defined for Germany will be used instead of the value defined by **defaultMinimumAgeForSelfConsent**.

`consent.data`Objectoptional

An object that can hold any information about the Consent that should be persisted.

`consent.defaultMinimumAgeForSelfConsent`Integerrequired

The default age of self consent used when granting this consent to a user unless a more specific one is provided by the **countryMinimumAgeForSelfConsent**.

A user that meets the minimum age of self consent may self-consent, this means the recipient may also be the giver.

`consent.emailPlus.enabled`BooleanoptionalDefaults to false

Set this value to `true` to enable the Email Plus workflow.

Email Plus provides and additional opportunity to notify the giver that consent was provided. For example, if **consentEmailTemplateId** is provided then when the consent is granted an email will be sent to notify the giver that consent was granted to the user. When using Email Plus a follow up email will be sent to the giver at a randomly selected time within the configured minimum and maximum range of hours.

`consent.emailPlus.emailTemplateId`UUIDrequired

The Id of the Email Template that is used to send the reminder notice to the consent giver. This value is required when **emailPlus.enabled** is set to `true`.

`consent.emailPlus.maximumTimeToSendEmailInHours`IntegeroptionalDefaults to 48

The maximum number of hours to wait until sending the reminder notice the consent giver.

`consent.emailPlus.minimumTimeToSendEmailInHours`IntegeroptionalDefaults to 24

The minimum number of hours to wait until sending the reminder notice the consent giver.

`consent.multipleValuesAllowed`BooleanoptionalDefaults to false

Set this value to `true` if more than one value may be used when granting this consent to a User. When this value is `false` a maximum of one value may be assigned.

This value is not used when no **values** have been defined for this consent.

`consent.name`Stringrequired

The unique name of the consent.

`consent.values`Array<String>optional

One or more values that may be assigned for this consent.

*Example Request JSON*

```json
{
  "consent": {
    "consentEmailTemplateId": "61cba163-2d53-4d2d-ad7f-801c27f0c277",
    "countryMinimumAgeForSelfConsent": {
      "de": 21
    },
    "defaultMinimumAgeForSelfConsent": 18,
    "emailPlus": {
      "enabled": true,
      "emailTemplateId": "9cd65fca-5aa0-4861-899b-8712d8ec963f",
      "maximumTimeToSendEmailInHours": 48,
      "minimumTimeToSendEmailInHours": 24
    },
    "multipleValuesAllowed": false,
    "name": "Patient Consent",
    "values": [
      "Written",
      "Verbal"
    ]
  }
}
```

## Response

The response for this API contains the Consent that was updated.

*Response Codes*

| Code | Description |
| --- | --- |
| 200 | The request was successful. The response will contain a JSON body. |
| 400 | The request was invalid and/or malformed. The response will contain an [Errors](https://fusionauth.io/docs/apis/errors.md) JSON Object with the specific errors. This status will also be returned if a paid FusionAuth license is required and is not present. |
| 401 | You did not supply a valid Authorization header. The header was omitted or your API key was not valid. The response will be empty. See [Authentication](https://fusionauth.io/docs/apis/authentication.md). |
| 404 | The object you are trying to update doesn't exist. The response will be empty. |
| 500 | There was an internal error. A stack trace is provided and logged in the FusionAuth log files. The response will be empty. |
| 503 | The search index is not available or encountered an exception so the request cannot be completed. The response will contain a JSON body. |

#### Response Body

`consent.consentEmailTemplateId`UUID

The Id of the Email Template that is used to send confirmation to the end user.

`consent.countryMinimumAgeForSelfConsent`Map<Locale, Integer>

This property optionally overrides the value provided in **defaultMinimumAgeForSelfConsent** if a more specific value is defined. This can be useful when the age of self consent varies by country.

For example, consider the following definition:

```json
{
"de": 17
}
```

If a user has defined their preferred locale to be Germany (`de`), the age of self consent defined for Germany will be used instead of the value defined by **defaultMinimumAgeForSelfConsent**.

`consent.data`Object

An object that can hold any information about the Consent that should be persisted.

`consent.defaultMinimumAgeForSelfConsent`Integer

The default age of self consent used when granting this consent to a user unless a more specific one is provided by the **countryMinimumAgeForSelfConsent**.

A user that meets the minimum age of self consent may self-consent, this means the recipient may also be the giver.

`consent.emailPlus.enabled`Boolean

When this value is `true` the Email Plus workflow is enabled.

Email Plus provides and additional opportunity to notify the giver that consent was provided. For example, if **consentEmailTemplateId** is provided then when the consent is granted an email will be sent to notify the giver that consent was granted to the user. When using Email Plus a follow up email will be sent to the giver at a randomly selected time within the configured minimum and maximum range of hours.

`consent.emailPlus.emailTemplateId`UUID

The Id of the Email Template that is used to send the reminder notice to the consent giver.

`consent.emailPlus.maximumTimeToSendEmailInHours`Integer

The maximum number of hours to wait until sending the reminder notice the consent giver.

`consent.emailPlus.minimumTimeToSendEmailInHours`Integer

The minimum number of hours to wait until sending the reminder notice the consent giver.

`consent.id`UUID

The unique Id of the consent.

`consent.insertInstant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) that the Consent was added to the FusionAuth database.

`consent.lastUpdateInstant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) that the Consent was updated in the FusionAuth database.

`consent.multipleValuesAllowed`Boolean

When this value is `true` more than one value may be used when granting this consent to a User.

This value is not used when no **values** have been defined for this consent.

`consent.name`String

The unique name of the consent.

`consent.values`Array<String>

One or more values that may be assigned for this consent.

*Example Response JSON*

```json
{
  "consent": {
    "consentEmailTemplateId": "61cba163-2d53-4d2d-ad7f-801c27f0c277",
    "countryMinimumAgeForSelfConsent": {
      "de": 21
    },
    "defaultMinimumAgeForSelfConsent": 18,
    "emailPlus": {
      "enabled": true,
      "emailTemplateId": "9cd65fca-5aa0-4861-899b-8712d8ec963f",
      "maximumTimeToSendEmailInHours": 48,
      "minimumTimeToSendEmailInHours": 24
    },
    "id": "d512b9b8-876f-4b5e-81f0-3e180b6ea485",
    "insertInstant": 1595361142909,
    "lastUpdateInstant": 1595361143101,
    "multipleValuesAllowed": false,
    "name": "Patient Consent",
    "values": [
      "Written",
      "Verbal"
    ]
  }
}
```