Skip to main content
Alpha: Document API is currently alpha and subject to breaking changes.

Summary

Insert a new footnote or endnote at a target location.
  • Operation ID: footnotes.insert
  • API member path: editor.doc.footnotes.insert(...)
  • Mutates document: yes
  • Idempotency: non-idempotent
  • Supports tracked mode: no
  • Supports dry run: no
  • Deterministic target resolution: yes

Expected result

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

Input fields

FieldTypeRequiredDescription
atTextTargetyesTextTarget
at.kind"text"yesConstant: "text"
at.segmentsTextSegment[]yes
contentstringyes
typeenumyes"footnote", "endnote"

Example request

{
  "at": {
    "kind": "text",
    "segments": [
      {
        "blockId": "block-abc123",
        "range": {
          "end": 10,
          "start": 0
        }
      }
    ]
  },
  "content": "example",
  "type": "footnote"
}

Output fields

Variant 1 (footnote.kind=“entity”)

FieldTypeRequiredDescription
footnoteobject(kind=“entity”)yes
footnote.entityType"footnote"yesConstant: "footnote"
footnote.kind"entity"yesConstant: "entity"
footnote.noteIdstringyes
successtrueyesConstant: true

Variant 2 (success=false)

FieldTypeRequiredDescription
failureobjectyes
failure.codestringyes
failure.detailsanyno
failure.messagestringyes
successfalseyesConstant: false

Example response

{
  "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

  • None

Raw schemas

{
  "additionalProperties": false,
  "properties": {
    "at": {
      "$ref": "#/$defs/TextTarget"
    },
    "content": {
      "type": "string"
    },
    "type": {
      "enum": [
        "footnote",
        "endnote"
      ]
    }
  },
  "required": [
    "at",
    "type",
    "content"
  ],
  "type": "object"
}
{
  "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"
    }
  ]
}
{
  "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"
}