> For the complete documentation index, see [llms.txt](https://docs.genlogs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.genlogs.io/carrier-vetting/update-customer-vetting-rule.md).

# Update Customer Vetting Rule

### Authentication

Include your `Access-Token` and `x-api-key` in the header of your requests.

### Permissions

The `external-api-update-compliance-rules` permission is required to access this endpoint.

To retrieve the `customer_rule_id` before updating, use the List Customer Compliance Rules endpoint, which requires the `external-api-compliance-rules` permission.

### Endpoint

URL: `https://api.genlogs.io/customer-compliance-rules/{customer_rule_id}`\
Method: `PATCH`

Updates the status and/or parameter values of an existing customer compliance rule. At least one of `status` or `param_values` must be provided.

### Path Parameters

| Parameter          | Type          | Required | Description                                                  |
| ------------------ | ------------- | -------- | ------------------------------------------------------------ |
| `customer_rule_id` | string (UUID) | Yes      | Unique identifier of the customer compliance rule to update. |

### Request Body

| Field          | Type   | Required | Description                                               |
| -------------- | ------ | -------- | --------------------------------------------------------- |
| `status`       | string | No\*     | Rule status. Allowed values: `enabled`, `disabled`.       |
| `param_values` | object | No\*     | Rule configuration values used during carrier evaluation. |

\* At least one of `status` or `param_values` must be provided.

### Observed by GenLogs Validation

When updating the Observed by GenLogs rule, `param_values` is strictly validated before the update is processed.

Validation applies only to this external API endpoint. Internal GenLogs UI/API update flows are not affected.

#### `date_interval`

Must be a supported interval value:

* `1_day`
* `7_days`
* `14_days`
* `1_month`
* `3_months`
* `6_months`
* `12_months`
* `18_months`
* `2_years`
* `3_years`
* `4_plus_years`

#### `decision_matrix`

Must follow this structure:

{% code expandable="true" %}

```json
{"false": "<value>","true": "<value>"}
```

{% endcode %}

Rules:

* Only allowed keys: `false`, `true`
* `false` must be `review` or `fail`
* `true` must be `pass`
* No extra keys are allowed

Valid combinations:

| `false`  | `true` |
| -------- | ------ |
| `review` | `pass` |
| `fail`   | `pass` |

#### `fail_message`

Must be a strict boolean (`true` or `false`).

Rejected examples:

* `"false"` (string)
* `0` (number)

#### `pass_message`

Must be a strict boolean (`true` or `false`).

Rejected examples:

* `"true"` (string)
* `1` (number)

### Request Examples

#### Update status only

{% code overflow="wrap" %}

```bash
curl --location --request PATCH 'https://api.genlogs.io/customer-compliance-rules/{id}' \
--header 'access-token: <your-api-token>' \
--header 'x-api-key: <your-x-api-key>' \
--header 'Content-Type: application/json' \
--data '{
  "status": "enabled"
}'
```

{% endcode %}

#### Update Observed by GenLogs rule — review when not observed

{% code overflow="wrap" %}

```bash
curl --location --request PATCH 'https://api.genlogs.io/customer-compliance-rules/{id}' \
--header 'access-token: <your-api-token>' \
--header 'x-api-key: <your-x-api-key>' \
--header 'Content-Type: application/json' \
--data '{
  "status": "enabled",
  "param_values": {
    "date_interval": "1_month",
    "decision_matrix": {
      "false": "review",
      "true": "pass"
    },
    "fail_message": false,
    "pass_message": true
  }
}'
```

{% endcode %}

### Responses

| Status                      | Description                                                               |
| --------------------------- | ------------------------------------------------------------------------- |
| `200 OK`                    | Customer compliance rule updated successfully.                            |
| `400 Bad Request`           | Invalid request body, missing required fields, or invalid `param_values`. |
| `401 Unauthorized`          | Authentication credentials are missing or invalid.                        |
| `403 Forbidden`             | User does not have the required permission.                               |
| `404 Not Found`             | Customer compliance rule does not exist.                                  |
| `500 Internal Server Error` | Server error while processing the request.                                |

### Response Body

#### `200 OK`

{% code overflow="wrap" %}

```json
{
  "message": "Success! The customer rule has been updated.",
  "status_code": 200
}
```

{% endcode %}

#### `400 Bad Request`

Returned when:

* Neither `status` nor `param_values` is provided
* `param_values` contains invalid Observed by GenLogs values

Missing update fields

{% code overflow="wrap" %}

```json
{
    "message": "At least status or param_values must be provided for update"
}
```

{% endcode %}

Invalid `date_interval`

{% code expandable="true" %}

```json
{
    "detail": "Invalid param_values for Observed by GenLogs: param_values.date_interval: Value error, Unsupported date interval: last_week"
}
```

{% endcode %}

Invalid `decision_matrix` value

{% code expandable="true" %}

```json
{
    "detail": "Invalid param_values for Observed by GenLogs: param_values.decision_matrix.false: Input should be 'review' or 'fail'"
}
```

{% endcode %}

Invalid `decision_matrix` combination

{% code expandable="true" %}

```json
{
    "detail": "Invalid param_values for Observed by GenLogs: param_values.decision_matrix.true: Input should be 'pass'"
}
```

{% endcode %}

Non-boolean message flags

{% code expandable="true" %}

```json
{
    "detail": "Invalid param_values for Observed by GenLogs: param_values.fail_message: Input should be a valid boolean"
}
```

{% endcode %}

#### `401 Unauthorized`

{% code expandable="true" %}

```json
{
    "detail": {"message": "Token is missing","subcode": "TOKEN_MISSING"}
}
```

{% endcode %}

#### `403 Forbidden`

{% code expandable="true" %}

```json
{
    "detail": "User does not have the required permissions to access this resource"
}
```

{% endcode %}

#### `404 Not Found`

{% code expandable="true" %}

```json
{
    "message": "Customer rule id: {id} not found"
}
```

{% endcode %}

## Update customer compliance rule

> Updates the status and/or parameter values of an existing customer compliance rule. At least one of \`status\` or \`param\_values\` must be provided. The authenticated company must have vetting access permissions.<br>

```json
{"openapi":"3.0.3","info":{"title":"Customer Compliance Rules API","version":"1.0.0"},"servers":[{"url":"https://api.genlogs.io"}],"security":[{"Access-Token":[],"X-Api-Key":[]}],"components":{"securitySchemes":{"Access-Token":{"type":"apiKey","in":"header","name":"Access-Token","description":"JWT provided directly in the Access-Token header.\n"}}},"paths":{"/customer-compliance-rules/{customer_rule_id}":{"patch":{"summary":"Update customer compliance rule","description":"Updates the status and/or parameter values of an existing customer compliance rule. At least one of `status` or `param_values` must be provided. The authenticated company must have vetting access permissions.\n","tags":["Compliance Rules"],"parameters":[{"name":"customer_rule_id","in":"path","required":true,"description":"Unique identifier of the customer compliance rule.","schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","description":"Updated vetting status of the rule.","enum":["enabled","disabled"]},"param_values":{"type":"object","description":"Dynamic parameter values used during carrier evaluation. For the Observed by GenLogs rule, `date_interval` must be a supported interval, `decision_matrix` may only contain `false` and `true` keys, `false` must be `review` or `fail`, and `true` must be `pass`. `fail_message` and `pass_message` must be booleans.\n","additionalProperties":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"object"}]}}},"anyOf":[{"required":["status"]},{"required":["param_values"]}]}}}},"responses":{"200":{"description":"Customer compliance rule updated successfully.","content":{"application/json":{"schema":{"type":"object","properties":{"status_code":{"type":"string"},"message":{"type":"string"}}}}}},"400":{"description":"Bad Request – Invalid input, missing required fields, or invalid external rule param_values.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"}}}}}},"401":{"description":"Unauthorized – Invalid or missing Access-Token.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"object"}}}}}},"403":{"description":"Forbidden – Company user does not have vetting access permission.","content":{"application/json":{"schema":{"type":"object","properties":{"detail":{"type":"string"}}}}}},"404":{"description":"Not Found – Customer compliance rule does not exist.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"}}}}}},"500":{"description":"Internal Server Error.","content":{"application/json":{"schema":{"type":"string"}}}}}}}}}
```
