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

Summary

Apply inline run-property patch changes to the target range with explicit set/clear semantics.
  • Operation ID: format.apply
  • API member path: editor.doc.format.apply(...)
  • Mutates document: yes
  • Idempotency: conditional
  • Supports tracked mode: yes
  • Supports dry run: yes
  • Deterministic target resolution: yes

Expected result

Returns a TextMutationReceipt confirming inline styles were applied to the target range.

Input fields

FieldTypeRequiredDescription
inlineobjectyes
inline.bCsboolean \nullnoOne of: boolean, null
inline.boldboolean \nullnoOne of: boolean, null
inline.borderobject \nullnoOne of: object, null
inline.capsboolean \nullnoOne of: boolean, null
inline.charScalenumber \nullnoOne of: number, null
inline.colorstring \nullnoOne of: string, null
inline.contextualAlternatesboolean \nullnoOne of: boolean, null
inline.csboolean \nullnoOne of: boolean, null
inline.dstrikeboolean \nullnoOne of: boolean, null
inline.eastAsianLayoutobject \nullnoOne of: object, null
inline.emstring \nullnoOne of: string, null
inline.embossboolean \nullnoOne of: boolean, null
inline.fitTextobject \nullnoOne of: object, null
inline.fontFamilystring \nullnoOne of: string, null
inline.fontSizenumber \nullnoOne of: number, null
inline.fontSizeCsnumber \nullnoOne of: number, null
inline.highlightstring \nullnoOne of: string, null
inline.iCsboolean \nullnoOne of: boolean, null
inline.imprintboolean \nullnoOne of: boolean, null
inline.italicboolean \nullnoOne of: boolean, null
inline.kerningnumber \nullnoOne of: number, null
inline.langobject \nullnoOne of: object, null
inline.letterSpacingnumber \nullnoOne of: number, null
inline.ligaturesstring \nullnoOne of: string, null
inline.numFormstring \nullnoOne of: string, null
inline.numSpacingstring \nullnoOne of: string, null
inline.oMathboolean \nullnoOne of: boolean, null
inline.outlineboolean \nullnoOne of: boolean, null
inline.positionnumber \nullnoOne of: number, null
inline.rFontsobject \nullnoOne of: object, null
inline.rStylestring \nullnoOne of: string, null
inline.rtlboolean \nullnoOne of: boolean, null
inline.shadingobject \nullnoOne of: object, null
inline.shadowboolean \nullnoOne of: boolean, null
inline.smallCapsboolean \nullnoOne of: boolean, null
inline.snapToGridboolean \nullnoOne of: boolean, null
inline.specVanishboolean \nullnoOne of: boolean, null
inline.strikeboolean \nullnoOne of: boolean, null
inline.stylisticSetsobject[] \nullnoOne of: object[], null
inline.underlineboolean \null \objectnoOne of: boolean, null, object
inline.vanishboolean \nullnoOne of: boolean, null
inline.vertAlignenum \nullnoOne of: enum, null
inline.webHiddenboolean \nullnoOne of: boolean, null
targetTextAddressyesTextAddress
target.blockIdstringyes
target.kind"text"yesConstant: "text"
target.rangeRangeyesRange
target.range.endintegeryes
target.range.startintegeryes

Example request

{
  "inline": {
    "bold": true,
    "italic": true
  },
  "target": {
    "blockId": "block-abc123",
    "kind": "text",
    "range": {
      "end": 10,
      "start": 0
    }
  }
}

Output fields

Variant 1 (resolution.requestedTarget.kind=“text”)

FieldTypeRequiredDescription
insertedEntityAddress[]no
removedEntityAddress[]no
resolutionTextMutationResolutionyesTextMutationResolution
resolution.rangeTextMutationRangeyesTextMutationRange
resolution.range.fromintegeryes
resolution.range.tointegeryes
resolution.requestedTargetTextAddressnoTextAddress
resolution.requestedTarget.blockIdstringno
resolution.requestedTarget.kind"text"noConstant: "text"
resolution.requestedTarget.rangeRangenoRange
resolution.requestedTarget.range.endintegerno
resolution.requestedTarget.range.startintegerno
resolution.targetTextAddressyesTextAddress
resolution.target.blockIdstringyes
resolution.target.kind"text"yesConstant: "text"
resolution.target.rangeRangeyesRange
resolution.target.range.endintegeryes
resolution.target.range.startintegeryes
resolution.textstringyes
successtrueyesConstant: true
updatedEntityAddress[]no

Variant 2 (resolution.requestedTarget.kind=“text”)

FieldTypeRequiredDescription
failureobjectyes
failure.codeenumyes"INVALID_TARGET"
failure.detailsanyno
failure.messagestringyes
resolutionTextMutationResolutionyesTextMutationResolution
resolution.rangeTextMutationRangeyesTextMutationRange
resolution.range.fromintegeryes
resolution.range.tointegeryes
resolution.requestedTargetTextAddressnoTextAddress
resolution.requestedTarget.blockIdstringno
resolution.requestedTarget.kind"text"noConstant: "text"
resolution.requestedTarget.rangeRangenoRange
resolution.requestedTarget.range.endintegerno
resolution.requestedTarget.range.startintegerno
resolution.targetTextAddressyesTextAddress
resolution.target.blockIdstringyes
resolution.target.kind"text"yesConstant: "text"
resolution.target.rangeRangeyesRange
resolution.target.range.endintegeryes
resolution.target.range.startintegeryes
resolution.textstringyes
successfalseyesConstant: false

Example response

{
  "inserted": [
    {
      "entityId": "entity-789",
      "entityType": "comment",
      "kind": "entity"
    }
  ],
  "resolution": {
    "range": {
      "from": 0,
      "to": 10
    },
    "requestedTarget": {
      "blockId": "block-abc123",
      "kind": "text",
      "range": {
        "end": 10,
        "start": 0
      }
    },
    "target": {
      "blockId": "block-abc123",
      "kind": "text",
      "range": {
        "end": 10,
        "start": 0
      }
    },
    "text": "Hello, world."
  },
  "success": true,
  "updated": [
    {
      "entityId": "entity-789",
      "entityType": "comment",
      "kind": "entity"
    }
  ]
}

Pre-apply throws

  • TARGET_NOT_FOUND
  • CAPABILITY_UNAVAILABLE
  • INVALID_TARGET
  • INVALID_INPUT

Non-applied failure codes

  • INVALID_TARGET

Raw schemas

{
  "additionalProperties": false,
  "properties": {
    "inline": {
      "additionalProperties": false,
      "minProperties": 1,
      "properties": {
        "bCs": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "bold": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "border": {
          "oneOf": [
            {
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "color": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "space": {
                  "oneOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "sz": {
                  "oneOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "val": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "caps": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "charScale": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "color": {
          "oneOf": [
            {
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "contextualAlternates": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "cs": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "dstrike": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "eastAsianLayout": {
          "oneOf": [
            {
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "combine": {
                  "oneOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "combineBrackets": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "id": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "vert": {
                  "oneOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "vertCompress": {
                  "oneOf": [
                    {
                      "type": "boolean"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "em": {
          "oneOf": [
            {
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "emboss": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "fitText": {
          "oneOf": [
            {
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "id": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "val": {
                  "oneOf": [
                    {
                      "type": "number"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "fontFamily": {
          "oneOf": [
            {
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "fontSize": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "fontSizeCs": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "highlight": {
          "oneOf": [
            {
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "iCs": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "imprint": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "italic": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "kerning": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "lang": {
          "oneOf": [
            {
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "bidi": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "eastAsia": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "val": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "letterSpacing": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "ligatures": {
          "oneOf": [
            {
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "numForm": {
          "oneOf": [
            {
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "numSpacing": {
          "oneOf": [
            {
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "oMath": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "outline": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "position": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "rFonts": {
          "oneOf": [
            {
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "ascii": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "asciiTheme": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "cs": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "csTheme": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "eastAsia": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "eastAsiaTheme": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "hAnsi": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "hAnsiTheme": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "hint": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "rStyle": {
          "oneOf": [
            {
              "minLength": 1,
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "rtl": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "shading": {
          "oneOf": [
            {
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "color": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "fill": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "val": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "type": "object"
            },
            {
              "type": "null"
            }
          ]
        },
        "shadow": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "smallCaps": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "snapToGrid": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "specVanish": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "strike": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "stylisticSets": {
          "oneOf": [
            {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "id": {
                    "type": "number"
                  },
                  "val": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "id"
                ],
                "type": "object"
              },
              "minItems": 1,
              "type": "array"
            },
            {
              "type": "null"
            }
          ]
        },
        "underline": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            },
            {
              "additionalProperties": false,
              "minProperties": 1,
              "properties": {
                "color": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "style": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "themeColor": {
                  "oneOf": [
                    {
                      "minLength": 1,
                      "type": "string"
                    },
                    {
                      "type": "null"
                    }
                  ]
                }
              },
              "type": "object"
            }
          ]
        },
        "vanish": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        "vertAlign": {
          "oneOf": [
            {
              "enum": [
                "superscript",
                "subscript",
                "baseline"
              ]
            },
            {
              "type": "null"
            }
          ]
        },
        "webHidden": {
          "oneOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object"
    },
    "target": {
      "$ref": "#/$defs/TextAddress"
    }
  },
  "required": [
    "target",
    "inline"
  ],
  "type": "object"
}
{
  "oneOf": [
    {
      "$ref": "#/$defs/TextMutationSuccess"
    },
    {
      "additionalProperties": false,
      "properties": {
        "failure": {
          "additionalProperties": false,
          "properties": {
            "code": {
              "enum": [
                "INVALID_TARGET"
              ]
            },
            "details": {},
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object"
        },
        "resolution": {
          "$ref": "#/$defs/TextMutationResolution"
        },
        "success": {
          "const": false
        }
      },
      "required": [
        "success",
        "failure",
        "resolution"
      ],
      "type": "object"
    }
  ]
}
{
  "$ref": "#/$defs/TextMutationSuccess"
}
{
  "additionalProperties": false,
  "properties": {
    "failure": {
      "additionalProperties": false,
      "properties": {
        "code": {
          "enum": [
            "INVALID_TARGET"
          ]
        },
        "details": {},
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "resolution": {
      "$ref": "#/$defs/TextMutationResolution"
    },
    "success": {
      "const": false
    }
  },
  "required": [
    "success",
    "failure",
    "resolution"
  ],
  "type": "object"
}