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

# const

> Contract, placement, related fields and source examples for this Nika YAML field.

[Language reference](https://docs.nika.sh/reference/language/overview.md) / `const`

## Meaning and placement

### document

Named constants · `${{ const.X }}` · a fixed value baked into the workflow. Either a bare literal, or a `{ type, value }` typed constant whose `value:` MUST conform to `type:`. The literal half of the dead `vars:` block (R3a · LAW-SURFACE-0201) · everything that is not `required: true` lands here per the E-split total rule.

| Property | Declaration |
| - | - |
| Requirement | Optional in this object |
| Schema location | `/properties/const` |
| type | `"object"` |
| additionalProperties | declaration below |

<details>
  <summary>`additionalProperties` schema declaration (spec source, not a lesson)</summary>

  ```json theme={"system"}
  {
    "type": [
      "string",
      "number",
      "boolean",
      "array",
      "object",
      "null"
    ],
    "if": {
      "type": "object",
      "required": [
        "type",
        "value"
      ]
    },
    "then": {
      "additionalProperties": false,
      "properties": {
        "type": {
          "$ref": "#/$defs/typeExpr"
        },
        "value": {
          "description": "The constant value · MUST conform to `type:` (NIKA-DEFAULT-001)."
        },
        "description": {
          "description": "Free-form prose about this constant · why the value is what it is. Documentation only — the contract is `type` and `value`.",
          "type": "string"
        }
      },
      "$comment": "An object carrying BOTH `type` and `value` is a typed constant · the type speaks the full TypeExpr (R3b) and values_core checks the value against it (NIKA-DEFAULT-001) · an object missing either key is a bare literal object constant."
    }
  }
  ```
</details>

**In the same object:** [inputs](https://docs.nika.sh/reference/language/words/inputs.md) · [model](https://docs.nika.sh/reference/language/words/model.md) · [nika](https://docs.nika.sh/reference/language/words/nika.md) · [outputs](https://docs.nika.sh/reference/language/words/outputs.md) · [permits](https://docs.nika.sh/reference/language/words/permits.md) · [run](https://docs.nika.sh/reference/language/words/run.md) · [secrets](https://docs.nika.sh/reference/language/words/secrets.md) · [tasks](https://docs.nika.sh/reference/language/words/tasks.md)

[Schema source (use the pointer above)](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/schemas/workflow.schema.json)

## In a source template

Excerpt from `templates/aggregate-by-key.nika`, source lines 8–17. This is a fragment, not a runnable workflow.

```yaml illustration theme={"system"}
# Needs · fill the SLOT; no services or credentials for mock rehearsal.
# Run · nika run <file> --model mock/echo
nika: aggregate-by-key
const:
  currency: '<SLOT: the currency code>'
  records:
  - region: north
    amount: 10
  - region: south
    amount: 20
```

### Templates containing this field

| Template | Source |
| - | - |
| `templates/aggregate-by-key.nika` | [Line 11](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/aggregate-by-key.nika#L11) |
| `templates/api-upload-and-create.nika` | [Line 39](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/api-upload-and-create.nika#L39) |
| `templates/bounded-batch.nika` | [Line 14](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/bounded-batch.nika#L14) |
| `templates/chain.nika` | [Line 32](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/chain.nika#L32) |
| `templates/classify-and-route.nika` | [Line 19](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/classify-and-route.nika#L19) |
| `templates/corpus-qa.nika` | [Line 20](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/corpus-qa.nika#L20) |
| `templates/deduplicate-records.nika` | [Line 11](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/deduplicate-records.nika#L11) |
| `templates/document-to-fields.nika` | [Line 20](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/document-to-fields.nika#L20) |
| `templates/etl-state.nika` | [Line 50](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/etl-state.nika#L50) |
| `templates/evaluate-and-optimize.nika` | [Line 32](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/evaluate-and-optimize.nika#L32) |
| `templates/fanout.nika` | [Line 59](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/fanout.nika#L59) |
| `templates/gate-and-act.nika` | [Line 28](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/gate-and-act.nika#L28) |
| `templates/human-gated-ship.nika` | [Line 56](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/human-gated-ship.nika#L56) |
| `templates/media-asset-pack.nika` | [Line 33](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/media-asset-pack.nika#L33) |
| `templates/parallel-review.nika` | [Line 14](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/parallel-review.nika#L14) |
| `templates/project-public-fields.nika` | [Line 14](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/project-public-fields.nika#L14) |
| `templates/recover-optional-file.nika` | [Line 13](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/recover-optional-file.nika#L13) |
| `templates/snapshot-diff.nika` | [Line 11](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/snapshot-diff.nika#L11) |
| `templates/validate-records.nika` | [Line 11](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/validate-records.nika#L11) |
| `templates/website-brief.nika` | [Line 34](https://github.com/supernovae-st/nika-spec/blob/5c40ba456c53a4ab663a949d44003078e161305d/templates/website-brief.nika#L34) |

These are literal key occurrences in the source files, not an execution or conformance claim. [How to instantiate a template](https://docs.nika.sh/guides/templates.md).

## Contract and implementation

This page projects the named specification revision. Check [released engine status](https://docs.nika.sh/reference/status.md) and [the validation workflow](https://docs.nika.sh/guides/agent-authoring.md) before running a file. An optional field is not evidence that every engine supports every value.

Canonical identity: `language:word:const`. Spec revision: [`5c40ba456c53`](https://github.com/supernovae-st/nika-spec/tree/5c40ba456c53a4ab663a949d44003078e161305d).

[How documentation stays connected](https://docs.nika.sh/reference/knowledge-system.md).


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