> ## 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.

# plan.execute

> Execute a compiled batch of plan-safe operation entries with per-entry transactions, capture resolution between entries, and keep-prefix-and-continue failure semantics.

## Summary

Execute a compiled batch of plan-safe operation entries with per-entry transactions, capture resolution between entries, and keep-prefix-and-continue failure semantics.

* Operation ID: `plan.execute`
* API member path: `editor.doc.plan.execute(...)`
* Mutates document: `yes`
* Idempotency: `non-idempotent`
* Supports tracked mode: `no`
* Supports dry run: `no`
* Deterministic target resolution: `yes`

## Expected result

Returns a PlanExecuteResult with per-entry receipts, projected captures, and the first hard failure if any.

## Input fields

| Field            | Type               | Required | Description              |
| ---------------- | ------------------ | -------- | ------------------------ |
| `captureReturns` | `"*"` \| string\[] | no       | One of: `"*"`, string\[] |
| `entries`        | object\[]          | yes      |                          |

### Example request

```json theme={null}
{
  "captureReturns": "*",
  "entries": [
    {
      "input": {},
      "operationId": "example",
      "options": {}
    }
  ]
}
```

## Output fields

| Field                 | Type      | Required | Description |
| --------------------- | --------- | -------- | ----------- |
| `captures`            | object    | yes      |             |
| `failure`             | object    | no       |             |
| `failure.entryIndex`  | integer   | no       |             |
| `failure.message`     | string    | no       |             |
| `failure.operationId` | string    | no       |             |
| `receipts`            | object\[] | yes      |             |

### Example response

```json theme={null}
{
  "captures": {},
  "failure": {
    "entryIndex": 1,
    "message": "Operation failed.",
    "operationId": "example"
  },
  "receipts": [
    {
      "captureAs": "example",
      "entryIndex": 1,
      "error": "example",
      "operationId": "example",
      "status": "passed"
    }
  ]
}
```

## Pre-apply throws

* `INVALID_INPUT`
* `CAPABILITY_UNAVAILABLE`

## Non-applied failure codes

* None

## Raw schemas

<Accordion title="Raw input schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "captureReturns": {
        "oneOf": [
          {
            "const": "*"
          },
          {
            "items": {
              "type": "string"
            },
            "type": "array"
          }
        ]
      },
      "entries": {
        "items": {
          "additionalProperties": false,
          "properties": {
            "captureAs": {
              "type": "string"
            },
            "expect": {
              "additionalProperties": false,
              "properties": {
                "allowFailureMessageIncludes": {
                  "type": "string"
                },
                "failureCode": {
                  "type": "string"
                },
                "failureMessageIncludes": {
                  "type": "string"
                },
                "success": {
                  "type": "boolean"
                }
              },
              "type": "object"
            },
            "input": {},
            "operationId": {
              "type": "string"
            },
            "options": {}
          },
          "required": [
            "operationId"
          ],
          "type": "object"
        },
        "type": "array"
      }
    },
    "required": [
      "entries"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw output schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "captures": {
        "type": "object"
      },
      "failure": {
        "additionalProperties": false,
        "properties": {
          "entryIndex": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "operationId": {
            "type": "string"
          }
        },
        "required": [
          "entryIndex",
          "operationId",
          "message"
        ],
        "type": "object"
      },
      "receipts": {
        "items": {
          "additionalProperties": false,
          "properties": {
            "captureAs": {
              "type": [
                "string",
                "null"
              ]
            },
            "entryIndex": {
              "type": "integer"
            },
            "error": {
              "type": "string"
            },
            "operationId": {
              "type": "string"
            },
            "status": {
              "enum": [
                "passed",
                "allowed-failure",
                "expected-failure"
              ]
            }
          },
          "required": [
            "entryIndex",
            "operationId",
            "status",
            "captureAs"
          ],
          "type": "object"
        },
        "type": "array"
      }
    },
    "required": [
      "receipts",
      "captures"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw success schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "captures": {
        "type": "object"
      },
      "failure": {
        "additionalProperties": false,
        "properties": {
          "entryIndex": {
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "operationId": {
            "type": "string"
          }
        },
        "required": [
          "entryIndex",
          "operationId",
          "message"
        ],
        "type": "object"
      },
      "receipts": {
        "items": {
          "additionalProperties": false,
          "properties": {
            "captureAs": {
              "type": [
                "string",
                "null"
              ]
            },
            "entryIndex": {
              "type": "integer"
            },
            "error": {
              "type": "string"
            },
            "operationId": {
              "type": "string"
            },
            "status": {
              "enum": [
                "passed",
                "allowed-failure",
                "expected-failure"
              ]
            }
          },
          "required": [
            "entryIndex",
            "operationId",
            "status",
            "captureAs"
          ],
          "type": "object"
        },
        "type": "array"
      }
    },
    "required": [
      "receipts",
      "captures"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw failure schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "failure": {
        "additionalProperties": false,
        "properties": {
          "code": {
            "enum": [
              "INVALID_INPUT",
              "CAPABILITY_UNAVAILABLE"
            ]
          },
          "details": {},
          "message": {
            "type": "string"
          }
        },
        "required": [
          "code",
          "message"
        ],
        "type": "object"
      },
      "success": {
        "const": false
      }
    },
    "required": [
      "success",
      "failure"
    ],
    "type": "object"
  }
  ```
</Accordion>
