# <a id="bitdrift.public.unary.workflows.v1.Step"></a>Step

**Source definition:** [`src/bitdrift/public/unary/workflows/v1/workflow.proto#L150-L196`](<https://github.com/bitdriftlabs/api/blob/main/src/bitdrift/public/unary/workflows/v1/workflow.proto#L150-L196>)

A single step within a flow.

<section class="proto-fields-table" markdown>
| Field | Type | Description |
|---|---|---|
| match_rule | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflows</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">MatchRule</i>](bitdrift_public_unary_workflows_v1_MatchRule.md "bitdrift.public.unary.workflows.v1.MatchRule")</span> | The step's match rule. This rule must be satisfied to advance to the next step in the flow. |
| exit_conditions | <span class="proto-type proto-type-message">array of [<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflows</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">Step</i><i class="proto-type-dot">.</i><i class="proto-type-part">ExitCondition</i>](#bitdrift.public.unary.workflows.v1.Step.ExitCondition "bitdrift.public.unary.workflows.v1.Step.ExitCondition")</span><br><em class="proto-field-annotation">up to 100 items</em> | Zero or more early-exit conditions for the step. If any exit condition is met, the current  run ends and the flow resets to wait for the first step again. |
| loop_match_id | <span class="proto-type proto-type-primitive">optional string</span><br><em class="proto-field-annotation">up to 100 chars</em> | Describes an optional loop condition that allows looping back to a previous step in the flow.  Must point to the match ID in the same step or a step earlier in the flow. Specifying a looping  condition is only valid on the last step in the flow *unless* actions contains a Sankey rule  that refers to the match ID of this step as one of the nodes. |
| save_fields | <span class="proto-type proto-type-message">array of [<i class="proto-type-part">bitdrift_public</i><i class="proto-type-dot">.</i><i class="proto-type-part">protobuf</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflow</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">SaveField</i>](bitdrift_public_protobuf_workflow_v1_SaveField.md "bitdrift_public.protobuf.workflow.v1.SaveField")</span><br><em class="proto-field-annotation">up to 100 items</em> | Fields to save when this step is matched. These fields can be referred to by saved_field_id  in a subsequent matcher. The ID of each SaveField must be unique within the flow. This is  used for correlation matching in which flow completion is dependent on a particular set of  field values being consistent across multiple steps in the flow. |

</section>
<p class="h4">Example</p>
```json
{
  "exit_conditions": [
    {
      "match_rule": {
        "generic_match": {
          "base_matcher": {
            "log_field": "field_name",
            "operator": "EQUAL",
            "string_value": "example"
          }
        },
        "match_id": "_i1yUnHjKfmWpCaD5Tazo",
        "sample_rate": 100
      }
    }
  ],
  "loop_match_id": "_i1yUnHjKfmWpCaD5Tazo",
  "match_rule": {
    "generic_match": {
      "base_matcher": {
        "log_field": "field_name",
        "operator": "EQUAL",
        "string_value": "example"
      }
    },
    "match_id": "_i1yUnHjKfmWpCaD5Tazo",
    "sample_rate": 100
  },
  "save_fields": [
    {
      "field_name": "",
      "id": "",
      "regex_capture": ""
    }
  ]
}
```

# <a id="bitdrift.public.unary.workflows.v1.Step.ExitCondition"></a>Step.ExitCondition

**Source definition:** [`src/bitdrift/public/unary/workflows/v1/workflow.proto#L154-L176`](<https://github.com/bitdriftlabs/api/blob/main/src/bitdrift/public/unary/workflows/v1/workflow.proto#L154-L176>)

A condition that ends the current run of the flow from this step without advancing to the next
 step. When an exit condition is met, the current run is discarded and the flow waits to match
 the first step again.

<section class="proto-fields-table" markdown>
| Field | Type | Description |
|---|---|---|
| match_rule | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflows</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">MatchRule</i>](bitdrift_public_unary_workflows_v1_MatchRule.md "bitdrift.public.unary.workflows.v1.MatchRule")</span><span class="proto-field-annotation">only one of <em>match_rule</em>, or <em>timeout</em> can be set</span> | Exit the current run if this match rule fires while the step is active. |
| timeout | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflows</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">Step</i><i class="proto-type-dot">.</i><i class="proto-type-part">ExitCondition</i><i class="proto-type-dot">.</i><i class="proto-type-part">TimeoutExit</i>](#bitdrift.public.unary.workflows.v1.Step.ExitCondition.TimeoutExit "bitdrift.public.unary.workflows.v1.Step.ExitCondition.TimeoutExit")</span><span class="proto-field-annotation">only one of <em>timeout</em>, or <em>match_rule</em> can be set</span> | Exit the current run if this timeout elapses while the step is active. |

</section>
<p class="h4">Example</p>
```json
{
  "match_rule": {
    "generic_match": {
      "base_matcher": {
        "log_field": "field_name",
        "operator": "EQUAL",
        "string_value": "example"
      }
    },
    "match_id": "_i1yUnHjKfmWpCaD5Tazo",
    "sample_rate": 100
  }
}
```

# <a id="bitdrift.public.unary.workflows.v1.Step.ExitCondition.TimeoutExit"></a>Step.ExitCondition.TimeoutExit

**Source definition:** [`src/bitdrift/public/unary/workflows/v1/workflow.proto#L155-L166`](<https://github.com/bitdriftlabs/api/blob/main/src/bitdrift/public/unary/workflows/v1/workflow.proto#L155-L166>)

<section class="proto-fields-table" markdown>
| Field | Type | Description |
|---|---|---|
| id | <span class="proto-type proto-type-primitive">string</span><br><em class="proto-field-annotation">between 1 and 100 chars</em> | The ID of this timeout exit. Must be unique within the workflow. This ID can be referenced  by actions that accept timeout IDs. |
| timeout_rule | <span class="proto-type proto-type-message">[<i class="proto-type-part">bitdrift</i><i class="proto-type-dot">.</i><i class="proto-type-part">public</i><i class="proto-type-dot">.</i><i class="proto-type-part">unary</i><i class="proto-type-dot">.</i><i class="proto-type-part">workflows</i><i class="proto-type-dot">.</i><i class="proto-type-part">v1</i><i class="proto-type-dot">.</i><i class="proto-type-part">Rule</i><i class="proto-type-dot">.</i><i class="proto-type-part">RuleTimeout</i>](bitdrift_public_unary_workflows_v1_Rule.md "bitdrift.public.unary.workflows.v1.Rule.RuleTimeout")</span> | The timeout condition for this exit path. Timeout exits are terminal: when the timeout  elapses, the current run ends instead of advancing to another step. |

</section>
<p class="h4">Example</p>
```json
{
  "id": "_i1yUnHjKfmWpCaD5Tazo",
  "timeout_rule": {
    "duration": 1,
    "duration_unit": "SECONDS"
  }
}
```

