> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superdoc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# format.paragraph.setSpacing

> Set paragraph spacing properties (before, after, line, lineRule) in twips.

## Summary

Set paragraph spacing properties (before, after, line, lineRule) in twips.

* Operation ID: `format.paragraph.setSpacing`
* API member path: `editor.doc.format.paragraph.setSpacing(...)`
* Mutates document: `yes`
* Idempotency: `conditional`
* Supports tracked mode: `yes`
* Supports dry run: `yes`
* Deterministic target resolution: `yes`

## Expected result

Returns a ParagraphMutationResult; reports NO\_OP if spacing already matches.

## Input fields

### Variant 1 (required: before)

| Field | Type | Required | Description |
| - | - | - | - |
| `before` | integer | yes | |
| `target` | ParagraphAddress \| HeadingAddress \| ListItemAddress | yes | One of: ParagraphAddress, HeadingAddress, ListItemAddress |

### Variant 2 (required: after)

| Field | Type | Required | Description |
| - | - | - | - |
| `after` | integer | yes | |
| `target` | ParagraphAddress \| HeadingAddress \| ListItemAddress | yes | One of: ParagraphAddress, HeadingAddress, ListItemAddress |

### Variant 3 (required: line)

| Field | Type | Required | Description |
| - | - | - | - |
| `line` | integer | yes | |
| `target` | ParagraphAddress \| HeadingAddress \| ListItemAddress | yes | One of: ParagraphAddress, HeadingAddress, ListItemAddress |

### Variant 4 (required: lineRule)

| Field | Type | Required | Description |
| - | - | - | - |
| `lineRule` | enum | yes | `"auto"`, `"exact"`, `"atLeast"` |
| `target` | ParagraphAddress \| HeadingAddress \| ListItemAddress | yes | One of: ParagraphAddress, HeadingAddress, ListItemAddress |

### Example request

```json theme={null}
{
  "before": 1,
  "target": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "paragraph",
    "story": {
      "kind": "story",
      "storyType": "body"
    }
  }
}
```

## Output fields

### Variant 1 (success=true)

| Field | Type | Required | Description |
| - | - | - | - |
| `resolution` | object | yes | |
| `resolution.target` | ParagraphAddress \| HeadingAddress \| ListItemAddress | yes | One of: ParagraphAddress, HeadingAddress, ListItemAddress |
| `success` | `true` | yes | Constant: `true` |
| `target` | ParagraphAddress \| HeadingAddress \| ListItemAddress | yes | One of: ParagraphAddress, HeadingAddress, ListItemAddress |

### Variant 2 (success=false)

| Field | Type | Required | Description |
| - | - | - | - |
| `failure` | object | yes | |
| `failure.code` | enum | yes | `"NO_OP"` |
| `failure.details` | any | no | |
| `failure.message` | string | yes | |
| `resolution` | object | no | |
| `resolution.target` | ParagraphAddress \| HeadingAddress \| ListItemAddress | no | One of: ParagraphAddress, HeadingAddress, ListItemAddress |
| `success` | `false` | yes | Constant: `false` |

### Example response

```json theme={null}
{
  "resolution": {
    "target": {
      "kind": "block",
      "nodeId": "node-def456",
      "nodeType": "paragraph",
      "story": {
        "kind": "story",
        "storyType": "body"
      }
    }
  },
  "success": true,
  "target": {
    "kind": "block",
    "nodeId": "node-def456",
    "nodeType": "paragraph",
    "story": {
      "kind": "story",
      "storyType": "body"
    }
  }
}
```

## Pre-apply throws

* `TARGET_NOT_FOUND`
* `INVALID_TARGET`
* `CAPABILITY_UNAVAILABLE`

## Non-applied failure codes

* `NO_OP`

## Raw schemas

> [accordion] Raw input schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "anyOf": [
>     {
>       "required": [
>         "before"
>       ]
>     },
>     {
>       "required": [
>         "after"
>       ]
>     },
>     {
>       "required": [
>         "line"
>       ]
>     },
>     {
>       "required": [
>         "lineRule"
>       ]
>     }
>   ],
>   "if": {
>     "required": [
>       "line"
>     ]
>   },
>   "properties": {
>     "after": {
>       "description": "Space after paragraph in twips (20 twips = 1pt).",
>       "minimum": 0,
>       "type": "integer"
>     },
>     "before": {
>       "description": "Space before paragraph in twips (20 twips = 1pt).",
>       "minimum": 0,
>       "type": "integer"
>     },
>     "line": {
>       "description": "Line spacing value. Meaning depends on lineRule. Must be provided together with lineRule.",
>       "minimum": 1,
>       "type": "integer"
>     },
>     "lineRule": {
>       "description": "Line spacing rule. Required when 'line' is set.",
>       "enum": [
>         "auto",
>         "exact",
>         "atLeast"
>       ]
>     },
>     "target": {
>       "oneOf": [
>         {
>           "$ref": "#/$defs/ParagraphAddress"
>         },
>         {
>           "$ref": "#/$defs/HeadingAddress"
>         },
>         {
>           "$ref": "#/$defs/ListItemAddress"
>         }
>       ]
>     }
>   },
>   "required": [
>     "target"
>   ],
>   "then": {
>     "required": [
>       "lineRule"
>     ]
>   },
>   "type": "object"
> }
> ```

> [accordion] Raw output schema
>
> ```json theme={null}
> {
>   "oneOf": [
>     {
>       "additionalProperties": false,
>       "properties": {
>         "resolution": {
>           "additionalProperties": false,
>           "properties": {
>             "target": {
>               "oneOf": [
>                 {
>                   "$ref": "#/$defs/ParagraphAddress"
>                 },
>                 {
>                   "$ref": "#/$defs/HeadingAddress"
>                 },
>                 {
>                   "$ref": "#/$defs/ListItemAddress"
>                 }
>               ]
>             }
>           },
>           "required": [
>             "target"
>           ],
>           "type": "object"
>         },
>         "success": {
>           "const": true
>         },
>         "target": {
>           "oneOf": [
>             {
>               "$ref": "#/$defs/ParagraphAddress"
>             },
>             {
>               "$ref": "#/$defs/HeadingAddress"
>             },
>             {
>               "$ref": "#/$defs/ListItemAddress"
>             }
>           ]
>         }
>       },
>       "required": [
>         "success",
>         "target",
>         "resolution"
>       ],
>       "type": "object"
>     },
>     {
>       "additionalProperties": false,
>       "properties": {
>         "failure": {
>           "additionalProperties": false,
>           "properties": {
>             "code": {
>               "enum": [
>                 "NO_OP"
>               ]
>             },
>             "details": {},
>             "message": {
>               "type": "string"
>             }
>           },
>           "required": [
>             "code",
>             "message"
>           ],
>           "type": "object"
>         },
>         "resolution": {
>           "additionalProperties": false,
>           "properties": {
>             "target": {
>               "oneOf": [
>                 {
>                   "$ref": "#/$defs/ParagraphAddress"
>                 },
>                 {
>                   "$ref": "#/$defs/HeadingAddress"
>                 },
>                 {
>                   "$ref": "#/$defs/ListItemAddress"
>                 }
>               ]
>             }
>           },
>           "required": [
>             "target"
>           ],
>           "type": "object"
>         },
>         "success": {
>           "const": false
>         }
>       },
>       "required": [
>         "success",
>         "failure"
>       ],
>       "type": "object"
>     }
>   ]
> }
> ```

> [accordion] Raw success schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "resolution": {
>       "additionalProperties": false,
>       "properties": {
>         "target": {
>           "oneOf": [
>             {
>               "$ref": "#/$defs/ParagraphAddress"
>             },
>             {
>               "$ref": "#/$defs/HeadingAddress"
>             },
>             {
>               "$ref": "#/$defs/ListItemAddress"
>             }
>           ]
>         }
>       },
>       "required": [
>         "target"
>       ],
>       "type": "object"
>     },
>     "success": {
>       "const": true
>     },
>     "target": {
>       "oneOf": [
>         {
>           "$ref": "#/$defs/ParagraphAddress"
>         },
>         {
>           "$ref": "#/$defs/HeadingAddress"
>         },
>         {
>           "$ref": "#/$defs/ListItemAddress"
>         }
>       ]
>     }
>   },
>   "required": [
>     "success",
>     "target",
>     "resolution"
>   ],
>   "type": "object"
> }
> ```

> [accordion] Raw failure schema
>
> ```json theme={null}
> {
>   "additionalProperties": false,
>   "properties": {
>     "failure": {
>       "additionalProperties": false,
>       "properties": {
>         "code": {
>           "enum": [
>             "NO_OP"
>           ]
>         },
>         "details": {},
>         "message": {
>           "type": "string"
>         }
>       },
>       "required": [
>         "code",
>         "message"
>       ],
>       "type": "object"
>     },
>     "resolution": {
>       "additionalProperties": false,
>       "properties": {
>         "target": {
>           "oneOf": [
>             {
>               "$ref": "#/$defs/ParagraphAddress"
>             },
>             {
>               "$ref": "#/$defs/HeadingAddress"
>             },
>             {
>               "$ref": "#/$defs/ListItemAddress"
>             }
>           ]
>         }
>       },
>       "required": [
>         "target"
>       ],
>       "type": "object"
>     },
>     "success": {
>       "const": false
>     }
>   },
>   "required": [
>     "success",
>     "failure"
>   ],
>   "type": "object"
> }
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.