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

# Create Workflow

`POST /rest/workflows`

## Request body

- CreateWorkflow — Request body for creating a new workflow or a new version of an existing workflow. Use name for a new workflow, or workflow_id/workflow_name to version an existing workflow.
  - `name` string, nullable — The name for a new workflow. If not provided, a name will be auto-generated.
  - `workflow_id` integer, nullable — The ID of an existing workflow to create a new version for.
  - `workflow_name` string, nullable — The name of an existing workflow to create a new version for.
  - `folder_id` integer, nullable — The folder ID to place the workflow in.
  - `commit_message` string, nullable — A message describing the changes in this version.
  - `nodes` WorkflowNode[], required — Complete list of workflow nodes. At least one node must be marked is_output_node=true.
    - `name` string, required — Unique name for the node within this workflow.
    - `node_type` string, required — The type of node. Common types include VARIABLE, CODE_EXECUTION, PROMPT_TEMPLATE, ENDPOINT, COMPARE, CONTAINS, LLM_ASSERTION, AI_DATA_EXTRACTION, CODING_AGENT. See Node & Column Types documentation for the complete list.
    - `configuration` object, required — Node-specific configuration.
    - `dependencies` string[] — Names of nodes or input variables this node depends on.
    - `is_output_node` boolean, required — Whether this node is an output node.
  - `required_input_variables` object — A mapping of variable names to their types.
  - `edges` Edge[], nullable — Conditional edges between nodes.
    - `source_node_name` string, required — The source node name.
    - `target_node_name` string, required — The target node name.
    - `is_and` boolean, required — Whether multiple conditionals use AND logic (true) or OR logic (false).
    - `conditionals` EdgeConditional[], required — At least one conditional.
      - `position` integer, required — Order of evaluation.
      - `operator` '=' | '!=' | '<' | '>' | '<=' | '>=' | 'in' | 'not_in' | 'is_null' | 'is_not_null', required — Comparison operator.
      - `left_config` object, required — Left side of comparison. Can be static_value or source.
      - `right_config` object, required — Right side of comparison. Can be static_value or source.
  - `release_labels` string[], nullable — Labels to attach to this version.
  - `external_ids` ExternalId[] — Identifiers from other systems.
    - `source` string, required — The external system or namespace that owns the ID.
    - `external_id` string, required — The identifier for this entity in the external system.

## Response `201`

Workflow created successfully

- CreateWorkflowResponse — Response after creating or patching a workflow.
  - `success` boolean, required — Indicates if the request was successful.
  - `workflow_id` integer, required — The ID of the workflow.
  - `workflow_name` string, required — The name of the workflow.
  - `workflow_version_id` integer, required — The ID of the created workflow version.
  - `version_number` integer, required — The version number.
  - `base_version` integer, nullable — The base version this was created from (PATCH only).
  - `release_labels` string[], nullable — Labels attached to this version.
  - `nodes` object[] — Summary of nodes in the workflow.
    - `id` string
    - `name` string
    - `node_type` string
    - `is_output_node` boolean
  - `required_input_variables` object — Required input variables for the workflow.
  - `external_ids` ExternalId[], required — External ID mappings for the workflow.
    - `source` string, required — The external system or namespace that owns the ID.
    - `external_id` string, required — The identifier for this entity in the external system.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized - missing or invalid API key.
- `404` — Not found - requested resource does not exist or is not accessible.
- `409` — External ID conflict
- `422` — Validation error - request parameters or body are invalid.

---

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