# hyperlinks.patch

> Update hyperlink metadata (destination, tooltip, target, rel) without changing display text.



- Member path: `doc.hyperlinks.patch(…)`
- Mutates document: yes
- Idempotency: `conditional`
- Supports tracked mode: no
- Supports dry run: yes

## Expected result

Returns a HyperlinkMutationResult with the updated hyperlink address on success, or NO_OP if unchanged.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "InlineAnchor": {
      "type": "object",
      "properties": {
        "start": {
          "$ref": "#/$defs/Position"
        },
        "end": {
          "$ref": "#/$defs/Position"
        }
      },
      "additionalProperties": false,
      "required": [
        "start",
        "end"
      ]
    },
    "Position": {
      "type": "object",
      "properties": {
        "blockId": {
          "type": "string"
        },
        "offset": {
          "type": "integer"
        }
      },
      "additionalProperties": false,
      "required": [
        "blockId",
        "offset"
      ]
    }
  },
  "type": "object",
  "properties": {
    "target": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "inline"
        },
        "nodeType": {
          "const": "hyperlink"
        },
        "anchor": {
          "$ref": "#/$defs/InlineAnchor"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "nodeType",
        "anchor"
      ]
    },
    "patch": {
      "type": "object",
      "properties": {
        "href": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "anchor": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "docLocation": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "tooltip": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "target": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "rel": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false,
  "required": [
    "target",
    "patch"
  ]
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "InlineAnchor": {
      "type": "object",
      "properties": {
        "start": {
          "$ref": "#/$defs/Position"
        },
        "end": {
          "$ref": "#/$defs/Position"
        }
      },
      "additionalProperties": false,
      "required": [
        "start",
        "end"
      ]
    },
    "Position": {
      "type": "object",
      "properties": {
        "blockId": {
          "type": "string"
        },
        "offset": {
          "type": "integer"
        }
      },
      "additionalProperties": false,
      "required": [
        "blockId",
        "offset"
      ]
    }
  },
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "hyperlink": {
          "type": "object",
          "properties": {
            "kind": {
              "const": "inline"
            },
            "nodeType": {
              "const": "hyperlink"
            },
            "anchor": {
              "$ref": "#/$defs/InlineAnchor"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "nodeType",
            "anchor"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "success",
        "hyperlink"
      ]
    },
    {
      "type": "object",
      "properties": {
        "success": {
          "const": false
        },
        "failure": {
          "type": "object",
          "properties": {
            "code": {
              "enum": [
                "NO_OP",
                "INVALID_TARGET",
                "TARGET_NOT_FOUND",
                "CAPABILITY_UNAVAILABLE"
              ]
            },
            "message": {
              "type": "string"
            },
            "details": {
              "type": "object"
            }
          },
          "additionalProperties": false,
          "required": [
            "code",
            "message"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "success",
        "failure"
      ]
    }
  ]
}
```

## Pre-apply throws

- `TARGET_NOT_FOUND`
- `CAPABILITY_UNAVAILABLE`
- `INVALID_TARGET`
- `INVALID_INPUT`

## Non-applied receipt codes

- `NO_OP`

