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

Summary

Convert non-list paragraphs to list items under an existing list sequence.
  • Operation ID: lists.attach
  • API member path: editor.doc.lists.attach(...)
  • Mutates document: yes
  • Idempotency: conditional
  • Supports tracked mode: no
  • Supports dry run: yes
  • Deterministic target resolution: yes

Expected result

Returns a ListsMutateItemResult confirming attachment.

Input fields

FieldTypeRequiredDescription
attachToListItemAddressyesListItemAddress
attachTo.kind"block"yesConstant: "block"
attachTo.nodeIdstringyes
attachTo.nodeType"listItem"yesConstant: "listItem"
levelintegerno
targetBlockAddressOrRangeyesBlockAddressOrRange

Example request

{
  "attachTo": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "listItem"
  },
  "level": 1,
  "target": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "paragraph"
  }
}

Output fields

Variant 1 (item.kind=“block”)

FieldTypeRequiredDescription
itemListItemAddressyesListItemAddress
item.kind"block"yesConstant: "block"
item.nodeIdstringyes
item.nodeType"listItem"yesConstant: "listItem"
successtrueyesConstant: true

Variant 2 (success=false)

FieldTypeRequiredDescription
failureobjectyes
failure.codeenumyes"INVALID_TARGET", "NO_OP"
failure.detailsanyno
failure.messagestringyes
successfalseyesConstant: false

Example response

{
  "item": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "listItem"
  },
  "success": true
}

Pre-apply throws

  • TARGET_NOT_FOUND
  • CAPABILITY_UNAVAILABLE
  • INVALID_TARGET

Non-applied failure codes

  • INVALID_TARGET
  • NO_OP

Raw schemas

{
  "additionalProperties": false,
  "properties": {
    "attachTo": {
      "$ref": "#/$defs/ListItemAddress"
    },
    "level": {
      "maximum": 8,
      "minimum": 0,
      "type": "integer"
    },
    "target": {
      "$ref": "#/$defs/BlockAddressOrRange"
    }
  },
  "required": [
    "target",
    "attachTo"
  ],
  "type": "object"
}
{
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "item": {
          "$ref": "#/$defs/ListItemAddress"
        },
        "success": {
          "const": true
        }
      },
      "required": [
        "success",
        "item"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "failure": {
          "additionalProperties": false,
          "properties": {
            "code": {
              "enum": [
                "INVALID_TARGET",
                "NO_OP"
              ]
            },
            "details": {},
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object"
        },
        "success": {
          "const": false
        }
      },
      "required": [
        "success",
        "failure"
      ],
      "type": "object"
    }
  ]
}
{
  "additionalProperties": false,
  "properties": {
    "item": {
      "$ref": "#/$defs/ListItemAddress"
    },
    "success": {
      "const": true
    }
  },
  "required": [
    "success",
    "item"
  ],
  "type": "object"
}
{
  "additionalProperties": false,
  "properties": {
    "failure": {
      "additionalProperties": false,
      "properties": {
        "code": {
          "enum": [
            "INVALID_TARGET",
            "NO_OP"
          ]
        },
        "details": {},
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "success": {
      "const": false
    }
  },
  "required": [
    "success",
    "failure"
  ],
  "type": "object"
}