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

Summary

Remove a hyperlink. Mode ‘unwrap’ preserves display text; ‘deleteText’ removes the linked content entirely.
  • Operation ID: hyperlinks.remove
  • API member path: editor.doc.hyperlinks.remove(...)
  • Mutates document: yes
  • Idempotency: conditional
  • Supports tracked mode: no
  • Supports dry run: yes
  • Deterministic target resolution: yes

Expected result

Returns a HyperlinkMutationResult with the removed hyperlink address on success, or a failure code on no-op.

Input fields

FieldTypeRequiredDescription
modeenumno"unwrap", "deleteText"
targetobject(kind=“inline”)yes
target.anchorInlineAnchoryesInlineAnchor
target.anchor.endPositionyesPosition
target.anchor.end.blockIdstringyes
target.anchor.end.offsetintegeryes
target.anchor.startPositionyesPosition
target.anchor.start.blockIdstringyes
target.anchor.start.offsetintegeryes
target.kind"inline"yesConstant: "inline"
target.nodeType"hyperlink"yesConstant: "hyperlink"

Example request

{
  "mode": "unwrap",
  "target": {
    "anchor": {
      "end": {
        "blockId": "block-abc123",
        "offset": 0
      },
      "start": {
        "blockId": "block-abc123",
        "offset": 0
      }
    },
    "kind": "inline",
    "nodeType": "hyperlink"
  }
}

Output fields

FieldTypeRequiredDescription
hyperlinkobject(kind=“inline”)yes
hyperlink.anchorInlineAnchoryesInlineAnchor
hyperlink.anchor.endPositionyesPosition
hyperlink.anchor.end.blockIdstringyes
hyperlink.anchor.end.offsetintegeryes
hyperlink.anchor.startPositionyesPosition
hyperlink.anchor.start.blockIdstringyes
hyperlink.anchor.start.offsetintegeryes
hyperlink.kind"inline"yesConstant: "inline"
hyperlink.nodeType"hyperlink"yesConstant: "hyperlink"
successtrueyesConstant: true

Variant 2 (success=false)

FieldTypeRequiredDescription
failureobjectyes
failure.codeenumyes"NO_OP", "INVALID_TARGET", "TARGET_NOT_FOUND", "CAPABILITY_UNAVAILABLE"
failure.detailsobjectno
failure.messagestringyes
successfalseyesConstant: false

Example response

{
  "hyperlink": {
    "anchor": {
      "end": {
        "blockId": "block-abc123",
        "offset": 0
      },
      "start": {
        "blockId": "block-abc123",
        "offset": 0
      }
    },
    "kind": "inline",
    "nodeType": "hyperlink"
  },
  "success": true
}

Pre-apply throws

  • TARGET_NOT_FOUND
  • CAPABILITY_UNAVAILABLE
  • INVALID_TARGET
  • INVALID_INPUT

Non-applied failure codes

  • NO_OP

Raw schemas

{
  "additionalProperties": false,
  "properties": {
    "mode": {
      "enum": [
        "unwrap",
        "deleteText"
      ]
    },
    "target": {
      "additionalProperties": false,
      "properties": {
        "anchor": {
          "$ref": "#/$defs/InlineAnchor"
        },
        "kind": {
          "const": "inline"
        },
        "nodeType": {
          "const": "hyperlink"
        }
      },
      "required": [
        "kind",
        "nodeType",
        "anchor"
      ],
      "type": "object"
    }
  },
  "required": [
    "target"
  ],
  "type": "object"
}
{
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "hyperlink": {
          "additionalProperties": false,
          "properties": {
            "anchor": {
              "$ref": "#/$defs/InlineAnchor"
            },
            "kind": {
              "const": "inline"
            },
            "nodeType": {
              "const": "hyperlink"
            }
          },
          "required": [
            "kind",
            "nodeType",
            "anchor"
          ],
          "type": "object"
        },
        "success": {
          "const": true
        }
      },
      "required": [
        "success",
        "hyperlink"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "failure": {
          "additionalProperties": false,
          "properties": {
            "code": {
              "enum": [
                "NO_OP",
                "INVALID_TARGET",
                "TARGET_NOT_FOUND",
                "CAPABILITY_UNAVAILABLE"
              ]
            },
            "details": {
              "type": "object"
            },
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object"
        },
        "success": {
          "const": false
        }
      },
      "required": [
        "success",
        "failure"
      ],
      "type": "object"
    }
  ]
}
{
  "additionalProperties": false,
  "properties": {
    "hyperlink": {
      "additionalProperties": false,
      "properties": {
        "anchor": {
          "$ref": "#/$defs/InlineAnchor"
        },
        "kind": {
          "const": "inline"
        },
        "nodeType": {
          "const": "hyperlink"
        }
      },
      "required": [
        "kind",
        "nodeType",
        "anchor"
      ],
      "type": "object"
    },
    "success": {
      "const": true
    }
  },
  "required": [
    "success",
    "hyperlink"
  ],
  "type": "object"
}
{
  "additionalProperties": false,
  "properties": {
    "failure": {
      "additionalProperties": false,
      "properties": {
        "code": {
          "enum": [
            "NO_OP",
            "INVALID_TARGET",
            "TARGET_NOT_FOUND",
            "CAPABILITY_UNAVAILABLE"
          ]
        },
        "details": {
          "type": "object"
        },
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "success": {
      "const": false
    }
  },
  "required": [
    "success",
    "failure"
  ],
  "type": "object"
}