# diff.capture

> Capture the current document's diffable state as a versioned snapshot. v2 capture requires source-complete state and reports coverage for body, comments, styles, numbering, and header/footers, with extended family coverage carried in the opaque payload. Legacy body-only v2 artifacts remain accepted for compare/apply compatibility.



- Member path: `doc.diff.capture(…)`
- Mutates document: no
- Idempotency: `idempotent`
- Supports tracked mode: no
- Supports dry run: no

## Expected result

Returns a DiffSnapshot with a fingerprint and opaque payload.

## Input schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {},
  "type": "object",
  "properties": {},
  "additionalProperties": false
}
```

## Output schema

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$defs": {},
  "type": "object",
  "properties": {
    "version": {
      "type": "string",
      "enum": [
        "sd-diff-snapshot/v1",
        "sd-diff-snapshot/v2"
      ]
    },
    "engine": {
      "type": "string",
      "enum": [
        "superdoc-v2"
      ]
    },
    "fingerprint": {
      "type": "string"
    },
    "coverage": {
      "type": "object",
      "properties": {
        "body": {
          "type": "boolean",
          "const": true
        },
        "comments": {
          "type": "boolean"
        },
        "styles": {
          "type": "boolean"
        },
        "numbering": {
          "type": "boolean"
        },
        "headerFooters": {
          "type": "boolean"
        }
      },
      "additionalProperties": false,
      "required": [
        "body",
        "comments",
        "styles",
        "numbering",
        "headerFooters"
      ]
    },
    "payload": {
      "type": "object",
      "description": "Opaque engine-owned snapshot data."
    }
  },
  "additionalProperties": false,
  "required": [
    "version",
    "engine",
    "fingerprint",
    "coverage",
    "payload"
  ]
}
```

## Pre-apply throws

- `PRECONDITION_FAILED`

## Non-applied receipt codes

- None

