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

# index.insert

> Insert a new index block at a target location.

## Summary

Insert a new index block at a target location.

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

## Expected result

Returns an IndexMutationResult indicating success with the index address or a failure.

## Input fields

| Field | Type | Required | Description |
| - | - | - | - |
| `at` | object(kind="documentStart") \| object(kind="documentEnd") \| object(kind="before") \| object(kind="after") | yes | One of: object(kind="documentStart"), object(kind="documentEnd"), object(kind="before"), object(kind="after") |
| `config` | object | no | |
| `config.accentedSorting` | boolean | no | |
| `config.columns` | integer | no | |
| `config.entryPageSeparator` | string | no | |
| `config.entryTypeFilter` | string | no | |
| `config.headingSeparator` | string | no | |
| `config.letterRange` | object | no | |
| `config.letterRange.from` | string | no | |
| `config.letterRange.to` | string | no | |
| `config.pageRangeBookmark` | string | no | |
| `config.pageRangeSeparator` | string | no | |
| `config.runIn` | boolean | no | |
| `config.sequenceId` | string | no | |

### Example request

```json theme={null}
{
  "at": {
    "kind": "documentStart"
  },
  "config": {
    "entryPageSeparator": "example",
    "headingSeparator": "example"
  }
}
```

## Output fields

### Variant 1 (success=true)

| Field | Type | Required | Description |
| - | - | - | - |
| `index` | object(kind="block") | yes | |
| `index.kind` | `"block"` | yes | Constant: `"block"` |
| `index.nodeId` | string | yes | |
| `index.nodeType` | `"index"` | yes | Constant: `"index"` |
| `success` | `true` | yes | Constant: `true` |

### Variant 2 (success=false)

| Field | Type | Required | Description |
| - | - | - | - |
| `failure` | object | yes | |
| `failure.code` | string | yes | |
| `failure.details` | any | no | |
| `failure.message` | string | yes | |
| `success` | `false` | yes | Constant: `false` |

### Example response

```json theme={null}
{
  "index": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "index"
  },
  "success": true
}
```

## Pre-apply throws

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

## Non-applied failure codes

* None

## Raw schemas

> [accordion] Raw input schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "at": {
>       "oneOf": [
>         {
>           "additionalProperties": false,
>           "properties": {
>             "kind": {
>               "const": "documentStart"
>             }
>           },
>           "required": [
>             "kind"
>           ],
>           "type": "object"
>         },
>         {
>           "additionalProperties": false,
>           "properties": {
>             "kind": {
>               "const": "documentEnd"
>             }
>           },
>           "required": [
>             "kind"
>           ],
>           "type": "object"
>         },
>         {
>           "additionalProperties": false,
>           "properties": {
>             "kind": {
>               "const": "before"
>             },
>             "target": {
>               "$ref": "#/$defs/BlockNodeAddress"
>             }
>           },
>           "required": [
>             "kind",
>             "target"
>           ],
>           "type": "object"
>         },
>         {
>           "additionalProperties": false,
>           "properties": {
>             "kind": {
>               "const": "after"
>             },
>             "target": {
>               "$ref": "#/$defs/BlockNodeAddress"
>             }
>           },
>           "required": [
>             "kind",
>             "target"
>           ],
>           "type": "object"
>         }
>       ]
>     },
>     "config": {
>       "additionalProperties": false,
>       "properties": {
>         "accentedSorting": {
>           "type": "boolean"
>         },
>         "columns": {
>           "type": "integer"
>         },
>         "entryPageSeparator": {
>           "type": "string"
>         },
>         "entryTypeFilter": {
>           "type": "string"
>         },
>         "headingSeparator": {
>           "type": "string"
>         },
>         "letterRange": {
>           "additionalProperties": false,
>           "properties": {
>             "from": {
>               "type": "string"
>             },
>             "to": {
>               "type": "string"
>             }
>           },
>           "required": [
>             "from",
>             "to"
>           ],
>           "type": "object"
>         },
>         "pageRangeBookmark": {
>           "type": "string"
>         },
>         "pageRangeSeparator": {
>           "type": "string"
>         },
>         "runIn": {
>           "type": "boolean"
>         },
>         "sequenceId": {
>           "type": "string"
>         }
>       },
>       "type": "object"
>     }
>   },
>   "required": [
>     "at"
>   ],
>   "type": "object"
> }
> ```

> [accordion] Raw output schema
>
> ```json theme={null}
> {
>   "oneOf": [
>     {
>       "additionalProperties": false,
>       "properties": {
>         "index": {
>           "additionalProperties": false,
>           "properties": {
>             "kind": {
>               "const": "block"
>             },
>             "nodeId": {
>               "type": "string"
>             },
>             "nodeType": {
>               "const": "index"
>             }
>           },
>           "required": [
>             "kind",
>             "nodeType",
>             "nodeId"
>           ],
>           "type": "object"
>         },
>         "success": {
>           "const": true
>         }
>       },
>       "required": [
>         "success",
>         "index"
>       ],
>       "type": "object"
>     },
>     {
>       "additionalProperties": false,
>       "properties": {
>         "failure": {
>           "additionalProperties": false,
>           "properties": {
>             "code": {
>               "type": "string"
>             },
>             "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": {
>     "index": {
>       "additionalProperties": false,
>       "properties": {
>         "kind": {
>           "const": "block"
>         },
>         "nodeId": {
>           "type": "string"
>         },
>         "nodeType": {
>           "const": "index"
>         }
>       },
>       "required": [
>         "kind",
>         "nodeType",
>         "nodeId"
>       ],
>       "type": "object"
>     },
>     "success": {
>       "const": true
>     }
>   },
>   "required": [
>     "success",
>     "index"
>   ],
>   "type": "object"
> }
> ```

> [accordion] Raw failure schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "failure": {
>       "additionalProperties": false,
>       "properties": {
>         "code": {
>           "type": "string"
>         },
>         "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.