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

# footnotes.insert

> Insert a new footnote or endnote at a target location or the current selection. Structured `body` content is not available in this v1-only branch; those shapes return `CAPABILITY_UNAVAILABLE`.

## Summary

Insert a new footnote or endnote at a target location or the current selection. Structured `body` content is not available in this v1-only branch; those shapes return `CAPABILITY_UNAVAILABLE`.

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

## Expected result

Returns a FootnoteMutationResult indicating success with the footnote address or a failure.

## Input fields

### Variant 1 (at.kind="text")

| Field | Type | Required | Description |
| - | - | - | - |
| `at` | TextTarget | no | TextTarget |
| `at.kind` | `"text"` | no | Constant: `"text"` |
| `at.segments` | TextSegment\[] | no | |
| `at.story` | StoryLocator | no | StoryLocator |
| `content` | string | yes | |
| `type` | enum | yes | `"footnote"`, `"endnote"` |

### Variant 2 (at.kind="text")

| Field | Type | Required | Description |
| - | - | - | - |
| `at` | TextTarget | no | TextTarget |
| `at.kind` | `"text"` | no | Constant: `"text"` |
| `at.segments` | TextSegment\[] | no | |
| `at.story` | StoryLocator | no | StoryLocator |
| `body` | object \| object\[] | yes | One of: object, object\[] |
| `type` | enum | yes | `"footnote"`, `"endnote"` |

### Example request

```json theme={null}
{
  "at": {
    "kind": "text",
    "segments": [
      {
        "blockId": "block-abc123",
        "range": {
          "end": 10,
          "start": 0
        }
      }
    ],
    "story": {
      "kind": "story",
      "storyType": "body"
    }
  },
  "content": "example",
  "type": "footnote"
}
```

## Output fields

### Variant 1 (success=true)

| Field | Type | Required | Description |
| - | - | - | - |
| `footnote` | object(kind="entity") | yes | |
| `footnote.entityType` | `"footnote"` | yes | Constant: `"footnote"` |
| `footnote.kind` | `"entity"` | yes | Constant: `"entity"` |
| `footnote.noteId` | string | yes | |
| `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}
{
  "footnote": {
    "entityType": "footnote",
    "kind": "entity",
    "noteId": "example"
  },
  "success": true
}
```

## Pre-apply throws

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

## Non-applied failure codes

* `INVALID_FRAGMENT`
* `CAPABILITY_UNAVAILABLE`

## Raw schemas

> [accordion] Raw input schema
>
> ```json theme={null}
> {
>   "oneOf": [
>     {
>       "additionalProperties": false,
>       "properties": {
>         "at": {
>           "$ref": "#/$defs/TextTarget"
>         },
>         "content": {
>           "type": "string"
>         },
>         "type": {
>           "enum": [
>             "footnote",
>             "endnote"
>           ]
>         }
>       },
>       "required": [
>         "type",
>         "content"
>       ],
>       "type": "object"
>     },
>     {
>       "additionalProperties": false,
>       "properties": {
>         "at": {
>           "$ref": "#/$defs/TextTarget"
>         },
>         "body": {
>           "description": "Structured SDM/1 note body.",
>           "oneOf": [
>             {
>               "type": "object"
>             },
>             {
>               "items": {
>                 "type": "object"
>               },
>               "type": "array"
>             }
>           ]
>         },
>         "type": {
>           "enum": [
>             "footnote",
>             "endnote"
>           ]
>         }
>       },
>       "required": [
>         "type",
>         "body"
>       ],
>       "type": "object"
>     }
>   ]
> }
> ```

> [accordion] Raw output schema
>
> ```json theme={null}
> {
>   "oneOf": [
>     {
>       "additionalProperties": false,
>       "properties": {
>         "footnote": {
>           "additionalProperties": false,
>           "properties": {
>             "entityType": {
>               "const": "footnote"
>             },
>             "kind": {
>               "const": "entity"
>             },
>             "noteId": {
>               "type": "string"
>             }
>           },
>           "required": [
>             "kind",
>             "entityType",
>             "noteId"
>           ],
>           "type": "object"
>         },
>         "success": {
>           "const": true
>         }
>       },
>       "required": [
>         "success",
>         "footnote"
>       ],
>       "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": {
>     "footnote": {
>       "additionalProperties": false,
>       "properties": {
>         "entityType": {
>           "const": "footnote"
>         },
>         "kind": {
>           "const": "entity"
>         },
>         "noteId": {
>           "type": "string"
>         }
>       },
>       "required": [
>         "kind",
>         "entityType",
>         "noteId"
>       ],
>       "type": "object"
>     },
>     "success": {
>       "const": true
>     }
>   },
>   "required": [
>     "success",
>     "footnote"
>   ],
>   "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.