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

# lists.merge

> Compound: merge two adjacent list sequences into one. Reassigns numId on the absorbed sequence (no strict abstractNumId check: absorbed items adopt the absorbing definition) and deletes empty paragraphs between the two sequences. Use this instead of lists.join for the user-facing "merge these lists" intent.

## Summary

Compound: merge two adjacent list sequences into one. Reassigns numId on the absorbed sequence (no strict abstractNumId check: absorbed items adopt the absorbing definition) and deletes empty paragraphs between the two sequences. Use this instead of lists.join for the user-facing "merge these lists" intent.

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

## Expected result

Returns a ListsMergeResult with the merged listId, absorbedCount, and removedEmptyBlocks count.

## 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"` |
| `target.story` | StoryLocator | no | StoryLocator |

### Example request

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

## Output fields

### Variant 1 (success=true)

| Field | Type | Required | Description |
| - | - | - | - |
| `absorbedCount` | integer | yes | |
| `listId` | string | yes | |
| `removedEmptyBlocks` | integer | 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"`, `"NO_OP"` |
| `failure.details` | any | no | |
| `failure.message` | string | yes | |
| `success` | `false` | yes | Constant: `false` |

### Example response

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

## Pre-apply throws

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

## Non-applied failure codes

* `INVALID_TARGET`
* `NO_ADJACENT_SEQUENCE`
* `NO_OP`

## Raw schemas

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

> [accordion] Raw output schema
>
> ```json theme={null}
> {
>   "oneOf": [
>     {
>       "additionalProperties": false,
>       "properties": {
>         "absorbedCount": {
>           "type": "integer"
>         },
>         "listId": {
>           "type": "string"
>         },
>         "removedEmptyBlocks": {
>           "type": "integer"
>         },
>         "success": {
>           "const": true
>         }
>       },
>       "required": [
>         "success",
>         "listId",
>         "absorbedCount",
>         "removedEmptyBlocks"
>       ],
>       "type": "object"
>     },
>     {
>       "additionalProperties": false,
>       "properties": {
>         "failure": {
>           "additionalProperties": false,
>           "properties": {
>             "code": {
>               "enum": [
>                 "INVALID_TARGET",
>                 "NO_ADJACENT_SEQUENCE",
>                 "NO_OP"
>               ]
>             },
>             "details": {},
>             "message": {
>               "type": "string"
>             }
>           },
>           "required": [
>             "code",
>             "message"
>           ],
>           "type": "object"
>         },
>         "success": {
>           "const": false
>         }
>       },
>       "required": [
>         "success",
>         "failure"
>       ],
>       "type": "object"
>     }
>   ]
> }
> ```

> [accordion] Raw success schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "absorbedCount": {
>       "type": "integer"
>     },
>     "listId": {
>       "type": "string"
>     },
>     "removedEmptyBlocks": {
>       "type": "integer"
>     },
>     "success": {
>       "const": true
>     }
>   },
>   "required": [
>     "success",
>     "listId",
>     "absorbedCount",
>     "removedEmptyBlocks"
>   ],
>   "type": "object"
> }
> ```

> [accordion] Raw failure schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "failure": {
>       "additionalProperties": false,
>       "properties": {
>         "code": {
>           "enum": [
>             "INVALID_TARGET",
>             "NO_ADJACENT_SEQUENCE",
>             "NO_OP"
>           ]
>         },
>         "details": {},
>         "message": {
>           "type": "string"
>         }
>       },
>       "required": [
>         "code",
>         "message"
>       ],
>       "type": "object"
>     },
>     "success": {
>       "const": false
>     }
>   },
>   "required": [
>     "success",
>     "failure"
>   ],
>   "type": "object"
> }
> ```


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