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

# Update a User Action

API documentation for the FusionAuth Update a User Action API.

# Update a User Action

This API is used to update an existing User Action.

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

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

## Request

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

Update a User Action by Id

PUT/api/user-action/{userActionId}

OpenAPI Spec

PATCH/api/user-action/{userActionId}

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

`userActionId`UUIDrequired

The Id of the User Action to update.

#### Request Body

`userAction.cancelEmailTemplateId`UUIDoptional

The Id of the Email Template that is used when User Actions are canceled.

`userAction.endEmailTemplateId`UUIDoptional

The Id of the Email Template that is used when User Actions expired automatically (end).

`userAction.includeEmailInEventJSON`Booleanoptional

Whether to include the email information in the JSON that is sent to the Webhook when a user action is taken.

`userAction.localizedNames`Map<Locale, String>optional

A mapping of localized names for this User Action. The key is the Locale and the value is the name of the User Action for that language.

`userAction.modifyEmailTemplateId`UUIDoptional

The Id of the Email Template that is used when User Actions are modified.

`userAction.name`Stringrequired

The name of this User Action.

`userAction.options`Arrayoptional

The list of User Action Options.

`userAction.options[x].localizedNames`Map<Locale, String>optional

A mapping of localized names for this User Action Option. The key is the Locale and the value is the name of the User Action Option for that language.

`userAction.options[x].name`Stringoptional

The name of this User Action Option.

`userAction.preventLogin`BooleanoptionalDefaults to false

Whether or not this User Action will prevent user login. When this value is set to `true` the action must also be marked as a time based action. See **temporal**.

`userAction.sendEndEvent`BooleanoptionalDefaults to true

Whether or not FusionAuth will send events to any registered Webhooks when this User Action expires.

Prior to version `1.36.7` this value defaulted to `false`. The default value was modified to be `true` by default to reduce confusion because in most cases when utilizing User Action events, the end event is desired.

`userAction.startEmailTemplateId`UUIDoptional

The Id of the Email Template that is used when User Actions are started (created).

`userAction.temporal`BooleanoptionalDefaults to false

Whether or not this User Action is time-based (temporal). Time based actions are temporary and once expired the action will no longer be considered active and will not affect the user.

An action that prevents login must be time based.

Time based actions can still be applied to a user for an indefinite amount of time. A time based action is one that may be canceled or modified. A non time-based action may not be modified or canceled.

An example of a non time-based action would be a reward, such as sending a user a coupon. This action cannot be canceled, or modified. When a non time-based action is taken, it is immediately complete and will show up in the user action history.

`userAction.userEmailingEnabled`BooleanoptionalDefaults to false

Whether or not email is enabled for this User Action. If this is true, a checkbox will appear in the FusionAuth UI for this User Action that allows admins to specify that they want to email the User.

`userAction.userNotificationsEnabled`BooleanoptionalDefaults to false

Whether or not user notifications are enabled for this User Action. If this is true, a checkbox will appear in the FusionAuth UI for this User Action that allows admins to specify that they want to "notify users". What this does is send an additional flag named **notifyUser** in the event JSON that is sent to any registered Webhooks.

*Example Request JSON*

```json
{
  "userAction": {
    "cancelEmailTemplateId": "00000000-0000-0000-0000-000000000001",
    "endEmailTemplateId": "00000000-0000-0000-0000-000000000002",
    "includeEmailInEventJSON": true,
    "localizedNames": {
      "de": "Dauerhaft Verbieten"
    },
    "modifyEmailTemplateId": "00000000-0000-0000-0000-000000000003",
    "name": "Permanently Ban",
    "options": [
      {
        "name": "Nicely",
        "localizedNames": {
          "de": "Schön"
        }
      },
      {
        "name": "Meanly",
        "localizedNames": {
          "de": "Bedeuten"
        }
      }
    ],
    "preventLogin": true,
    "sendEndEvent": true,
    "startEmailTemplateId": "00000000-0000-0000-0000-000000000004",
    "temporal": true,
    "userEmailingEnabled": true,
    "userNotificationsEnabled": true
  }
}
```

## Response

The response for this API contains the new information for the User Action 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

`userAction.active`Boolean

Whether or not this User Action is active.

`userAction.cancelEmailTemplateId`UUID

The Id of the Email Template that is used when User Actions are canceled.

`userAction.endEmailTemplateId`UUID

The Id of the Email Template that is used when User Actions expired automatically (end).

`userAction.id`UUID

The Id of the User Action.

`userAction.insertInstant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) when the User Action was created.

`userAction.includeEmailInEventJSON`Boolean

Whether to include the email information in the JSON that is sent to the Webhook when a user action is taken.

`userAction.lastUpdateInstant`Long

The [instant](https://fusionauth.io/docs/reference/data-types.md#instants) when the User Action was last updated.

`userAction.localizedNames`Map<Locale, String>

A mapping of localized names for this User Action. The key is the Locale and the value is the name of the User Action for that language.

`userAction.modifyEmailTemplateId`UUID

The Id of the Email Template that is used when User Actions are modified.

`userAction.modifyEmailTemplateId`String

The name of this User Action.

`userAction.options`Array

The list of User Action Options.

`userAction.options[x].localizedNames`Map<Locale, String>

A mapping of localized names for this User Action Option. The key is the Locale and the value is the name of the User Action Option for that language.

`userAction.options[x].name`String

The name of this User Action Option.

`userAction.preventLogin`Boolean

Whether or not this User Action will prevent the User from logging in.

`userAction.sendEndEvent`Boolean

Whether or not FusionAuth will send events to any registered Webhooks when this User Action expires.

`userAction.startEmailTemplateId`UUID

The Id of the Email Template that is used when User Actions are started (created).

`userAction.temporal`Boolean

Whether or not this User Action is time-based (temporal). Time based actions are temporary and once expired the action will no longer be considered active and will not affect the user.

`userAction.userEmailingEnabled`Boolean

Whether or not email is enabled for this User Action. If this is true, a checkbox will appear in the FusionAuth UI for this User Action that allows admins to specify that they want to email the User.

`userAction.userNotificationsEnabled`Boolean

Whether or not user notifications are enabled for this User Action. If this is true, a checkbox will appear in the FusionAuth UI for this User Action that allows admins to specify that they want to "notify users". What is does is send an additional flag named **notifyUser** in the event JSON that is sent to any registered Webhooks.

*Example Response JSON for a Single User Action*

```json
{
  "userAction": {
    "active": true,
    "cancelEmailTemplateId": "00000000-0000-0000-0000-000000000001",
    "endEmailTemplateId": "00000000-0000-0000-0000-000000000002",
    "id": "00000000-0000-0000-0000-000000000042",
    "includeEmailInEventJSON": true,
    "localizedNames": {
      "de": "Dauerhaft Verbieten"
    },
    "modifyEmailTemplateId": "00000000-0000-0000-0000-000000000003",
    "name": "Permanently Ban",
    "options": [
      {
        "name": "Nicely",
        "localizedNames": {
          "de": "Schön"
        }
      },
      {
        "name": "Meanly",
        "localizedNames": {
          "de": "Bedeuten"
        }
      }
    ],
    "preventLogin": true,
    "sendEndEvent": true,
    "startEmailTemplateId": "00000000-0000-0000-0000-000000000004",
    "temporal": true,
    "userEmailingEnabled": true,
    "userNotificationsEnabled": true
  }
}
```