> ## Documentation Index
> Fetch the complete documentation index at: https://superdoc-caio-pizzol-docs-ai-core-preset.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# headerFooters.refs.set

> Set an explicit header/footer reference on a section slot.

## Summary

Set an explicit header/footer reference on a section slot.

* Operation ID: `headerFooters.refs.set`
* API member path: `editor.doc.headerFooters.refs.set(...)`
* Mutates document: `yes`
* Idempotency: `conditional`
* Supports tracked mode: `no`
* Supports dry run: `yes`
* Deterministic target resolution: `yes`

## Expected result

Returns a SectionMutationResult receipt; reports NO\_OP if the reference already matches, INVALID\_TARGET if the relationship does not exist.

## Input fields

| Field                      | Type                            | Required | Description                      |
| -------------------------- | ------------------------------- | -------- | -------------------------------- |
| `refId`                    | string                          | yes      |                                  |
| `target`                   | object(kind="headerFooterSlot") | yes      |                                  |
| `target.headerFooterKind`  | enum                            | yes      | `"header"`, `"footer"`           |
| `target.kind`              | `"headerFooterSlot"`            | yes      | Constant: `"headerFooterSlot"`   |
| `target.section`           | SectionAddress                  | yes      | SectionAddress                   |
| `target.section.kind`      | `"section"`                     | yes      | Constant: `"section"`            |
| `target.section.sectionId` | string                          | yes      |                                  |
| `target.variant`           | enum                            | yes      | `"default"`, `"first"`, `"even"` |

### Example request

```json theme={null}
{
  "refId": "example",
  "target": {
    "headerFooterKind": "header",
    "kind": "headerFooterSlot",
    "section": {
      "kind": "section",
      "sectionId": "example"
    },
    "variant": "default"
  }
}
```

## Output fields

### Variant 1 (success=true)

| Field               | Type           | Required | Description           |
| ------------------- | -------------- | -------- | --------------------- |
| `section`           | SectionAddress | yes      | SectionAddress        |
| `section.kind`      | `"section"`    | yes      | Constant: `"section"` |
| `section.sectionId` | string         | yes      |                       |
| `success`           | `true`         | yes      | Constant: `true`      |

### Variant 2 (success=false)

| Field             | Type    | Required | Description                                               |
| ----------------- | ------- | -------- | --------------------------------------------------------- |
| `failure`         | object  | yes      |                                                           |
| `failure.code`    | enum    | yes      | `"NO_OP"`, `"INVALID_TARGET"`, `"CAPABILITY_UNAVAILABLE"` |
| `failure.details` | any     | no       |                                                           |
| `failure.message` | string  | yes      |                                                           |
| `success`         | `false` | yes      | Constant: `false`                                         |

### Example response

```json theme={null}
{
  "section": {
    "kind": "section",
    "sectionId": "example"
  },
  "success": true
}
```

## Pre-apply throws

* `TARGET_NOT_FOUND`
* `INVALID_TARGET`
* `INVALID_INPUT`
* `CAPABILITY_UNAVAILABLE`
* `INTERNAL_ERROR`

## Non-applied failure codes

* `NO_OP`
* `INVALID_TARGET`
* `CAPABILITY_UNAVAILABLE`

## Raw schemas

<Accordion title="Raw input schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "refId": {
        "minLength": 1,
        "type": "string"
      },
      "target": {
        "additionalProperties": false,
        "properties": {
          "headerFooterKind": {
            "enum": [
              "header",
              "footer"
            ]
          },
          "kind": {
            "const": "headerFooterSlot"
          },
          "section": {
            "$ref": "#/$defs/SectionAddress"
          },
          "variant": {
            "enum": [
              "default",
              "first",
              "even"
            ]
          }
        },
        "required": [
          "kind",
          "section",
          "headerFooterKind",
          "variant"
        ],
        "type": "object"
      }
    },
    "required": [
      "target",
      "refId"
    ],
    "type": "object"
  }
  ```
</Accordion>

<Accordion title="Raw output schema">
  ```json theme={null}
  {
    "oneOf": [
      {
        "additionalProperties": false,
        "properties": {
          "section": {
            "$ref": "#/$defs/SectionAddress"
          },
          "success": {
            "const": true
          }
        },
        "required": [
          "success",
          "section"
        ],
        "type": "object"
      },
      {
        "additionalProperties": false,
        "properties": {
          "failure": {
            "additionalProperties": false,
            "properties": {
              "code": {
                "enum": [
                  "NO_OP",
                  "INVALID_TARGET",
                  "CAPABILITY_UNAVAILABLE"
                ]
              },
              "details": {},
              "message": {
                "type": "string"
              }
            },
            "required": [
              "code",
              "message"
            ],
            "type": "object"
          },
          "success": {
            "const": false
          }
        },
        "required": [
          "success",
          "failure"
        ],
        "type": "object"
      }
    ]
  }
  ```
</Accordion>

<Accordion title="Raw success schema">
  ```json theme={null}
  {
    "additionalProperties": false,
    "properties": {
      "section": {
        "$ref": "#/$defs/SectionAddress"
      },
      "success": {
        "const": true
      }
    },
    "required": [
      "success",
      "section"
    ],
    "type": "object"
  }
  ```
</Accordion>

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