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

# User Action Reason API | FusionAuth Docs

Learn about the APIs for creating, retrieving, updating and deleting user action reasons.

# User Action Reason API

[Edit on GitHub](https://github.com/FusionAuth/fusionauth-site/blob/main/astro/src/content/docs/apis/user-action-reasons.mdx)

[View Markdown](https://fusionauth.io/docs/apis/user-action-reasons.md)

This page contains the APIs that are used to manage user action reasons. Here are the APIs:

## Create a User Action Reason

This API is used to create an User Action Reason. Specifying an Id on the URI will instruct FusionAuth to use that Id when creating the User Action Reason. Otherwise, FusionAuth will generate an Id for the User Action Reason.

### Request

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

Create a User Action Reason with a randomly generated Id

POST/api/user-action-reason

OpenAPI Spec

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

Create a User Action Reason with the given Id

POST/api/user-action-reason/{userActionReasonId}

OpenAPI Spec

#### Request Parameters

`userActionReasonId`UUIDoptionalDefaults to secure random UUID

The Id to use for the new User Action Reason. If not specified a secure random UUID will be generated.

#### Request Body

`userActionReason.code`Stringrequired

A short code for the User Action Reason.

`userActionReason.localizedTexts`Map<Locale, String>optional

A mapping of localized text for the User Action Reason. The key is the Locale and the value is the localized text.

`userActionReason.text`Stringrequired

The text of the User Action Reason.

*Example Request JSON*

```json
{
  "userActionReason": {
    "code": "VTOS",
    "localizedTexts": {
      "fr": "Violation de nos Conditions générales d'utilisation"
    },
    "text": "Violation of our Terms of Service"
  }
}
```

### Response

The response for this API contains the information for the User Action Reason that was created.

*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). |
| 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

`userActionReason.code`String

A short code for the User Action Reason.

`userActionReason.id`UUID

The Id of the User Action Reason.

`userActionReason.localizedTexts`Map<Locale, String>

A mapping of localized text for the User Action Reason. The key is the Locale and the value is the localized text.

`userActionReason.text`String

The text of the User Action Reason.

*Example Response JSON for a Single User Action Reason*

```json
{
  "userActionReason": {
    "code": "VTOS",
    "id": "00000000-0000-0000-0000-000000000002",
    "localizedTexts": {
      "fr": "Violation de nos Conditions générales d'utilisation"
    },
    "text": "Violation of our Terms of Service"
  }
}
```

## Retrieve a User Action Reason

This API is used to retrieve one or all of the configured User Action Reasons. Specifying an Id on the URI will retrieve a single User Action Reason. Leaving off the Id will retrieve all of the User Action Reasons.

### Request

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

Retrieve all of the User Action Reasons

GET/api/user-action-reason

OpenAPI Spec

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

Retrieve a User Action Reason by Id

GET/api/user-action-reason/{userActionReasonId}

OpenAPI Spec

#### Request Parameters

`userActionReasonId`UUIDoptional

The Id of the User Action Reason to retrieve.

### Response

The response for this API contains either a single User Action Reason or all of the User Action Reasons. When you call this API with an Id the response will contain just that User Action Reason. When you call this API without an Id the response will contain all of the User Action Reasons. Both response types are defined below along with an example JSON response.

*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 requested 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

`userActionReason.code`String

A short code for the User Action Reason.

`userActionReason.id`UUID

The Id of the User Action Reason.

`userActionReason.localizedTexts`Map<Locale, String>

A mapping of localized text for the User Action Reason. The key is the Locale and the value is the localized text.

`userActionReason.text`String

The text of the User Action Reason.

*Example Response JSON for a Single User Action Reason*

```json
{
  "userActionReason": {
    "code": "VTOS",
    "id": "00000000-0000-0000-0000-000000000002",
    "localizedTexts": {
      "fr": "Violation de nos Conditions générales d'utilisation"
    },
    "text": "Violation of our Terms of Service"
  }
}
```

#### Response Body

`userActionReasons`Array

The list of User Action Reason objects.

`userActionReasons[x].code`String

A short code for the User Action Reason.

`userActionReasons[x].id`UUID

The Id of the User Action Reason.

`userActionReasons[x].localizedTexts`Map<Locale, String>

A mapping of localized text for the User Action Reason. The key is the Locale and the value is the localized text.

`userActionReasons[x].text`String

The text of the User Action Reason.

*Example Response JSON for all the User Action Reasons*

```json
{
  "userActionReasons": [
    {
      "code": "VTOS",
      "id": "00000000-0000-0000-0000-000000000002",
      "localizedTexts": {
        "fr": "Violation de nos Conditions générales d'utilisation"
      },
      "text": "Violation of our Terms of Service"
    }
  ]
}
```

## Update a User Action Reason

This API is used to update an existing User Action Reason.

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

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

### Request

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

Update the User Action Reason by Id

PUT/api/user-action-reason/{userActionReasonId}

OpenAPI Spec

PATCH/api/user-action-reason/{userActionReasonId}

OpenAPI Spec

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

`userActionReasonId`UUIDrequired

The Id of the User Action Reason to update.

#### Request Body

`userActionReason.code`Stringrequired

A short code for the User Action Reason.

`userActionReason.localizedTexts`Map<Locale, String>optional

A mapping of localized text for the User Action Reason. The key is the Locale and the value is the localized text.

`userActionReason.text`Stringrequired

The text of the User Action Reason.

*Example Request JSON*

```json
{
  "userActionReason": {
    "code": "VTOS",
    "localizedTexts": {
      "fr": "Violation de nos Conditions générales d'utilisation"
    },
    "text": "Violation of our Terms of Service"
  }
}
```

### Response

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

`userActionReason.code`String

A short code for the User Action Reason.

`userActionReason.id`UUID

The Id of the User Action Reason.

`userActionReason.localizedTexts`Map<Locale, String>

A mapping of localized text for the User Action Reason. The key is the Locale and the value is the localized text.

`userActionReason.text`String

The text of the User Action Reason.

*Example Response JSON for a Single User Action Reason*

```json
{
  "userActionReason": {
    "code": "VTOS",
    "id": "00000000-0000-0000-0000-000000000002",
    "localizedTexts": {
      "fr": "Violation de nos Conditions générales d'utilisation"
    },
    "text": "Violation of our Terms of Service"
  }
}
```

## Delete a User Action Reason

This API is used to delete an User Action Reason. You must specify the Id of the User Action Reason on the URI.

### Request

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

Delete a User Action Reason by Id

DELETE/api/user-action-reason/{userActionReasonId}

OpenAPI Spec

#### Request Parameters

`userActionReasonId`UUIDrequired

The Id of the User Action Reason to delete.

### Response

This API does not return a JSON response body.

*Response Codes*

| Code | Description |
| --- | --- |
| 200 | The request was successful. |
| 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 requested 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. |