> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apinizer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Condition in RLCL

> Updates the condition in an RLCL. Completely replaces the existing condition with the new one provided in the request body. All existing condition rules are removed and replaced with the new condition rules.

## Overview

Updates the condition in an RLCL. Completely replaces the existing condition with the new one provided in the request body. All existing condition rules are removed and replaced with the new condition rules.

## Endpoint

```
PUT /apiops/projects/{projectName}/rlcl/{rlclName}/condition/
```

## Authentication

Requires a Personal API Access Token.

### Header

```
Authorization: Bearer YOUR_TOKEN
```

## Request

### Headers

| Header        | Value            | Required |
| ------------- | ---------------- | -------- |
| Authorization | Bearer {token}   | Yes      |
| Content-Type  | application/json | Yes      |

### Path Parameters

| Parameter   | Type   | Required | Description  |
| ----------- | ------ | -------- | ------------ |
| projectName | string | Yes      | Project name |
| rlclName    | string | Yes      | RLCL name    |

### Request Body

#### Full JSON Body Example - Simple Condition

```json theme={null}
{
  "conditionRuleList": [
    {
      "conditionCriteria": "VALUE",
      "firstVariable": {
        "name": "userTypeHeader",
        "type": "HEADER",
        "headerName": "X-User-Type"
      },
      "variableDataType": "STRING",
      "valueComparisonOperator": "EQ",
      "secondValueSource": "VALUE",
      "secondValue": "PREMIUM"
    }
  ]
}
```

#### Full JSON Body Example - Complex Condition with Multiple Rules

```json theme={null}
{
  "conditionRuleList": [
    {
      "conditionCriteria": "OR",
      "conditionRuleList": [
        {
          "conditionCriteria": "VALUE",
          "firstVariable": {
            "name": "userTypeHeader",
            "type": "HEADER",
            "headerName": "X-User-Type"
          },
          "variableDataType": "STRING",
          "valueComparisonOperator": "EQ",
          "secondValueSource": "VALUE",
          "secondValue": "PREMIUM"
        },
        {
          "conditionCriteria": "VALUE",
          "firstVariable": {
            "name": "apiVersionHeader",
            "type": "HEADER",
            "headerName": "X-API-Version"
          },
          "variableDataType": "STRING",
          "valueComparisonOperator": "EQ",
          "secondValueSource": "VALUE",
          "secondValue": "v2"
        }
      ]
    }
  ]
}
```

#### Request Body Fields

| Field             | Type           | Required | Default | Description                                                                               |
| ----------------- | -------------- | -------- | ------- | ----------------------------------------------------------------------------------------- |
| conditionRuleList | array\[object] | Yes      | -       | List of condition rules. See [ConditionRuleDTO](#conditionruledto-conditionrulelist-item) |

### ConditionRuleDTO (conditionRuleList item)

| Field                   | Type           | Required | Description                                                                                                                    |
| ----------------------- | -------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
| conditionRuleList       | array\[object] | No       | Nested condition rules (for complex conditions)                                                                                |
| conditionCriteria       | string         | Yes      | Condition criteria. See [EnumConditionCriteria](#enumconditioncriteria-conditioncriteria)                                      |
| firstVariable           | object         | Yes      | First variable for comparison. See [Variable Object](#variable-object-firstvariablesecondvariable)                             |
| variableDataType        | string         | Yes      | Variable data type. See [EnumConditionVariableDataType](#enumconditionvariabledatatype-variabledatatype)                       |
| dateFormat              | string         | No       | Date format for date comparisons                                                                                               |
| valueComparisonOperator | string         | Yes      | Comparison operator. See [EnumConditionValueComparisonOperator](#enumconditionvaluecomparisonoperator-valuecomparisonoperator) |
| secondValueSource       | string         | Yes      | Second value source. See [EnumConditionValueSource](#enumconditionvaluesource-secondvaluesource)                               |
| secondValue             | string         | No\*     | Static value for comparison (required if secondValueSource is VALUE)                                                           |
| secondVariable          | object         | No\*     | Second variable for comparison (required if secondValueSource is VARIABLE)                                                     |

### EnumConditionCriteria (conditionCriteria)

* `VALUE` - Value comparison (used for actual comparison operations)
* `NOT` - Negation (negates the condition)
* `AND` - Logical AND (all nested conditions must match)
* `OR` - Logical OR (any nested condition must match)

<Note>
  For actual value comparisons, use `VALUE`. Use `AND`/`OR`/`NOT` for combining multiple conditions.
</Note>

### EnumConditionVariableDataType (variableDataType)

* `STRING` - String data type
* `NUMERIC` - Numeric data type
* `DATE` - Date data type

<Note>
  `BOOLEAN` is not supported. Use `STRING` with `EQ`/`NE` operators for boolean-like comparisons.
</Note>

### EnumConditionValueComparisonOperator (valueComparisonOperator)

* `LT` - Less than
* `LE` - Less than or equal to
* `GT` - Greater than
* `GE` - Greater than or equal to
* `EQ` - Equal to
* `NE` - Not equal to
* `EQ_IGNORE_CASE` - Equal to, case insensitive (string only)
* `NE_IGNORE_CASE` - Not equal to, case insensitive (string only)
* `STARTS_WITH` - Starts with (string only)
* `NOT_STARTS_WITH` - Does not start with (string only)
* `STARTS_WITH_IGNORE_CASE` - Starts with, case insensitive (string only)
* `NOT_STARTS_WITH_IGNORE_CASE` - Does not start with, case insensitive (string only)
* `ENDS_WITH` - Ends with (string only)
* `NOT_ENDS_WITH` - Does not end with (string only)
* `ENDS_WITH_IGNORE_CASE` - Ends with, case insensitive (string only)
* `NOT_ENDS_WITH_IGNORE_CASE` - Does not end with, case insensitive (string only)
* `CONTAINS` - Contains (string only)
* `NOT_CONTAINS` - Does not contain (string only)
* `CONTAINS_IGNORE_CASE` - Contains, case insensitive (string only)
* `NOT_CONTAINS_IGNORE_CASE` - Does not contain, case insensitive (string only)
* `IS_EXISTS` - Variable exists (regardless of value)
* `IS_NOT_EXISTS` - Variable does not exist
* `IS_NOT_EMPTY` - Variable exists and is not empty
* `IS_EMPTY` - Variable does not exist or is empty
* `EXISTS_AND_EMPTY` - Variable exists but is empty
* `IN` - Value is in list
* `NOT_IN` - Value is not in list
* `IN_IGNORE_CASE` - Value is in list, case insensitive (string only)
* `NOT_IN_IGNORE_CASE` - Value is not in list, case insensitive (string only)

### EnumConditionValueSource (secondValueSource)

* `VALUE` - Static value (use `secondValue` field)
* `VARIABLE` - Variable value (use `secondVariable` field)

### Variable Object (firstVariable/secondVariable)

See [Variable Definition](/api-reference/appendix/variable-definition) for complete variable documentation.

| Field              | Type    | Required | Description                                                                                                                         |                                                    |
| ------------------ | ------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- |
| name               | string  | Yes      | Variable name (unique identifier)                                                                                                   |                                                    |
| description        | string  | No       | Variable description                                                                                                                |                                                    |
| type               | string  | Yes      | Variable type. See [Variable Types](/api-reference/appendix/variable-definition)                                                    |                                                    |
| headerName         | string  | No\*     | Header name (required if type=HEADER)                                                                                               |                                                    |
| paramType          | string  | No\*     | Parameter type (required if type=PARAMETER). See [EnumVariableParameterType](/api-reference/appendix/variable-definition)           |                                                    |
| paramName          | string  | No\*     | Parameter name (required if type=PARAMETER)                                                                                         |                                                    |
| paramPath          | string  | No\*     | Parameter path template (required if type=PARAMETER and paramType=PATH)                                                             |                                                    |
| formName           | string  | No       | Form field name (optional, used if paramType=FORM)                                                                                  |                                                    |
| messageContentType | string  | No\*     | Message content type (required if type=BODY). See [EnumMessageContentType](/api-reference/appendix/variable-definition)             |                                                    |
| xpathValue         | string  | No\*     | XPath expression (required if type=BODY and messageContentType=XML)                                                                 |                                                    |
| jsonPathValue      | string  | No\*     | JsonPath expression (required if type=BODY and messageContentType=JSON)                                                             |                                                    |
| contextValue       | string  | No\*     | Context value (required if type=CONTEXT\_VALUES). See [EnumVariableContextValue](/api-reference/appendix/variable-definition)       |                                                    |
| zoneId             | string  | No\*     | Time zone ID (required for date/time context values)                                                                                |                                                    |
| initWithScript     | boolean | No       | false                                                                                                                               | Whether to initialize with script (default: false) |
| scriptLanguage     | string  | No\*     | Script language (required if type=CUSTOM or initWithScript=true). See [EnumScriptType](/api-reference/appendix/variable-definition) |                                                    |
| scriptBody         | string  | No\*     | Script body (required if type=CUSTOM or initWithScript=true)                                                                        |                                                    |

### Important Notes

* **Complete Replacement**: The existing condition is completely replaced with the new condition provided in the request body
* All existing condition rules are removed and replaced with the new condition rules
* If the new condition is empty or invalid, it will be reset to the default condition (AND rule)
* Conditions are evaluated before applying rate limiting
* If condition evaluates to false, RLCL is not applied
* Nested conditions are supported for complex logic

## Response

### Success Response (200 OK)

```json theme={null}
{
  "success": true
}
```

### Error Response (400 Bad Request)

```json theme={null}
{
  "error": "bad_request",
  "error_description": "condition value can not be empty!"
}
```

## cURL Example

```bash theme={null}
curl -X PUT \
  "https://demo.apinizer.com/apiops/projects/MyProject/rlcl/PremiumUserRLCL/condition/" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "conditionRuleList": [
      {
        "conditionCriteria": "VALUE",
        "firstVariable": {
          "name": "userTypeHeader",
          "type": "HEADER",
          "headerName": "X-User-Type"
        },
        "variableDataType": "STRING",
        "valueComparisonOperator": "EQ",
        "secondValueSource": "VALUE",
        "secondValue": "PREMIUM"
      }
    ]
  }'
```

## Permissions

* User must have **`IDENTITY` + `MANAGE`** permission in the project

## Notes and Warnings

* **Complete Replacement**:
  * The existing condition is completely replaced with the new condition
  * All existing condition rules are removed and replaced
* **Condition Evaluation**:
  * Condition is evaluated before applying rate limiting
  * If condition is false, RLCL is not applied
* **Nested Conditions**:
  * Complex conditions can be created using nested rules
  * Use conditionRuleList for nested logic

## Related Documentation

* [Add Condition](/api-reference/rlcl/condition/add-condition) - Add condition to RLCL
* [Delete Condition](/api-reference/rlcl/condition/delete-condition) - Remove condition from RLCL
