# Update rule by ID

Updates a specific recommendation rule

Endpoint: PUT /rules/{rule_id}
Security: risk_access_token

## Path parameters:

  - `rule_id` (string, required)
    ID of the recommendation rule

## Request fields (application/json):

  - `name` (string)
    Name of the recommendation rule. Must be unique across the tenant. Autogenerated if not provided.
    Example: "Block risky countries"

  - `priority` (integer, required)
    Priority of the recommendation rule, which determines the order in which rules are evaluated. Rules are evaluated from smallest to biggest priority value and only the first rule to match will apply. Priority value must be unique.
    Example: 10

  - `recommendation` (string, required)
    Recommendation type
    Enum: "challenge", "deny", "trust", "allow"

  - `enabled` (boolean)
    Whether or not the rule will be evaluated.

  - `mode` (string, required)
    Allows you to simulate a rule and evaluate its impact before releasing it to production. The simulation occurs each time a recommendation is requested. If a preview rule matches the request (meaning, its priority is higher than all matching rules), the response will include this preview rule and what the recommendation would have been if all rules were in production.
    Enum: "preview", "production"

  - `type` (string, required)
    Default type, must be "risk"
    Enum: "risk"

  - `description` (string)
    Description for the rule

  - `matchers` (array, required)
    Contains a set of activity matchers that define the rule matching logic

  - `matchers.ip_cidrs` (object)
    Matches based on IP address

  - `matchers.ip_cidrs.op` (string, required)
    Matcher operation
    Enum: "ip_in", "ip_not_in"

  - `matchers.ip_cidrs.value` (array, required)
    List of IP ranges in CIDR notation

  - `matchers.device_ids` (object)
    Matches based on the device ID

  - `matchers.device_ids.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.device_ids.value` (array, required)
    List of device identifiers generated by Transmit Security and stored by the SDK

  - `matchers.device_fingerprints` (object)
    Matches based on device fingerprint

  - `matchers.device_fingerprints.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.device_fingerprints.value` (array, required)
    List of device fingerprints calculated based on multiple device persistent identifiers

  - `matchers.device_public_keys` (object)
    Matches based on device key ID

  - `matchers.device_public_keys.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.device_public_keys.value` (array, required)
    List of unique and persistent device key IDs derived from cryptographic binding

  - `matchers.user_ids` (object)
    Matches based on user identifier

  - `matchers.user_ids.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.user_ids.value` (array, required)
    List of opaque identifiers of users in your system

  - `matchers.country_codes` (object)
    Matches based on the country in which the device is located

  - `matchers.country_codes.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.country_codes.value` (array, required)
    List of country codes per ISO 3166-1 alpha-2 standard

  - `matchers.browser_names` (object)
    Matches based on browser name

  - `matchers.browser_names.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.browser_names.value` (array, required)
    List of browser names as presented by Transmit Security systems. e.g. yandex, electron

  - `matchers.os_versions` (object)
    Matches based on the device OS version

  - `matchers.os_versions.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.os_versions.value` (array, required)
    List of OS versions as presented by Transmit Security systems. e.g. 14.4.2, x86_64

  - `matchers.action_type` (object)
    Matches based on the client action for which the recommendation is requested

  - `matchers.action_type.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.action_type.value` (array, required)
    List of client actions (such as login or register). [Learn more](guides/risk/recommendations/#action-types)

  - `matchers.client_id` (object)
    Matches based on client ID

  - `matchers.client_id.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.client_id.value` (array, required)
    List of client IDs

  - `matchers.application_id` (object)
    Matches based on app ID

  - `matchers.application_id.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.application_id.value` (array, required)
    List of application IDs, used to identify Transmit applications

  - `matchers.asn_id` (object)
    Matches based on the ASN detected using the IP address

  - `matchers.asn_id.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.asn_id.value` (array, required)
    List of AS numbers detected by Transmit using IP address (e.g., AS13339)

  - `matchers.organization_name` (object)
    Matches based on the organization name associated with the IP address

  - `matchers.organization_name.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.organization_name.value` (array, required)
    List of organization names

  - `matchers.organization_type` (object)
    Matches based on the organization type associated with the IP address

  - `matchers.organization_type.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.organization_type.value` (array, required)
    List of organization types

  - `matchers.ip_timezone` (object)
    Matches based on the timezone detected by Transmit using IP address

  - `matchers.ip_timezone.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.ip_timezone.value` (array, required)
    List of TZ identifiers (e.g., America/New_York, Asia/Tokyo, UTC)

  - `matchers.device_timezone` (object)
    Matches based on the timezone detected by Transmit using device telemetry

  - `matchers.device_timezone.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.device_timezone.value` (array, required)
    List of TZ identifiers (e.g., America/New_York , Asia/Tokyo, UTC)

  - `matchers.device_platform` (object)
    Matches based on device type, as classified by Transmit (e.g., desktop, mobile, wearable)

  - `matchers.device_platform.op` (string, required)
    Matcher operation
    Enum: "in", "not_in"

  - `matchers.device_platform.value` (array, required)
    List of device types, as classified by Transmit (e.g., desktop , mobile, wearable)

  - `matchers.user_agent` (object)
    Matches based on user agent

  - `matchers.user_agent.op` (string, required)
    Matcher operation
    Enum: "contains", "not_contains"

  - `matchers.user_agent.value` (array, required)
    List of user agents

  - `matchers.location` (object)
    Matches based on the place in the application in which the action was performed (such as page URL)

  - `matchers.location.op` (string, required)
    Matcher operation
    Enum: "contains", "not_contains"

  - `matchers.location.value` (array, required)
    List of locations (e.g., page URLs)

## Response 200 fields (application/json):

  - `message` (string)

  - `data` (object)
    Recommendation rule

  - `data.id` (string)
    ID of the recommendation rule, used to reference the rule

  - `data.name` (string)
    Name of the recommendation rule. Must be unique across the tenant. Autogenerated if not provided.
    Example: "Block risky countries"

  - `data.priority` (integer, required)
    Priority of the recommendation rule, which determines the order in which rules are evaluated. Rules are evaluated from smallest to biggest priority value and only the first rule to match will apply. Priority value must be unique.
    Example: 10

  - `data.recommendation` (string, required)
    Recommendation type
    Enum: "challenge", "deny", "trust", "allow"

  - `data.enabled` (boolean)
    Whether or not the rule will be evaluated.

  - `data.mode` (string, required)
    Allows you to simulate a rule and evaluate its impact before releasing it to production. The simulation occurs each time a recommendation is requested. If a preview rule matches the request (meaning, its priority is higher than all matching rules), the response will include this preview rule and what the recommendation would have been if all rules were in production.
    Enum: "preview", "production"

  - `data.type` (string, required)
    Default type, must be "risk"
    Enum: "risk"

  - `data.description` (string)
    Description for the rule

  - `data.matchers` (array, required)
    Contains a set of activity matchers that define the rule matching logic

  - `data.created_date` (string)
    Date the rule was created

  - `data.updated_date` (string)
    Date the rule was last updated


## Response 400 fields

## Response 401 fields

## Response 403 fields

## Response 404 fields

## Response 429 fields

## Response 500 fields
