# lists.create

> Create a new list from one or more paragraphs. Supports optional preset or style for new sequences. When sequence.mode is "continuePrevious", preset and style are not allowed: the new items inherit formatting from the previous sequence.



- Member path: `doc.lists.create(…)`
- Mutates document: yes
- Idempotency: `non-idempotent`
- Supports tracked mode: no
- Supports dry run: yes

## Expected result

Returns a ListsCreateResult with the new listId and the first item address.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "BlockAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "block"
        },
        "nodeType": {
          "const": "paragraph"
        },
        "nodeId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "nodeType",
        "nodeId"
      ]
    },
    "BlockAddressOrRange": {
      "oneOf": [
        {
          "$ref": "#/$defs/BlockAddress"
        },
        {
          "$ref": "#/$defs/BlockRange"
        }
      ]
    },
    "BlockRange": {
      "type": "object",
      "properties": {
        "from": {
          "$ref": "#/$defs/BlockAddress"
        },
        "to": {
          "$ref": "#/$defs/BlockAddress"
        }
      },
      "additionalProperties": false,
      "required": [
        "from",
        "to"
      ]
    }
  },
  "type": "object",
  "properties": {
    "mode": {
      "enum": [
        "empty",
        "fromParagraphs"
      ],
      "description": "Required. 'fromParagraphs' converts existing paragraphs into list items: each paragraph becomes one item, so create one paragraph per item first. 'empty' creates a new empty list at 'at'."
    },
    "at": {
      "$ref": "#/$defs/BlockAddress",
      "description": "Required when mode is 'empty'. The paragraph to create the list at. Format: {kind:'block', nodeType:'paragraph', nodeId:'<id>'}."
    },
    "target": {
      "$ref": "#/$defs/BlockAddressOrRange",
      "description": "Required when mode is 'fromParagraphs'. Each call converts ONE paragraph into a list item. To make a list with N items, create N separate paragraphs first, then call superdoc_list create for EACH one. Format: {kind:'block', nodeType:'paragraph', nodeId:'<id>'}."
    },
    "kind": {
      "enum": [
        "ordered",
        "bullet"
      ],
      "description": "List type: 'bullet' for bullet points, 'ordered' for numbered lists."
    },
    "level": {
      "type": "integer",
      "minimum": 0,
      "maximum": 8,
      "description": "List nesting level (0-8). 0 is the top level."
    },
    "preset": {
      "enum": [
        "decimal",
        "decimalParenthesis",
        "lowerLetter",
        "lowerLetterParenthesis",
        "upperLetter",
        "upperLetterParenthesis",
        "lowerRoman",
        "upperRoman",
        "disc",
        "circle",
        "square",
        "dash"
      ],
      "description": "Predefined list style preset. Overrides 'kind' with a specific numbering or bullet format."
    },
    "style": {
      "type": "object",
      "properties": {
        "version": {
          "const": 1
        },
        "levels": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "level": {
                "type": "integer",
                "minimum": 0,
                "maximum": 8
              },
              "numFmt": {
                "type": "string"
              },
              "lvlText": {
                "type": "string"
              },
              "start": {
                "type": "integer"
              },
              "alignment": {
                "enum": [
                  "left",
                  "center",
                  "right"
                ]
              },
              "indents": {
                "type": "object",
                "properties": {
                  "left": {
                    "type": "integer"
                  },
                  "hanging": {
                    "type": "integer"
                  },
                  "firstLine": {
                    "type": "integer"
                  }
                },
                "additionalProperties": false
              },
              "trailingCharacter": {
                "enum": [
                  "tab",
                  "space",
                  "nothing"
                ]
              },
              "markerFont": {
                "type": "string"
              },
              "pictureBulletId": {
                "type": "integer"
              },
              "tabStopAt": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            },
            "additionalProperties": false,
            "required": [
              "level"
            ]
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "version",
        "levels"
      ]
    },
    "sequence": {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "mode": {
              "const": "new"
            },
            "startAt": {
              "type": "integer",
              "minimum": 1
            }
          },
          "additionalProperties": false,
          "required": [
            "mode"
          ]
        },
        {
          "type": "object",
          "properties": {
            "mode": {
              "const": "continuePrevious"
            }
          },
          "additionalProperties": false,
          "required": [
            "mode"
          ]
        }
      ]
    }
  },
  "required": [
    "mode"
  ],
  "additionalProperties": false,
  "allOf": [
    {
      "if": {
        "properties": {
          "mode": {
            "const": "empty"
          }
        }
      },
      "then": {
        "required": [
          "mode",
          "at"
        ]
      },
      "else": {
        "required": [
          "mode",
          "target"
        ]
      }
    },
    {
      "if": {
        "properties": {
          "sequence": {
            "properties": {
              "mode": {
                "const": "continuePrevious"
              }
            },
            "required": [
              "mode"
            ]
          }
        },
        "required": [
          "sequence"
        ]
      },
      "then": {
        "not": {
          "anyOf": [
            {
              "required": [
                "preset"
              ]
            },
            {
              "required": [
                "style"
              ]
            }
          ]
        }
      }
    }
  ]
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {
    "ListItemAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "block"
        },
        "nodeType": {
          "const": "listItem"
        },
        "nodeId": {
          "type": "string"
        },
        "story": {
          "$ref": "#/$defs/StoryLocator"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "nodeType",
        "nodeId"
      ]
    },
    "StoryLocator": {
      "description": "Story scope. Defaults to document body when omitted. Use {kind:'story', storyType:'body'} for body, or other storyType values for headers, footers, footnotes, endnotes.",
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "body"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "headerFooterSlot"
            },
            "section": {
              "$ref": "#/$defs/SectionAddress"
            },
            "headerFooterKind": {
              "enum": [
                "header",
                "footer"
              ]
            },
            "variant": {
              "enum": [
                "default",
                "first",
                "even"
              ]
            },
            "resolution": {
              "enum": [
                "effective",
                "explicit"
              ]
            },
            "onWrite": {
              "enum": [
                "materializeIfInherited",
                "editResolvedPart",
                "error"
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "section",
            "headerFooterKind",
            "variant"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "headerFooterPart"
            },
            "refId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "refId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "footnote"
            },
            "noteId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "noteId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "endnote"
            },
            "noteId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "noteId"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "story"
            },
            "storyType": {
              "const": "textbox"
            },
            "textboxId": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "storyType",
            "textboxId"
          ]
        }
      ]
    },
    "SectionAddress": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "section"
        },
        "sectionId": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "sectionId"
      ]
    }
  },
  "oneOf": [
    {
      "type": "object",
      "properties": {
        "success": {
          "const": true
        },
        "listId": {
          "type": "string"
        },
        "item": {
          "$ref": "#/$defs/ListItemAddress"
        }
      },
      "additionalProperties": false,
      "required": [
        "success",
        "listId",
        "item"
      ]
    },
    {
      "type": "object",
      "properties": {
        "success": {
          "const": false
        },
        "failure": {
          "type": "object",
          "properties": {
            "code": {
              "enum": [
                "INVALID_TARGET",
                "LEVEL_OUT_OF_RANGE",
                "INVALID_INPUT",
                "NO_COMPATIBLE_PREVIOUS"
              ]
            },
            "message": {
              "type": "string"
            },
            "details": {}
          },
          "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

- `INVALID_TARGET`
- `LEVEL_OUT_OF_RANGE`
- `INVALID_INPUT`
- `NO_COMPATIBLE_PREVIOUS`

