---
title: "Create a workflow"
method: POST
path: "/workflows/definitions"
tags: ["Workflow definitions"]
---

# Create a workflow

`POST /workflows/definitions`

## Request

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

Creates a workflow. The request body is the definition document itself, not wrapped in any envelope.

- The workflow starts at revision 1, with the auto-maintained `latest` alias pointing at it.
- Nothing runs yet: triggers only register when you activate an alias.
- Referencing secrets or variables that have no value yet is fine: creation succeeds and the response lists them under `warnings` so you can set them afterwards.

## Request body

- 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.

## Response `201`

The workflow was 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

- `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/post.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)
