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

# rules

> sift/rules/v1/rules.proto

<a name="sift_rules_v1_rules-proto" />

<a name="sift_rules_v1_rules-proto-services" />

## Services

*RPC methods exposed by this API.*

### RuleService

| Method                   | Request                                                             | Response                                                              | Description                                                                                                                                                                              |
| :----------------------- | :------------------------------------------------------------------ | :-------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| SearchRules              | [SearchRulesRequest](#searchrulesrequest)                           | [SearchRulesResponse](#searchrulesresponse)                           | Queries rules based on provided search parameters.                                                                                                                                       |
| GetRule                  | [GetRuleRequest](#getrulerequest)                                   | [GetRuleResponse](#getruleresponse)                                   | Retrieves the latest version of a rule.                                                                                                                                                  |
| BatchGetRules            | [BatchGetRulesRequest](#batchgetrulesrequest)                       | [BatchGetRulesResponse](#batchgetrulesresponse)                       | Retrieve multiple rules.                                                                                                                                                                 |
| CreateRule               | [CreateRuleRequest](#createrulerequest)                             | [CreateRuleResponse](#createruleresponse)                             | Creates a rule.                                                                                                                                                                          |
| UpdateRule               | [UpdateRuleRequest](#updaterulerequest)                             | [UpdateRuleResponse](#updateruleresponse)                             | Updates an existing rule.                                                                                                                                                                |
| BatchUpdateRules         | [BatchUpdateRulesRequest](#batchupdaterulesrequest)                 | [BatchUpdateRulesResponse](#batchupdaterulesresponse)                 | Updates existing rules or creates rules that do not exist.                                                                                                                               |
| DeleteRule               | [DeleteRuleRequest](#deleterulerequest)                             | [DeleteRuleResponse](#deleteruleresponse)                             | Deprecated - use ArchiveRule instead. Archives a rule.                                                                                                                                   |
| ArchiveRule              | [ArchiveRuleRequest](#archiverulerequest)                           | [ArchiveRuleResponse](#archiveruleresponse)                           | Archives a rule.                                                                                                                                                                         |
| BatchDeleteRules         | [BatchDeleteRulesRequest](#batchdeleterulesrequest)                 | [BatchDeleteRulesResponse](#batchdeleterulesresponse)                 | Deprecated - use BatchArchiveRules instead. Archives multiple rules.                                                                                                                     |
| BatchArchiveRules        | [BatchArchiveRulesRequest](#batcharchiverulesrequest)               | [BatchArchiveRulesResponse](#batcharchiverulesresponse)               | Batch archives rules.                                                                                                                                                                    |
| UnarchiveRule            | [UnarchiveRuleRequest](#unarchiverulerequest)                       | [UnarchiveRuleResponse](#unarchiveruleresponse)                       | Unarchives a rule.                                                                                                                                                                       |
| BatchUnarchiveRules      | [BatchUnarchiveRulesRequest](#batchunarchiverulesrequest)           | [BatchUnarchiveRulesResponse](#batchunarchiverulesresponse)           | Batch unarchives rules.                                                                                                                                                                  |
| UndeleteRule             | [UndeleteRuleRequest](#undeleterulerequest)                         | [UndeleteRuleResponse](#undeleteruleresponse)                         | Deprecated - use UnarchiveRule instead. Unarchives a rule                                                                                                                                |
| BatchUndeleteRules       | [BatchUndeleteRulesRequest](#batchundeleterulesrequest)             | [BatchUndeleteRulesResponse](#batchundeleterulesresponse)             | Deprecated - use BatchUnarchiveRules instead. Unarchives multiple rules                                                                                                                  |
| EvaluateRules            | [EvaluateRulesRequest](#evaluaterulesrequest)                       | [EvaluateRulesResponse](#evaluaterulesresponse)                       | Deprecated - use RuleEvaluationService instead.                                                                                                                                          |
| ViewHumanFriendlyRules   | [ViewHumanFriendlyRulesRequest](#viewhumanfriendlyrulesrequest)     | [ViewHumanFriendlyRulesResponse](#viewhumanfriendlyrulesresponse)     | Deprecated - use ViewJsonRules instead. Retrieve a JSON object containing all of the rules for a given asset.                                                                            |
| ViewJsonRules            | [ViewJsonRulesRequest](#viewjsonrulesrequest)                       | [ViewJsonRulesResponse](#viewjsonrulesresponse)                       | Deprecated - use BatchGetRules instead. Retrieve a JSON object containing all of the rules for a given asset.                                                                            |
| UpdateHumanFriendlyRules | [UpdateHumanFriendlyRulesRequest](#updatehumanfriendlyrulesrequest) | [UpdateHumanFriendlyRulesResponse](#updatehumanfriendlyrulesresponse) | Deprecated - use BatchUpdateRules instead. Batch update rules given the `rules_json` which is a JSON list of rules.                                                                      |
| ValidateJsonRules        | [ValidateJsonRulesRequest](#validatejsonrulesrequest)               | [ValidateJsonRulesResponse](#validatejsonrulesresponse)               | Deprecated - use BatchUpdateRules with validate\_only flag instead. Validate a batch update for rules given the `rules_json` which is a JSON list of rules. This is a dry-run operation. |
| UpdateJsonRules          | [UpdateJsonRulesRequest](#updatejsonrulesrequest)                   | [UpdateJsonRulesResponse](#updatejsonrulesresponse)                   | Deprecated - use BatchUpdateRules instead. Batch update rules given the `rules_json` which is a JSON list of rules.                                                                      |
| ListRules                | [ListRulesRequest](#listrulesrequest)                               | [ListRulesResponse](#listrulesresponse)                               |                                                                                                                                                                                          |
| ListRuleVersions         | [ListRuleVersionsRequest](#listruleversionsrequest)                 | [ListRuleVersionsResponse](#listruleversionsresponse)                 | Retrieves a list of rule versions for the given rule.                                                                                                                                    |
| GetRuleVersion           | [GetRuleVersionRequest](#getruleversionrequest)                     | [GetRuleVersionResponse](#getruleversionresponse)                     | Retrieves a specific version of a rule.                                                                                                                                                  |
| BatchGetRuleVersions     | [BatchGetRuleVersionsRequest](#batchgetruleversionsrequest)         | [BatchGetRuleVersionsResponse](#batchgetruleversionsresponse)         | Retrieves multiple rules by rule versions.                                                                                                                                               |

<a name="sift_rules_v1_rules-proto-messages" />

## Messages

*Data models used across requests/responses.*

### AnnotationActionConfiguration

| Field                  | Type                                                                      | Label    | Description |
| :--------------------- | :------------------------------------------------------------------------ | :------- | :---------- |
| tag\_ids               | string                                                                    | repeated |             |
| annotation\_type       | [sift.annotations.v1.AnnotationType](#sift-annotations-v1-annotationtype) |          |             |
| assigned\_to\_user\_id | string                                                                    | optional |             |
| metadata               | [sift.metadata.v1.MetadataValue](#sift-metadata-v1-metadatavalue)         | repeated |             |

### ArchiveRuleRequest

ArchiveRuleRequest is used to archive a rule by rule\_id or client\_key. If both are provided, only rule\_id will be used.

| Field       | Type   | Label | Description |
| :---------- | :----- | :---- | :---------- |
| rule\_id    | string |       |             |
| client\_key | string |       |             |

### ArchiveRuleResponse

*This message has no fields.*

### AssetExpressionValidationResult

| Field          | Type   | Label    | Description                                                                     |
| :------------- | :----- | :------- | :------------------------------------------------------------------------------ |
| asset\_id      | string |          |                                                                                 |
| asset\_name    | string |          |                                                                                 |
| asset\_tag\_id | string |          | asset\_tag\_id is the tag\_id that caused this asset to be included in the rule |
| error          | string | optional |                                                                                 |

### BatchArchiveRulesRequest

BatchArchiveRulesRequest is used to archive a rule by rule\_id or client\_key. For each rule if both are provided, only rule\_id will be used.

| Field        | Type   | Label    | Description |
| :----------- | :----- | :------- | :---------- |
| rule\_ids    | string | repeated |             |
| client\_keys | string | repeated |             |

### BatchArchiveRulesResponse

*This message has no fields.*

### BatchDeleteRulesRequest

BatchDeleteRulesRequest is used to delete a rule by rule\_id or client\_key. For each rule if both are provided, only rule\_id will be used.

| Field        | Type   | Label    | Description |
| :----------- | :----- | :------- | :---------- |
| rule\_ids    | string | repeated |             |
| client\_keys | string | repeated |             |

### BatchDeleteRulesResponse

*This message has no fields.*

### BatchGetRuleVersionsRequest

| Field              | Type   | Label    | Description |
| :----------------- | :----- | :------- | :---------- |
| rule\_version\_ids | string | repeated |             |

### BatchGetRuleVersionsResponse

| Field | Type          | Label    | Description |
| :---- | :------------ | :------- | :---------- |
| rules | [Rule](#rule) | repeated |             |

### BatchGetRulesRequest

BatchGetRulesRequest is used to retrieve rules by rule\_ids or client\_keys. If both are provided, both will be used to retrieve rules.

| Field        | Type   | Label    | Description |
| :----------- | :----- | :------- | :---------- |
| rule\_ids    | string | repeated |             |
| client\_keys | string | repeated |             |

### BatchGetRulesResponse

| Field | Type          | Label    | Description |
| :---- | :------------ | :------- | :---------- |
| rules | [Rule](#rule) | repeated |             |

### BatchUnarchiveRulesRequest

BatchUnarchiveRulesRequest is used to unarchive a rule by rule\_id or client\_key. For each rule if both are provided, only rule\_id will be used.

| Field        | Type   | Label    | Description |
| :----------- | :----- | :------- | :---------- |
| rule\_ids    | string | repeated |             |
| client\_keys | string | repeated |             |

### BatchUnarchiveRulesResponse

*This message has no fields.*

### BatchUndeleteRulesRequest

BatchUndeleteRulesRequest is used to delete a rule by rule\_id or client\_key. For each rule if both are provided, only rule\_id will be used.

| Field        | Type   | Label    | Description |
| :----------- | :----- | :------- | :---------- |
| rule\_ids    | string | repeated |             |
| client\_keys | string | repeated |             |

### BatchUndeleteRulesResponse

*This message has no fields.*

### BatchUpdateRulesRequest

| Field                            | Type                                    | Label    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| :------------------------------- | :-------------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| rules                            | [UpdateRuleRequest](#updaterulerequest) | repeated | rules are limited 1000 rules at a time                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| validate\_only                   | bool                                    |          | If validate\_only is true, the request will only validate the request and not save the rules.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| override\_expression\_validation | bool                                    |          | **Deprecated.** Discouraged escape hatch for saving rules whose expression cannot be fully validated server-side. When `true`: - Per-asset expression validation errors (e.g. channel not present on the in-scope asset) are returned in `validation_results` for visibility but do not block the save. - If the rule's UDF/calculated-channel inlining cannot resolve types (typically because the referenced channels haven't been ingested yet, or there are too many distinct identifiers for the type-inference budget) the rule is still persisted, but its `is_live_evaluation_enabled` is forced to `false`. Live alerts will skip it; report generation and on-demand `EvaluateRules` calls still work because they re-resolve types at run time. To bring such a rule back online, fix the underlying problem (ingest the channels, simplify the expression, etc.) and reissue an update with `is_live_evaluation_enabled = true`. |

Marked `deprecated = true` because new integrations should validate input *before* submitting; existing SDK call sites that rely on this flag continue to work. |

### BatchUpdateRulesResponse

| Field                      | Type                                                                                  | Label    | Description                                                                                                                             |
| :------------------------- | :------------------------------------------------------------------------------------ | :------- | :-------------------------------------------------------------------------------------------------------------------------------------- |
| success                    | bool                                                                                  |          |                                                                                                                                         |
| rules\_created\_count      | int32                                                                                 |          | The total number of rules created in the request. If validate\_only is true, this will indicate how many rules would have been created. |
| rules\_updated\_count      | int32                                                                                 |          | The total number of rules updated in the request. If validate\_only is true, this will indicate how many rules would have been updated. |
| validate\_only             | bool                                                                                  |          | This will be true if the request only validated the request and did not save the rules.                                                 |
| validation\_results        | [ValidationResult](#validationresult)                                                 | repeated | One ValidationResult per rule in the request will be returned                                                                           |
| created\_rule\_identifiers | [BatchUpdateRulesResponse.RuleIdentifiers](#batchupdaterulesresponse-ruleidentifiers) | repeated | The created rule id, name, version, and client key.                                                                                     |

### BatchUpdateRulesResponse.RuleIdentifiers

| Field       | Type   | Label    | Description |
| :---------- | :----- | :------- | :---------- |
| rule\_id    | string |          |             |
| name        | string |          |             |
| client\_key | string | optional |             |

### CalculatedChannelConfig

| Field                             | Type                                                                                                | Label    | Description                                                                                                                          |
| :-------------------------------- | :-------------------------------------------------------------------------------------------------- | :------- | :----------------------------------------------------------------------------------------------------------------------------------- |
| channel\_references               | [CalculatedChannelConfig.ChannelReferencesEntry](#calculatedchannelconfig-channelreferencesentry)   | repeated |                                                                                                                                      |
| expression                        | string                                                                                              |          |                                                                                                                                      |
| function\_dependencies            | [sift.common.type.v1.FunctionDependency](#sift-common-type-v1-functiondependency)                   | repeated | This will be ignored in requests and will be generated automatically.                                                                |
| calculated\_channel\_dependencies | [sift.common.type.v1.CalculatedChannelDependency](#sift-common-type-v1-calculatedchanneldependency) | repeated | This will be ignored in requests and will be generated automatically. Tracks which calculated channel versions this rule depends on. |

### CalculatedChannelConfig.ChannelReferencesEntry

| Field | Type                                  | Label | Description |
| :---- | :------------------------------------ | :---- | :---------- |
| key   | string                                |       |             |
| value | [ChannelReference](#channelreference) |       |             |

### ChannelReference

| Field                            | Type   | Label    | Description                                                                                                                                                                          |
| :------------------------------- | :----- | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name                             | string |          | Required for native channel references. Must not be set when calculated\_channel\_version\_id is provided.                                                                           |
| component                        | string |          | Deprecated - use name instead. If provided, name will be joined with the component as `component.name`. Must not be set when calculated\_channel\_version\_id is provided.           |
| calculated\_channel\_version\_id | string | optional | Reference to a calculated channel version. When set, the rule will use the calculated channel instead of looking up a native channel by name. Must not be set when name is provided. |

### ContextualChannels

| Field    | Type                                  | Label    | Description |
| :------- | :------------------------------------ | :------- | :---------- |
| channels | [ChannelReference](#channelreference) | repeated |             |

### CreateRuleRequest

| Field  | Type                                    | Label | Description |
| :----- | :-------------------------------------- | :---- | :---------- |
| update | [UpdateRuleRequest](#updaterulerequest) |       |             |

### CreateRuleResponse

| Field    | Type   | Label | Description |
| :------- | :----- | :---- | :---------- |
| rule\_id | string |       |             |

### DeleteRuleRequest

DeleteRuleRequest is used to delete a rule by rule\_id or client\_key. If both are provided, only rule\_id will be used.

| Field       | Type   | Label | Description |
| :---------- | :----- | :---- | :---------- |
| rule\_id    | string |       |             |
| client\_key | string |       |             |

### DeleteRuleResponse

*This message has no fields.*

### DryRunAnnotation

| Field                  | Type                      | Label | Description |
| :--------------------- | :------------------------ | :---- | :---------- |
| condition\_id          | string                    |       |             |
| name                   | string                    |       |             |
| start\_time            | google.protobuf.Timestamp |       |             |
| end\_time              | google.protobuf.Timestamp |       |             |
| condition\_version\_id | string                    |       |             |

### EvaluateRulesRequest

Deprecated - use RuleEvaluationService instead.

| Field                   | Type                                                      | Label    | Description |
| :---------------------- | :-------------------------------------------------------- | :------- | :---------- |
| rule\_ids               | string                                                    | repeated |             |
| annotation\_options     | [EvaluatedAnnotationOptions](#evaluatedannotationoptions) |          |             |
| oneof time. run\_id     | string                                                    |          |             |
| oneof time. time\_range | [TimeRangeQuery](#timerangequery)                         |          |             |
| dry\_run                | bool                                                      |          |             |

### EvaluateRulesResponse

Deprecated - use RuleEvaluationService instead.

| Field                      | Type                                  | Label    | Description                                                                                                   |
| :------------------------- | :------------------------------------ | :------- | :------------------------------------------------------------------------------------------------------------ |
| created\_annotation\_count | int32                                 |          |                                                                                                               |
| dry\_run\_annotations      | [DryRunAnnotation](#dryrunannotation) | repeated | If dry\_run is true, this will be populated with the annotations that would be created                        |
| job\_id                    | string                                | optional | job\_id and report\_id will be set if the job has an extended run time and is being processed asynchronously. |
| report\_id                 | string                                | optional |                                                                                                               |

### EvaluatedAnnotationOptions

| Field    | Type   | Label    | Description |
| :------- | :----- | :------- | :---------- |
| tag\_ids | string | repeated |             |

### GetRuleRequest

GetRuleRequest is used to retrieve a rule by rule\_id or client\_key. If both are provided, only rule\_id will be used.

| Field       | Type   | Label | Description |
| :---------- | :----- | :---- | :---------- |
| rule\_id    | string |       |             |
| client\_key | string |       |             |

### GetRuleResponse

| Field | Type          | Label | Description |
| :---- | :------------ | :---- | :---------- |
| rule  | [Rule](#rule) |       |             |

### GetRuleVersionRequest

| Field             | Type   | Label | Description |
| :---------------- | :----- | :---- | :---------- |
| rule\_version\_id | string |       |             |

### GetRuleVersionResponse

| Field | Type          | Label | Description |
| :---- | :------------ | :---- | :---------- |
| rule  | [Rule](#rule) |       |             |

### JsonRulesRequest

| Field            | Type   | Label | Description |
| :--------------- | :----- | :---- | :---------- |
| asset\_id        | string |       |             |
| rules\_json      | string |       |             |
| organization\_id | string |       |             |

### JsonRulesResponse

| Field                 | Type   | Label    | Description |
| :-------------------- | :----- | :------- | :---------- |
| success               | bool   |          |             |
| total\_rules\_count   | int32  |          |             |
| rules\_created\_count | int32  |          |             |
| rules\_updated\_count | int32  |          |             |
| rules\_deleted\_count | int32  |          |             |
| error\_messages       | string | optional |             |

### LastValueThreshold

*This message has no fields.*

### ListRuleVersionsRequest

| Field       | Type   | Label | Description                                                                                                                                                                                                                                                                                                                                                 |
| :---------- | :----- | :---- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| rule\_id    | string |       |                                                                                                                                                                                                                                                                                                                                                             |
| page\_size  | uint32 |       | The maximum number of Rule Versions to return. The service may return fewer than this value. If unspecified, at most 50 Rule Versions will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.                                                                                                                               |
| page\_token | string |       | A page token, received from a previous `ListRuleVersions` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListRuleVersions` must match the call that provided the page token.                                                                                                                        |
| filter      | string |       | A [Common Expression Language (CEL)](https://github.com/google/cel-spec) filter string. Available fields to filter by are `rule_version_id`, `user_notes`, and `change_message`. For further information about how to use CELs, please refer to [this guide](https://github.com/google/cel-spec/blob/master/doc/langdef.md#standard-definitions). Optional. |

### ListRuleVersionsResponse

| Field             | Type                        | Label    | Description |
| :---------------- | :-------------------------- | :------- | :---------- |
| rule\_versions    | [RuleVersion](#ruleversion) | repeated |             |
| next\_page\_token | string                      |          |             |

### ListRulesRequest

| Field       | Type   | Label | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| :---------- | :----- | :---- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| page\_size  | uint32 |       | The maximum number of Rules to return. The service may return fewer than this value. If unspecified, at most 50 Rules will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| page\_token | string |       | A page token, received from a previous `ListRules` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListRules` must match the call that provided the page token.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| filter      | string |       | A [Common Expression Language (CEL)](https://github.com/google/cel-spec) filter string. Available fields to filter by are `rule_id`, `client_key`, `name`, `description`, `is_external`, `asset_id`, `tag_id`, `created_date`, `created_by_user_id`, `metadata`, `modified_date`, `modified_by_user_id`, `deleted_date`, `is_archived`, `archived_date`, and `is_live_evaluation_enabled`. Metadata can be used in filters by using `metadata.{metadata_key_name}` as the field name. Folder membership is filterable via the `folders` and `activeFolders` fields. Both contain the ids of the folders the rule belongs to; `activeFolders` excludes archived folders. Use `"<folder_id>" in folders` to return rules in the given folder, and `size(activeFolders) == 0` to return uncategorized rules (rules whose only memberships are in archived folders count as uncategorized). For further information about how to use CELs, please refer to [this guide](https://github.com/google/cel-spec/blob/master/doc/langdef.md#standard-definitions). Optional. |
| order\_by   | string |       | How to order the retrieved Rules. Formatted as a comma-separated string i.e. "FIELD\_NAME\[ desc],...". Available fields to order\_by are `created_date` and `modified_date`. If left empty, items are ordered by `created_date` in descending order (newest-first).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |

### ListRulesResponse

| Field             | Type          | Label    | Description |
| :---------------- | :------------ | :------- | :---------- |
| rules             | [Rule](#rule) | repeated |             |
| next\_page\_token | string        |          |             |

### NotificationActionConfiguration

| Field                | Type   | Label    | Description |
| :------------------- | :----- | :------- | :---------- |
| recipient\_user\_ids | string | repeated |             |

### Rule

| Field                         | Type                                                              | Label    | Description                                                                                                                                        |
| :---------------------------- | :---------------------------------------------------------------- | :------- | :------------------------------------------------------------------------------------------------------------------------------------------------- |
| rule\_id                      | string                                                            |          |                                                                                                                                                    |
| asset\_id                     | string                                                            |          | **Deprecated.**                                                                                                                                    |
| name                          | string                                                            |          |                                                                                                                                                    |
| description                   | string                                                            |          |                                                                                                                                                    |
| is\_enabled                   | bool                                                              |          |                                                                                                                                                    |
| created\_date                 | google.protobuf.Timestamp                                         |          |                                                                                                                                                    |
| modified\_date                | google.protobuf.Timestamp                                         |          |                                                                                                                                                    |
| created\_by\_user\_id         | string                                                            |          |                                                                                                                                                    |
| modified\_by\_user\_id        | string                                                            |          |                                                                                                                                                    |
| organization\_id              | string                                                            |          |                                                                                                                                                    |
| conditions                    | [RuleCondition](#rulecondition)                                   | repeated |                                                                                                                                                    |
| rule\_version                 | [RuleVersion](#ruleversion)                                       |          |                                                                                                                                                    |
| client\_key                   | string                                                            |          | client\_key is a client provided identifier for the rule. It is immutable after rule creation.                                                     |
| asset\_configuration          | [RuleAssetConfiguration](#ruleassetconfiguration)                 |          |                                                                                                                                                    |
| contextual\_channels          | [ContextualChannels](#contextualchannels)                         |          |                                                                                                                                                    |
| deleted\_date                 | google.protobuf.Timestamp                                         |          | **Deprecated.**                                                                                                                                    |
| is\_external                  | bool                                                              |          |                                                                                                                                                    |
| metadata                      | [sift.metadata.v1.MetadataValue](#sift-metadata-v1-metadatavalue) | repeated |                                                                                                                                                    |
| archived\_date                | google.protobuf.Timestamp                                         |          | archived\_date indicates when the rule was archived                                                                                                |
| is\_archived                  | bool                                                              |          | is\_archived is inferred from when archived\_date is not null                                                                                      |
| is\_live\_evaluation\_enabled | bool                                                              |          | If `true`, this rule will be evaluated on live data; if `false`, live rule evaluation is disabled (the rule remains usable for report generation). |

Note: this value is the server's effective state, not necessarily what was requested. A rule saved via `BatchUpdateRulesRequest.override_expression_validation = true` whose UDF inlining fails (e.g. type resolution exhausted; see error returned by `BatchUpdateRules`) is forced to `is_live_evaluation_enabled = false` even when the caller requested `true`. To recover after the underlying issue is fixed (channels populated, expression simplified, etc.), reissue an `UpdateRule` / `BatchUpdateRules` request that explicitly sets `is_live_evaluation_enabled = true`. |
\| current\_version\_id | string |  | The current version of the rule. This is may be different from the rule\_version.version if the rule has been updated since the rule\_version was created. |
\| folder\_ids | string | repeated | Ids of the folders this rule belongs to. |

### RuleAction

| Field                     | Type                                                | Label | Description |
| :------------------------ | :-------------------------------------------------- | :---- | :---------- |
| rule\_action\_id          | string                                              |       |             |
| rule\_condition\_id       | string                                              |       |             |
| action\_type              | [ActionKind](#actionkind)                           |       |             |
| configuration             | [RuleActionConfiguration](#ruleactionconfiguration) |       |             |
| created\_date             | google.protobuf.Timestamp                           |       |             |
| modified\_date            | google.protobuf.Timestamp                           |       |             |
| created\_by\_user\_id     | string                                              |       |             |
| modified\_by\_user\_id    | string                                              |       |             |
| rule\_action\_version\_id | string                                              |       |             |

### RuleActionConfiguration

| Field                             | Type                                                                | Label | Description |
| :-------------------------------- | :------------------------------------------------------------------ | :---- | :---------- |
| oneof configuration. notification | [NotificationActionConfiguration](#notificationactionconfiguration) |       |             |
| oneof configuration. annotation   | [AnnotationActionConfiguration](#annotationactionconfiguration)     |       |             |
| oneof configuration. webhook      | [WebhookActionConfiguration](#webhookactionconfiguration)           |       |             |

### RuleAssetConfiguration

| Field      | Type   | Label    | Description |
| :--------- | :----- | :------- | :---------- |
| asset\_ids | string | repeated |             |
| tag\_ids   | string | repeated |             |

### RuleCondition

| Field                        | Type                                                | Label    | Description |
| :--------------------------- | :-------------------------------------------------- | :------- | :---------- |
| rule\_condition\_id          | string                                              |          |             |
| rule\_id                     | string                                              |          |             |
| expression                   | [RuleConditionExpression](#ruleconditionexpression) |          |             |
| created\_date                | google.protobuf.Timestamp                           |          |             |
| modified\_date               | google.protobuf.Timestamp                           |          |             |
| created\_by\_user\_id        | string                                              |          |             |
| modified\_by\_user\_id       | string                                              |          |             |
| actions                      | [RuleAction](#ruleaction)                           | repeated |             |
| rule\_condition\_version\_id | string                                              |          |             |

### RuleConditionExpression

| Field                                         | Type                                                                    | Label | Description     |
| :-------------------------------------------- | :---------------------------------------------------------------------- | :---- | :-------------- |
| oneof expression. single\_channel\_comparison | [SingleChannelComparisonExpression](#singlechannelcomparisonexpression) |       | **Deprecated.** |
| oneof expression. calculated\_channel         | [CalculatedChannelConfig](#calculatedchannelconfig)                     |       |                 |

### RuleVersion

| Field                      | Type                      | Label | Description                                                   |
| :------------------------- | :------------------------ | :---- | :------------------------------------------------------------ |
| rule\_id                   | string                    |       |                                                               |
| rule\_version\_id          | string                    |       |                                                               |
| version                    | string                    |       |                                                               |
| created\_date              | google.protobuf.Timestamp |       |                                                               |
| created\_by\_user\_id      | string                    |       |                                                               |
| version\_notes             | string                    |       |                                                               |
| generated\_change\_message | string                    |       |                                                               |
| deleted\_date              | google.protobuf.Timestamp |       | **Deprecated.**                                               |
| archived\_date             | google.protobuf.Timestamp |       | archived\_date indicates when the rule version was archived   |
| is\_archived               | bool                      |       | is\_archived is inferred from when archived\_date is not null |

### SearchRulesRequest

| Field            | Type                                                                      | Label    | Description                                                       |
| :--------------- | :------------------------------------------------------------------------ | :------- | :---------------------------------------------------------------- |
| limit            | uint32                                                                    | optional | Max number of rules to return (returns all if omitted).           |
| offset           | uint32                                                                    |          | Only applies if limit provided.                                   |
| order            | [SearchOrder](#searchorder)                                               | optional | Order to sort results by (defaults to ascending).                 |
| name\_matches    | string                                                                    |          |                                                                   |
| case\_sensitive  | bool                                                                      |          |                                                                   |
| regexp           | bool                                                                      |          |                                                                   |
| order\_by        | string                                                                    | optional |                                                                   |
| rule\_ids        | string                                                                    | repeated | If provided, only returns rules with the given ids                |
| asset\_ids       | string                                                                    | repeated | If provided, only returns rules that apply to the given asset ids |
| include\_deleted | bool                                                                      |          |                                                                   |
| asset\_tags      | [sift.common.type.v1.NamedResources](#sift-common-type-v1-namedresources) |          | If provided, returns rules with assets that have the given tags   |

### SearchRulesResponse

| Field | Type          | Label    | Description                                                                                     |
| :---- | :------------ | :------- | :---------------------------------------------------------------------------------------------- |
| count | uint32        |          |                                                                                                 |
| rules | [Rule](#rule) | repeated | Conditions are not included in the search response. The latest version of the rule is returned. |

### SingleChannelComparisonExpression

Deprecated - use CalculatedChannelConfig.

| Field                        | Type                                        | Label | Description                                                                                                                              |
| :--------------------------- | :------------------------------------------ | :---- | :--------------------------------------------------------------------------------------------------------------------------------------- |
| channel\_component           | string                                      |       | Deprecated - use channel\_name instead. If provided, channel\_component will be joined with the name as `channel_component.channel_name` |
| channel\_name                | string                                      |       |                                                                                                                                          |
| comparator                   | [ConditionComparator](#conditioncomparator) |       |                                                                                                                                          |
| oneof threshold. double      | double                                      |       |                                                                                                                                          |
| oneof threshold. string      | string                                      |       |                                                                                                                                          |
| oneof threshold. last\_value | [LastValueThreshold](#lastvaluethreshold)   |       |                                                                                                                                          |

### TimeRangeQuery

| Field       | Type                      | Label | Description |
| :---------- | :------------------------ | :---- | :---------- |
| start\_time | google.protobuf.Timestamp |       |             |
| end\_time   | google.protobuf.Timestamp |       |             |

### UnarchiveRuleRequest

UnarchiveRuleRequest is used to unarchive a rule by rule\_id or client\_key. If both are provided, only rule\_id will be used.

| Field       | Type   | Label | Description |
| :---------- | :----- | :---- | :---------- |
| rule\_id    | string |       |             |
| client\_key | string |       |             |

### UnarchiveRuleResponse

*This message has no fields.*

### UndeleteRuleRequest

UndeleteRuleRequest is used to undelete a rule by rule\_id or client\_key. If both are provided, only rule\_id will be used.

| Field       | Type   | Label | Description |
| :---------- | :----- | :---- | :---------- |
| rule\_id    | string |       |             |
| client\_key | string |       |             |

### UndeleteRuleResponse

*This message has no fields.*

### UpdateActionRequest

| Field            | Type                                                | Label    | Description |
| :--------------- | :-------------------------------------------------- | :------- | :---------- |
| rule\_action\_id | string                                              | optional |             |
| action\_type     | [ActionKind](#actionkind)                           |          |             |
| configuration    | [RuleActionConfiguration](#ruleactionconfiguration) |          |             |

### UpdateConditionRequest

| Field               | Type                                                | Label    | Description |
| :------------------ | :-------------------------------------------------- | :------- | :---------- |
| rule\_condition\_id | string                                              | optional |             |
| expression          | [RuleConditionExpression](#ruleconditionexpression) |          |             |
| actions             | [UpdateActionRequest](#updateactionrequest)         | repeated |             |

### UpdateHumanFriendlyRulesRequest

Deprecated - use UpdateJsonRulesRequest.

| Field            | Type   | Label | Description |
| :--------------- | :----- | :---- | :---------- |
| asset\_id        | string |       |             |
| rules\_json      | string |       |             |
| organization\_id | string |       |             |

### UpdateHumanFriendlyRulesResponse

Deprecated - use UpdateJsonRulesResponse.

| Field        | Type   | Label | Description |
| :----------- | :----- | :---- | :---------- |
| success      | bool   |       |             |
| rules\_count | int32  |       |             |
| messages     | string |       |             |

### UpdateJsonRulesRequest

| Field   | Type                                  | Label | Description |
| :------ | :------------------------------------ | :---- | :---------- |
| request | [JsonRulesRequest](#jsonrulesrequest) |       |             |

### UpdateJsonRulesResponse

| Field    | Type                                    | Label | Description |
| :------- | :-------------------------------------- | :---- | :---------- |
| response | [JsonRulesResponse](#jsonrulesresponse) |       |             |

### UpdateRuleRequest

UpdateRuleRequest is used to create or update a rule. If the rule\_id or client\_key is provided, the rule will be updated. If not, a new rule will be created.

| Field                         | Type                                                              | Label    | Description                                                                                                                                                                                                                              |
| :---------------------------- | :---------------------------------------------------------------- | :------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| rule\_id                      | string                                                            | optional |                                                                                                                                                                                                                                          |
| name                          | string                                                            |          |                                                                                                                                                                                                                                          |
| description                   | string                                                            |          |                                                                                                                                                                                                                                          |
| asset\_id                     | string                                                            |          | **Deprecated.** Deprecated - use asset\_configuration instead.                                                                                                                                                                           |
| is\_enabled                   | bool                                                              |          | **Deprecated.** Deprecated - use DeleteRule instead.                                                                                                                                                                                     |
| conditions                    | [UpdateConditionRequest](#updateconditionrequest)                 | repeated |                                                                                                                                                                                                                                          |
| organization\_id              | string                                                            |          |                                                                                                                                                                                                                                          |
| version\_notes                | string                                                            |          |                                                                                                                                                                                                                                          |
| client\_key                   | string                                                            | optional | client\_key is a client provided identifier for the rule. It is immutable after being set                                                                                                                                                |
| asset\_configuration          | [RuleAssetConfiguration](#ruleassetconfiguration)                 |          |                                                                                                                                                                                                                                          |
| contextual\_channels          | [ContextualChannels](#contextualchannels)                         |          |                                                                                                                                                                                                                                          |
| is\_external                  | bool                                                              |          |                                                                                                                                                                                                                                          |
| metadata                      | [sift.metadata.v1.MetadataValue](#sift-metadata-v1-metadatavalue) | repeated |                                                                                                                                                                                                                                          |
| is\_archived                  | bool                                                              |          |                                                                                                                                                                                                                                          |
| is\_live\_evaluation\_enabled | bool                                                              | optional | If set to `true` then this rule will be evaluated on live data, otherwise live rule evaluation will be disabled. This rule can still be used, however, in report generation. If this value is null then the original value is preserved. |

This is a request, not a guarantee. When combined with `BatchUpdateRulesRequest.override_expression_validation = true`, a `true` value here can be silently overridden to `false` if UDF inlining fails (the rule is still persisted, just with live evaluation disabled). Re-send this request with the underlying issue resolved -- e.g. the referenced channels populated, or the expression simplified -- to flip it back on. |

### UpdateRuleResponse

| Field    | Type   | Label | Description |
| :------- | :----- | :---- | :---------- |
| rule\_id | string |       |             |

### ValidateJsonRulesRequest

| Field   | Type                                  | Label | Description |
| :------ | :------------------------------------ | :---- | :---------- |
| request | [JsonRulesRequest](#jsonrulesrequest) |       |             |

### ValidateJsonRulesResponse

| Field    | Type                                    | Label | Description |
| :------- | :-------------------------------------- | :---- | :---------- |
| response | [JsonRulesResponse](#jsonrulesresponse) |       |             |

### ValidationResult

| Field                                  | Type                                                                | Label    | Description                                                                                                                                                                             |
| :------------------------------------- | :------------------------------------------------------------------ | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| rule\_id                               | string                                                              |          |                                                                                                                                                                                         |
| client\_key                            | string                                                              |          |                                                                                                                                                                                         |
| asset\_expression\_validation\_results | [AssetExpressionValidationResult](#assetexpressionvalidationresult) | repeated | If the expression is invalid for an asset, one or more AssetExpressionValidationResult will be returned. This may block saving if the override\_expression\_validation flag is not set. |
| error                                  | string                                                              | optional | If the rule is invalid and unable to be saved, this will contain the error message. Expression errors will be returned in the asset\_expression\_validation\_results.                   |
| rule\_name                             | string                                                              |          |                                                                                                                                                                                         |

### ViewHumanFriendlyRulesRequest

Deprecated - use ViewJsonRulesRequest.

| Field     | Type   | Label | Description |
| :-------- | :----- | :---- | :---------- |
| asset\_id | string |       |             |

### ViewHumanFriendlyRulesResponse

Deprecated - use ViewJsonRulesResponse.

| Field       | Type   | Label | Description |
| :---------- | :----- | :---- | :---------- |
| rules\_json | string |       |             |

### ViewJsonRulesRequest

| Field     | Type   | Label | Description |
| :-------- | :----- | :---- | :---------- |
| asset\_id | string |       |             |

### ViewJsonRulesResponse

| Field       | Type   | Label | Description |
| :---------- | :----- | :---- | :---------- |
| rules\_json | string |       |             |

### WebhookActionConfiguration

| Field       | Type   | Label | Description |
| :---------- | :----- | :---- | :---------- |
| webhook\_id | string |       |             |

<a name="sift_rules_v1_rules-proto-enums" />

## Enums

*Allowed constant values used in message fields.*

### ActionKind

| Name                      | Number | Description |
| :------------------------ | :----- | :---------- |
| ACTION\_KIND\_UNSPECIFIED | 0      |             |
| NOTIFICATION              | 1      |             |
| ANNOTATION                | 2      |             |
| WEBHOOK                   | 3      |             |

### ConditionComparator

| Name                               | Number | Description |
| :--------------------------------- | :----- | :---------- |
| CONDITION\_COMPARATOR\_UNSPECIFIED | 0      |             |
| LESS\_THAN                         | 1      |             |
| LESS\_THAN\_OR\_EQUAL              | 2      |             |
| GREATER\_THAN                      | 3      |             |
| GREATER\_THAN\_OR\_EQUAL           | 4      |             |
| EQUAL                              | 5      |             |
| NOT\_EQUAL                         | 6      |             |

### SearchOrder

| Name                       | Number | Description |
| :------------------------- | :----- | :---------- |
| SEARCH\_ORDER\_UNSPECIFIED | 0      |             |
| SEARCH\_ORDER\_ASC         | 1      |             |
| SEARCH\_ORDER\_DESC        | 2      |             |
