# AutomationVersion

One saved version of an automation's flow. Every save of the flow adds a version and makes it the current one; a version never changes afterwards. The flow is a set of steps (`nodes`) and the lines between them (`edges`).

## Used by
- GET /api/v2/automation-versions/{automation_version}: Read a version of an automation's flow (AutomationVersion)
- GET /api/v2/automations/{automation}/versions: List an automation's versions (AutomationVersionList)
- POST /api/v2/automations/{automation}/versions: Save a new version of an automation's flow (AutomationVersion)

## AutomationVersion fields
- id (integer, required): Unique identifier.
- automation_id (integer, required): The automation whose flow this is.
- version (integer, required): Version number within its automation, counting from 1.
- is_current (boolean, required): Whether this is the version whose flow runs.
- saved_by_id (integer or null, required): Who saved this version. `null` once that user is gone.
- created_at (timestamp (YYYY-MM-DDThh:mm:ssZ) or null, required): When the version was saved.
- definition (object, required, detail only): The flow as it is stored and as the builder draws it.
  - nodes (array of object, required): Every step, the trigger included.
    - key (string ≤ 36, required): The step's own key, a UUID. Lines and data tags such as `{{ steps.<key>.count }}` name a step by it.
    - type (string ≤ 100, required): The step type, such as `action.notify`. See `GET /api/v2/automation-node-types`.
    - config (object, required): The step's settings. Their schema is `config_schema` at `GET /api/v2/automation-node-types/{slug}`, where the slug is the type with `.` replaced by `-`. A secret, such as a token for another system, appears only as the id of where it is stored, never as its value.
    - ui (object, required): Where the step sits on the builder's canvas.
      - x (integer, required): Horizontal position on the canvas, in pixels.
      - y (integer, required): Vertical position on the canvas, in pixels.
  - edges (array of object, required): The lines between steps, in the order steps on the same lane run.
    - from (string ≤ 36, required): Key of the step the line leaves.
    - lane (string ≤ 40, required): Which way out of that step: `next`, a condition's `yes` or `no`, a path's key or `otherwise`, a loop's `each` or `after`.
    - to (string ≤ 36, required): Key of the step the line leads to.
- outline (array of object, required, detail only): The steps in the order people read the flow, each with what it does and where its lines lead. Lets a reader explain a flow without decoding `definition`.
  - number (integer, required): The step's number as people count the flow; the trigger is step 1.
  - key (string ≤ 36, required): The step's key.
  - type (string ≤ 100, required): The step type.
  - label (string ≤ 255, required): The step type's name.
  - lanes (array of object, required): The ways out of the step and where each leads.
  - kind (string or null, optional): What kind of step it is; `null` for a step type plnnrly no longer has.
  - summary (string or null, optional): What the step does with its settings, as its card on the canvas says it.
- automation (Ref or AutomationSummary, required): The automation whose flow this is.
- saved_by (Ref or UserSummary or null, required): Who saved this version.
- links (AutomationVersionLinks, required)
  - self (url, required): The canonical URI of this record.

Only on `?view=detail`: definition, outline

## Variants

### AutomationVersionList

What a collection returns, and what `?view=summary` returns on a single record.

9 fields.
Omits: definition, outline

### AutomationVersionSummary

The embedded form: what you get when another resource carries this one and you did not `include` it.

2 fields.
Omits: automation_id, is_current, saved_by_id, created_at, definition, outline, automation, saved_by, links

### AutomationVersionLinks

The `links` object on this resource.

Keys: self

## Example
```json
{
  "id": 1,
  "automation_id": 1,
  "version": 1,
  "is_current": false,
  "saved_by_id": 1,
  "created_at": "2026-03-04T09:15:00Z",
  "definition": {
    "nodes": [
      {
        "…": "4 fields of nodes"
      }
    ],
    "edges": [
      {
        "…": "3 fields of edges"
      }
    ]
  },
  "outline": [
    {
      "number": 1,
      "key": "…",
      "type": "…",
      "label": "…",
      "lanes": [
        {
          "…": "2 fields of lanes"
        }
      ],
      "…": "2 optional fields left out"
    }
  ],
  "automation": {
    "id": 1
  },
  "saved_by": null,
  "links": {
    "self": "https://<your-url>/api/v2/work-items/1"
  }
}
```
