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

Summary

Capture the formatting of a list as a reusable ListTemplate.
  • Operation ID: lists.captureTemplate
  • API member path: editor.doc.lists.captureTemplate(...)
  • Mutates document: no
  • Idempotency: idempotent
  • Supports tracked mode: no
  • Supports dry run: no
  • Deterministic target resolution: yes

Expected result

Returns a ListsCaptureTemplateResult containing the captured template.

Input fields

FieldTypeRequiredDescription
levelsinteger[]no
targetListItemAddressyesListItemAddress
target.kind"block"yesConstant: "block"
target.nodeIdstringyes
target.nodeType"listItem"yesConstant: "listItem"

Example request

{
  "levels": [
    1
  ],
  "target": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "listItem"
  }
}

Output fields

Variant 1 (success=true)

FieldTypeRequiredDescription
successtrueyesConstant: true
templateobjectyes
template.levelsobject[]yes
template.version1yesConstant: 1

Variant 2 (success=false)

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

Example response

{
  "success": true,
  "template": {
    "levels": [
      {
        "level": 1,
        "lvlText": "example",
        "numFmt": "example"
      }
    ],
    "version": 1
  }
}

Pre-apply throws

  • TARGET_NOT_FOUND
  • INVALID_TARGET
  • INVALID_INPUT

Non-applied failure codes

  • INVALID_TARGET
  • INVALID_INPUT
  • LEVEL_OUT_OF_RANGE

Raw schemas

{
  "additionalProperties": false,
  "properties": {
    "levels": {
      "items": {
        "maximum": 8,
        "minimum": 0,
        "type": "integer"
      },
      "type": "array"
    },
    "target": {
      "$ref": "#/$defs/ListItemAddress"
    }
  },
  "required": [
    "target"
  ],
  "type": "object"
}
{
  "oneOf": [
    {
      "additionalProperties": false,
      "properties": {
        "success": {
          "const": true
        },
        "template": {
          "additionalProperties": false,
          "properties": {
            "levels": {
              "items": {
                "additionalProperties": false,
                "properties": {
                  "alignment": {
                    "enum": [
                      "left",
                      "center",
                      "right"
                    ]
                  },
                  "indents": {
                    "additionalProperties": false,
                    "properties": {
                      "firstLine": {
                        "type": "integer"
                      },
                      "hanging": {
                        "type": "integer"
                      },
                      "left": {
                        "type": "integer"
                      }
                    },
                    "type": "object"
                  },
                  "level": {
                    "maximum": 8,
                    "minimum": 0,
                    "type": "integer"
                  },
                  "lvlText": {
                    "type": "string"
                  },
                  "markerFont": {
                    "type": "string"
                  },
                  "numFmt": {
                    "type": "string"
                  },
                  "pictureBulletId": {
                    "type": "integer"
                  },
                  "start": {
                    "type": "integer"
                  },
                  "trailingCharacter": {
                    "enum": [
                      "tab",
                      "space",
                      "nothing"
                    ]
                  }
                },
                "required": [
                  "level"
                ],
                "type": "object"
              },
              "type": "array"
            },
            "version": {
              "const": 1
            }
          },
          "required": [
            "version",
            "levels"
          ],
          "type": "object"
        }
      },
      "required": [
        "success",
        "template"
      ],
      "type": "object"
    },
    {
      "additionalProperties": false,
      "properties": {
        "failure": {
          "additionalProperties": false,
          "properties": {
            "code": {
              "enum": [
                "INVALID_TARGET",
                "INVALID_INPUT",
                "LEVEL_OUT_OF_RANGE"
              ]
            },
            "details": {},
            "message": {
              "type": "string"
            }
          },
          "required": [
            "code",
            "message"
          ],
          "type": "object"
        },
        "success": {
          "const": false
        }
      },
      "required": [
        "success",
        "failure"
      ],
      "type": "object"
    }
  ]
}
{
  "additionalProperties": false,
  "properties": {
    "success": {
      "const": true
    },
    "template": {
      "additionalProperties": false,
      "properties": {
        "levels": {
          "items": {
            "additionalProperties": false,
            "properties": {
              "alignment": {
                "enum": [
                  "left",
                  "center",
                  "right"
                ]
              },
              "indents": {
                "additionalProperties": false,
                "properties": {
                  "firstLine": {
                    "type": "integer"
                  },
                  "hanging": {
                    "type": "integer"
                  },
                  "left": {
                    "type": "integer"
                  }
                },
                "type": "object"
              },
              "level": {
                "maximum": 8,
                "minimum": 0,
                "type": "integer"
              },
              "lvlText": {
                "type": "string"
              },
              "markerFont": {
                "type": "string"
              },
              "numFmt": {
                "type": "string"
              },
              "pictureBulletId": {
                "type": "integer"
              },
              "start": {
                "type": "integer"
              },
              "trailingCharacter": {
                "enum": [
                  "tab",
                  "space",
                  "nothing"
                ]
              }
            },
            "required": [
              "level"
            ],
            "type": "object"
          },
          "type": "array"
        },
        "version": {
          "const": 1
        }
      },
      "required": [
        "version",
        "levels"
      ],
      "type": "object"
    }
  },
  "required": [
    "success",
    "template"
  ],
  "type": "object"
}
{
  "additionalProperties": false,
  "properties": {
    "failure": {
      "additionalProperties": false,
      "properties": {
        "code": {
          "enum": [
            "INVALID_TARGET",
            "INVALID_INPUT",
            "LEVEL_OUT_OF_RANGE"
          ]
        },
        "details": {},
        "message": {
          "type": "string"
        }
      },
      "required": [
        "code",
        "message"
      ],
      "type": "object"
    },
    "success": {
      "const": false
    }
  },
  "required": [
    "success",
    "failure"
  ],
  "type": "object"
}