> ## Documentation Index
> Fetch the complete documentation index at: https://superdoc-caio-pizzol-docs-ai-core-preset.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# lists.join

> Merge two adjacent list sequences into one.

## Summary

Merge two adjacent list sequences into one.

* Operation ID: `lists.join`
* API member path: `editor.doc.lists.join(...)`
* Mutates document: `yes`
* Idempotency: `conditional`
* Supports tracked mode: `no`
* Supports dry run: `yes`
* Deterministic target resolution: `yes`

## Expected result

Returns a ListsJoinResult with the resulting listId of the merged sequence.

## Input fields

| Field             | Type            | Required | Description                    |
| ----------------- | --------------- | -------- | ------------------------------ |
| `direction`       | enum            | yes      | `"withPrevious"`, `"withNext"` |
| `target`          | ListItemAddress | yes      | ListItemAddress                |
| `target.kind`     | `"block"`       | yes      | Constant: `"block"`            |
| `target.nodeId`   | string          | yes      |                                |
| `target.nodeType` | `"listItem"`    | yes      | Constant: `"listItem"`         |

### Example request

```json theme={null}
{
  "direction": "withPrevious",
  "target": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "listItem"
  }
}
```

## Output fields

### Variant 1 (success=true)

| Field     | Type   | Required | Description      |
| --------- | ------ | -------- | ---------------- |
| `listId`  | string | yes      |                  |
| `success` | `true` | yes      | Constant: `true` |

### Variant 2 (success=false)

| Field             | Type    | Required | Description                                                                                           |
| ----------------- | ------- | -------- | ----------------------------------------------------------------------------------------------------- |
| `failure`         | object  | yes      |                                                                                                       |
| `failure.code`    | enum    | yes      | `"INVALID_TARGET"`, `"NO_ADJACENT_SEQUENCE"`, `"INCOMPATIBLE_DEFINITIONS"`, `"ALREADY_SAME_SEQUENCE"` |
| `failure.details` | any     | no       |                                                                                                       |
| `failure.message` | string  | yes      |                                                                                                       |
| `success`         | `false` | yes      | Constant: `false`                                                                                     |

### Example response

```json theme={null}
{
  "listId": "example",
  "success": true
}
```

## Pre-apply throws

* `TARGET_NOT_FOUND`
* `CAPABILITY_UNAVAILABLE`
* `INVALID_TARGET`

## Non-applied failure codes

* `INVALID_TARGET`
* `NO_ADJACENT_SEQUENCE`
* `INCOMPATIBLE_DEFINITIONS`
* `ALREADY_SAME_SEQUENCE`

## Raw schemas

<Accordion title="Raw input schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "direction": {
        "enum": [
          "withPrevious",
          "withNext"
        ]
      },
      "target": {
        "$ref": "#/$defs/ListItemAddress"
      }
    },
    "required": [
      "target",
      "direction"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw output schema">
  ```json theme={null}
  {
    "oneOf": [
      {
        "additionalProperties": false,
        "properties": {
          "listId": {
            "type": "string"
          },
          "success": {
            "const": true
          }
        },
        "required": [
          "success",
          "listId"
        ],
        "type": "object"
      },
      {
        "additionalProperties": false,
        "properties": {
          "failure": {
            "additionalProperties": false,
            "properties": {
              "code": {
                "enum": [
                  "INVALID_TARGET",
                  "NO_ADJACENT_SEQUENCE",
                  "INCOMPATIBLE_DEFINITIONS",
                  "ALREADY_SAME_SEQUENCE"
                ]
              },
              "details": {},
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          },
          "success": {
            "const": false
          }
        },
        "required": [
          "success",
          "failure"
        ],
        "type": "object"
      }
    ]
  }
  ```
</Accordion>

<Accordion title="Raw success schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "listId": {
        "type": "string"
      },
      "success": {
        "const": true
      }
    },
    "required": [
      "success",
      "listId"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw failure schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "failure": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "enum": [
              "INVALID_TARGET",
              "NO_ADJACENT_SEQUENCE",
              "INCOMPATIBLE_DEFINITIONS",
              "ALREADY_SAME_SEQUENCE"
            ]
          },
          "details": {},
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "success": {
        "const": false
      }
    },
    "required": [
      "success",
      "failure"
    ],
    "type": "object"
  }
  ```
</Accordion>
