# Variable

A scoped, encrypted-at-rest variable — metadata plus the value for a non-sensitive one; a sensitive value is revealed once via the reveal endpoint.

**Attributes** (`VariableDto`)

- `id` · `string` · read-only — Unique identifier of the variable (read-only).
- `name` · `string` · required — Variable name — the injected environment-variable name: letters, digits and underscores, starting with a letter or underscore (1–128 chars). Unique within its scope. `KOO_VARIABLES_REVISION` is reserved.
- `scope` · `"project" | "environment" | "service"` · read-only — Where the variable lives: a project, one environment, or a single service (service overrides environment overrides project).
- `scopeId` · `string` · read-only — Id of the resource the variable is scoped to (project, environment, or service).
- `sensitive` · `boolean` · required — When true, the value is withheld from ordinary reads and returned only by the audited reveal endpoint.
- `value` · `string` · optional — The value — present only for a non-sensitive variable; a sensitive value is withheld and must be revealed one at a time.
- `connection` · `object` · optional — Present for a connection variable — the managed addon and key it injects.
  - `service` · `string` · required — Service name — lowercase letters, digits and dashes (3–16 chars, starts with a letter). The name is the service identity within the environment: renaming creates a new service.
  - `key` · `string` · required — The published connection key this variable injects.
- `aliasTarget` · `string` · optional — Present for an alias variable — the name of the variable it resolves to through the scope chain.
- `createdAt` · `string <date-time>` · read-only — When the variable was created.
- `updatedAt` · `string <date-time>` · read-only — When the variable was last changed.

**Example `VariableDto`**

```json
{
  "id": "var_01example0000000000000000x",
  "name": "my-app",
  "scope": "project",
  "scopeId": "scope_01example0000000000000000x",
  "sensitive": true,
  "value": "example",
  "connection": {
    "service": "example",
    "key": "example"
  },
  "aliasTarget": "example",
  "createdAt": "2026-01-01T00:00:00.000Z",
  "updatedAt": "2026-01-01T00:00:00.000Z"
}
```
