---
title: "Update a workflow"
method: PUT
path: "/workflows/definitions/{id}"
tags: ["Workflow definitions"]
---

# Update a workflow

`PUT /workflows/definitions/{id}`

## Request

- Base URL: `https://api.nullplatform.com`
- URL: `https://api.nullplatform.com/workflows/definitions/{id}`
- Auth: HTTP bearer

Pushes a new version of the definition. The body can be the bare definition or `{ definition, mode }`, where `mode` controls versioning:

- `auto` (default): overwrites the latest revision, unless an active alias points at it, in which case a new revision is created. Safe by default: you never rewrite something that is live.
- `new-revision`: always create a new revision.
- `overwrite`: always rewrite the latest revision.

If the `{id}` in the URL is a key that doesn't exist yet, the workflow is created instead and the response is 201: `PUT` doubles as an upsert, so a git repository of definitions can push them without knowing which ones already exist.

## Path parameters

- `id` string, required

## Request body

- object
  - `definition` WorkflowDefinition: The workflow definition: the same document the visual editor saves. Steps are a map of step id to step; triggers are always rebuilt server-side from steps of type `trigger`, so a client-supplied `triggers` value is discarded.
    - `name` string, required: Human-readable workflow name.
    - `key` string: Client-chosen slug (`^[a-z0-9][a-z0-9-]{0,62}$`), unique per organization and immutable. Enables GitOps-style upserts via `PUT /workflows/definitions/{key}`.
    - `description` string
    - `path` string: Folder in the workflows tree. Defaults to `/`.
    - `nrn` string: The nullplatform resource name the workflow is scoped to. Defaults to the caller's organization.
    - `steps` object, required: Map of step id to step definition. Step ids are alphanumeric (no hyphens).
    - `connections` object[]: Edges between steps.
    - `variables` object: Per-run variables with optional `initialValue`.
    - `metadata` object
    - `semanticVersion` string: Optional version label stored on the revision.
  - `mode` 'auto' | 'overwrite' | 'new-revision'

## Response `200`

The definition was updated. `mode` says whether the latest revision was overwritten or a new one created.

- PublishResult
  - `workflow` Workflow
    - `id` string, required
    - `key` string
    - `name` string, required
    - `description` string
    - `path` string
    - `organizationId` string
    - `nrn` string
    - `metadata` object
    - `createdAt` string, date-time, required
    - `updatedAt` string, date-time, required
  - `revision` Revision
    - `workflowId` string, required
    - `revision` integer, required: Revision number, starting at 1.
    - `definition` object, nullable: The full definition. `null` in list responses unless `includeDefinition=true`.
    - `createdAt` string, date-time, required
    - `createdBy` string
    - `releaseNotes` string
    - `semanticVersion` string
  - `latestAlias` Alias
    - `workflowId` string, required
    - `name` string, required
    - `revision` integer, required
    - `active` boolean, required: Whether the alias's triggers are activated.
    - `updatedAt` string, date-time, required
    - `updatedBy` string
    - `metadata` object
    - `triggerStates` object: Map of trigger id to its activation state.
  - `mode` 'created' | 'overwritten' | 'new-revision': How the write was applied (update responses only).
  - `warnings` ConfigWarning[]
    - `code` 'CONFIG_ENTRY_UNRESOLVED'
    - `name` string
    - `kind` 'secret' | 'var'

## Other responses

- `201`: No workflow matched the key, so one was created (upsert).
- `4XX`: Client error. The body says what went wrong: an error `type`, a human-readable `detail`, and, on validation failures, one entry per offending field.
- `5XX`: Unexpected server error.

## Changes

- **2026-09-17** `43b3c1ecdfd8`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/nullplatform/apis/nullplatform-api/changes/workflows/definitions/:id/put.md)

---

[API](https://skmtc.dev/nullplatform/apis/nullplatform-api.md) - [All operations](https://skmtc.dev/nullplatform/apis/nullplatform-api/llms.txt) - [OpenAPI document](https://skmtc.dev/nullplatform/apis/nullplatform-api/revisions/d3f66bc633d4?raw)
