> ## 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.canJoin

> Check whether two adjacent list sequences can be joined.

## Summary

Check whether two adjacent list sequences can be joined.

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

## Expected result

Returns a ListsCanJoinResult indicating feasibility and reason if not possible.

## 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

| Field            | Type    | Required | Description                                                                       |
| ---------------- | ------- | -------- | --------------------------------------------------------------------------------- |
| `adjacentListId` | string  | no       |                                                                                   |
| `canJoin`        | boolean | yes      |                                                                                   |
| `reason`         | enum    | no       | `"NO_ADJACENT_SEQUENCE"`, `"INCOMPATIBLE_DEFINITIONS"`, `"ALREADY_SAME_SEQUENCE"` |

### Example response

```json theme={null}
{
  "adjacentListId": "example",
  "canJoin": true,
  "reason": "NO_ADJACENT_SEQUENCE"
}
```

## Pre-apply throws

* `TARGET_NOT_FOUND`
* `INVALID_TARGET`
* `INVALID_INPUT`

## Non-applied failure codes

* None

## 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}
  {
    "additionalProperties": false,
    "properties": {
      "adjacentListId": {
        "type": "string"
      },
      "canJoin": {
        "type": "boolean"
      },
      "reason": {
        "enum": [
          "NO_ADJACENT_SEQUENCE",
          "INCOMPATIBLE_DEFINITIONS",
          "ALREADY_SAME_SEQUENCE"
        ]
      }
    },
    "required": [
      "canJoin"
    ],
    "type": "object"
  }
  ```
</Accordion>
