---
title: "Create a workflow"
method: POST
path: "/v1/workspaces/{workspaceId}/workflows"
tags: ["Workflows"]
---

# Create a workflow

`POST /v1/workspaces/{workspaceId}/workflows`

Creates a workflow.

## Path parameters

- `workspaceId` string, required

## Request body

- CreateWorkflow
  - `inputs` WorkflowInput[], required
    - union
      - WorkflowStringInput
        - `default` string
        - `key` string, required
        - `type` 'string', required
      - WorkflowNumberInput
        - `default` number
        - `key` string, required
        - `type` 'number', required
      - WorkflowBooleanInput
        - `default` boolean
        - `key` string, required
        - `type` 'boolean', required
      - union
        - WorkflowManualArrayInput
          - `default` object[]
          - `key` string, required
          - `type` 'array', required
        - WorkflowSelectorArrayInput
          - `key` string, required
          - `selector` object, required
            - `default` union
              - …
            - `entityType` 'resource' | 'environment' | 'deployment', required
          - `type` 'array', required
      - WorkflowObjectInput
        - `default` object
        - `key` string, required
        - `type` 'object', required
  - `jobs` CreateWorkflowJobTemplate[], required
    - `config` object, required — Configuration for the job agent
    - `if` string — CEL expression to determine if the job should run
    - `matrix` WorkflowJobMatrix
    - `name` string, required
    - `ref` string, required — Reference to the job agent
  - `name` string, required

## Response `202`

Accepted response

- Workflow
  - `id` string, required
  - `inputs` WorkflowInput[], required
    - union
      - WorkflowStringInput
        - `default` string
        - `key` string, required
        - `type` 'string', required
      - WorkflowNumberInput
        - `default` number
        - `key` string, required
        - `type` 'number', required
      - WorkflowBooleanInput
        - `default` boolean
        - `key` string, required
        - `type` 'boolean', required
      - union
        - WorkflowManualArrayInput
          - `default` object[]
          - `key` string, required
          - `type` 'array', required
        - WorkflowSelectorArrayInput
          - `key` string, required
          - `selector` object, required
            - `default` union
              - …
            - `entityType` 'resource' | 'environment' | 'deployment', required
          - `type` 'array', required
      - WorkflowObjectInput
        - `default` object
        - `key` string, required
        - `type` 'object', required
  - `jobs` WorkflowJobTemplate[], required
    - `config` object, required — Configuration for the job agent
    - `id` string, required
    - `if` string — CEL expression to determine if the job should run
    - `matrix` WorkflowJobMatrix
    - `name` string, required
    - `ref` string, required — Reference to the job agent
  - `name` string, required

## Other responses

- `400` — Invalid request

## Changes

- **2026-02-19** `e61389fc98ac` — 3 breaking, 2 warning, 3 info
  - added the new required request property `jobs`
  - the `inputs/items/oneOf[#/components/schemas/WorkflowArrayInput]/oneOf[#/components/schemas/WorkflowSelectorArrayInput]/selector/default` request property type/format changed from `string`/`` to ``/``
  - removed the success response with the status `201`
  - removed the request property `jobAgents`
  - …4 more

[Change history](https://skmtc.dev/ctrlplanedev/apis/ctrlplane-api/changes/v1/workspaces/:workspaceId/workflows/post.md)

---

[API](https://skmtc.dev/ctrlplanedev/apis/ctrlplane-api.md) · [All operations](https://skmtc.dev/ctrlplanedev/apis/ctrlplane-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ctrlplanedev/ctrlplane-api/revisions/69370c50cf4e/schema)
