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

# Lemlist: Patch Sequences Sequenceid Steps Stepid Branches

> Reorder Condition Branches. Includes SDK V2 and CLI requests, input constraints, response fields, and Deepline credit cost.

Reorder Condition Branches.

<Info>
  Tool ID: `lemlist_patch_sequences_sequenceid_steps_stepid_branches`
</Info>

## Run this action

Use the TypeScript SDK for a single call. Put `ctx.tools.execute(...)` inside a Play when the call should be durable, scheduled, or run across a CSV.

```ts theme={null}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'lemlist_patch_sequences_sequenceid_steps_stepid_branches',
  {
    "sequenceId": "sequence_123",
    "stepId": "step_123",
    "order": [
      "example"
    ]
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={null}
deepline tools execute lemlist_patch_sequences_sequenceid_steps_stepid_branches --input '{
  "sequenceId": "sequence_123",
  "stepId": "step_123",
  "order": [
    "example"
  ]
}' --json
```

## Example response

The SDK exposes this shape at `result.toolResponse.raw`. Values below are representative.

```json theme={null}
{
  "data": [
    {
      "sequenceId": "sequence_123",
      "index": 123,
      "fallback": true
    }
  ]
}
```

Use `deepline tools get lemlist_patch_sequences_sequenceid_steps_stepid_branches --json` for the latest machine-readable contract.

## Input reference

Rewrites the execution priority of a condition step's branches. Order is priority: the first branch whose test matches takes the lead. `order` must list every non-fallback branch of the step exactly once. The Else branch is not orderable and always stays last, so it is left out of the list. Sending the order the step already has is a no-op that still returns the branches.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.sequenceId` | `string` | Yes | — | The unique identifier of the sequence holding the condition step |
| `payload.stepId` | `string` | Yes | — | The unique identifier of the condition step, from `GET /campaigns/&#123;campaignId&#125;/sequences` |
| `payload.order` | `array` | Yes | — | Every branch of the step by `sequenceId`, in the new execution order, excluding the Else branch. |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Rewrites the execution priority of a condition step's branches. Order is priority: the first branch whose test matches takes the lead. `order` must list every non-fallback branch of the step exactly once. The Else branch is not orderable and always stays last, so it is left out of the list. Sending the order the step already has is a no-op that still returns the branches.",
    "properties": {
      "sequenceId": {
        "type": "string",
        "description": "The unique identifier of the sequence holding the condition step"
      },
      "stepId": {
        "type": "string",
        "description": "The unique identifier of the condition step, from `GET /campaigns/{campaignId}/sequences`"
      },
      "order": {
        "type": "array",
        "description": "Every branch of the step by `sequenceId`, in the new execution order, excluding the Else branch.",
        "items": {
          "type": "string"
        }
      }
    },
    "required": [
      "sequenceId",
      "stepId",
      "order"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

Standard tool result payload.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.data` | `array` | Yes | — | Provider response payload. |
| `result.data[].sequenceId` | `string` | No | — | The branch's sub-sequence id, and its address on every branch endpoint. Pass it to `POST /sequences/&#123;sequenceId&#125;/steps` to add steps inside the branch. |
| `result.data[].index` | `integer` | No | — | Execution rank among the non-fallback branches, starting at 0. The first branch whose test matches takes the lead. Absent on the Else branch, which always runs last. |
| `result.data[].fallback` | `boolean` | No | — | `true` on the Else branch - the one that catches every lead no other branch matched. Absent on the others. |
| `result.data[].key` | `string` | No | — | The condition the step tests. Every branch of a step shares it: a branch never carries a condition of its own. |
| `result.data[].name` | `string` | No | — | The branch's display name, present only when someone has set one. lemlist labels the unnamed ones "Branch 1", "Branch 2", … and "Else"; those defaults are not stored and are not returned here. |
| `result.data[].delay` | `integer` | No | — | Length of the time window the condition waits on the lead's action, in days. Only on the lead-action conditions that store one. |
| `result.data[].delayType` | `"within" \| "waitUntil"` | No | — | How the condition waits: `within` branches once the window is over, `waitUntil` parks the lead until the action happens, with no time bound. Allowed: `within`, `waitUntil`. |
| `result.data[].scoreComparator` | `"$gte" \| "$lt"` | No | — | `hasScore` only - how the lead's score is compared to `scoreThreshold`. Allowed: `$gte`, `$lt`. |
| `result.data[].scoreThreshold` | `integer` | No | — | `hasScore` only - the score this branch tests against. |
| `result.data[].emailStatusFilter` | `array` | No | — | `hasEmailAddress` only - the email statuses this branch matches. |
| `result.data[].callStatusFilter` | `array` | No | — | `aircallDone` only - the call-status keys this branch matches. |
| `result.data[].customField` | `string` | No | — | `customLeadInfo` only - the tested field, normalized: a lead variable reads back as `variables. `, a contact field as `fields. `. Every branch of the step tests the same field. |
| `result.data[].customOperator` | `"equal" \| "contains" \| "empty" \| "notEmpty"` | No | — | `customLeadInfo` only - how the field is compared to the tested values. Allowed: `equal`, `contains`, `empty`, `notEmpty`. |
| `result.data[].customValues` | `array` | No | — | `customLeadInfo` only - every value this branch tests; the branch matches when any of them does. Empty for the `empty` and `notEmpty` operators. |
| `result.data[].selector` | `string` | No | — | The raw stored condition selector, as JSON. Returned only when none of the fields above could describe the branch. |
| `result.meta` | `object` | No | — | Additional response metadata (status, paging). |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={null}
  {
    "type": "object",
    "description": "Standard tool result payload.",
    "properties": {
      "data": {
        "type": "array",
        "description": "Provider response payload.",
        "items": {
          "type": "object",
          "description": "One branch of a condition step. Addressed by `sequenceId` - the sub-sequence its leads walk - never by position. The fields describing what the branch tests depend on the step's condition; the ones that do not apply are absent.",
          "properties": {
            "sequenceId": {
              "type": "string",
              "description": "The branch's sub-sequence id, and its address on every branch endpoint. Pass it to `POST /sequences/{sequenceId}/steps` to add steps inside the branch."
            },
            "index": {
              "type": "integer",
              "description": "Execution rank among the non-fallback branches, starting at 0. The first branch whose test matches takes the lead. Absent on the Else branch, which always runs last."
            },
            "fallback": {
              "type": "boolean",
              "description": "`true` on the Else branch - the one that catches every lead no other branch matched. Absent on the others."
            },
            "key": {
              "type": "string",
              "description": "The condition the step tests. Every branch of a step shares it: a branch never carries a condition of its own."
            },
            "name": {
              "type": "string",
              "description": "The branch's display name, present only when someone has set one. lemlist labels the unnamed ones \"Branch 1\", \"Branch 2\", … and \"Else\"; those defaults are not stored and are not returned here."
            },
            "delay": {
              "type": "integer",
              "description": "Length of the time window the condition waits on the lead's action, in days. Only on the lead-action conditions that store one."
            },
            "delayType": {
              "type": "string",
              "description": "How the condition waits: `within` branches once the window is over, `waitUntil` parks the lead until the action happens, with no time bound.",
              "enum": [
                "within",
                "waitUntil"
              ]
            },
            "scoreComparator": {
              "type": "string",
              "description": "`hasScore` only - how the lead's score is compared to `scoreThreshold`.",
              "enum": [
                "$gte",
                "$lt"
              ]
            },
            "scoreThreshold": {
              "type": "integer",
              "description": "`hasScore` only - the score this branch tests against."
            },
            "emailStatusFilter": {
              "type": "array",
              "description": "`hasEmailAddress` only - the email statuses this branch matches.",
              "items": {
                "type": "string",
                "enum": [
                  "deliverable",
                  "risky",
                  "undeliverable",
                  "unverified"
                ]
              }
            },
            "callStatusFilter": {
              "type": "array",
              "description": "`aircallDone` only - the call-status keys this branch matches.",
              "items": {
                "type": "string"
              }
            },
            "customField": {
              "type": "string",
              "description": "`customLeadInfo` only - the tested field, normalized: a lead variable reads back as `variables. `, a contact field as `fields. `. Every branch of the step tests the same field."
            },
            "customOperator": {
              "type": "string",
              "description": "`customLeadInfo` only - how the field is compared to the tested values.",
              "enum": [
                "equal",
                "contains",
                "empty",
                "notEmpty"
              ]
            },
            "customValues": {
              "type": "array",
              "description": "`customLeadInfo` only - every value this branch tests; the branch matches when any of them does. Empty for the `empty` and `notEmpty` operators.",
              "items": {
                "type": "string"
              }
            },
            "selector": {
              "type": "string",
              "description": "The raw stored condition selector, as JSON. Returned only when none of the fields above could describe the branch."
            }
          },
          "additionalProperties": false
        }
      },
      "meta": {
        "type": "object",
        "description": "Additional response metadata (status, paging).",
        "additionalProperties": true
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Lemlist provider guide](/docs/providers/lemlist/guide)
* [SDK V2 quickstart](/docs/sdk-v2/quickstart)
* [SDK reference](/docs/sdk-v2/sdk-reference)
* [Run tools across a CSV](/docs/sdk-v2/batch-csv)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.