---
title: "Create Draft"
method: POST
path: "/v3/workflow-editor/drafts"
tags: ["workflow-editor"]
---

# Create Draft

`POST /v3/workflow-editor/drafts`

## Request

- Base URL: `https://api.mentium.io` (the document declares no server; this is the origin it was published from)
- URL: `https://api.mentium.io/v3/workflow-editor/drafts`
- Auth: HTTP bearer

Create a new workflow draft.

## Headers

- `mentium-workspace-id` string, nullable

## Request body

- WorkflowDraftCreateRequest: Request to create a new workflow draft.
  - `name` string: Draft name
  - `yaml_content` string, nullable: Initial YAML content. If not provided, uses empty template.
  - `workflow_id` string, nullable: Existing workflow ID if editing a published workflow.

## Response `201`

Successful Response

- WorkflowEditorOut: Workflow editor output schema.
  - `id` string, required
  - `workspace_id` string, required
  - `name` string, nullable
  - `yaml_content` string, required
  - `workflow_parent_id` string, nullable
  - `draft_id` string, nullable: ID of the child draft linked to this workflow, if one exists. Only populated for non-draft (deployed / inactive) workflows.
  - `chat_history` ChatMessageOut[]
    - `role` string, required: Message role: 'user', 'assistant', or 'system'
    - `content` string, required: Message content
    - `timestamp` string, nullable: ISO-8601 timestamp recorded when this message was appended.
    - `message_index` integer, nullable: Zero-based position in chat_history (used by truncate-chat).
    - `yaml_snapshot` string, nullable: For user messages, the canvas YAML at the moment this message was sent. Used to anchor chat-aware undo / pencil-edit (truncate-chat).
    - `tool_invocations` ChatToolInvocationOut[]: For assistant messages, the tool calls executed during this turn.
      - `call_id` string, required: Provider-issued call id
      - `name` string, required: Tool name
      - `arguments` string, required: JSON-encoded arguments string
      - `output` string, required: Tool output string fed back to the model
      - `success` boolean, required: Whether the tool call succeeded
  - `created_at` string, required
  - `updated_at` string, required
  - `can_undo` boolean: Whether undo is available
  - `is_active` boolean: Whether the workflow is deployed and active
  - `is_draft` boolean: Whether this is a draft
  - `deployed_version` integer: Number of times this workflow has been deployed

## Other responses

- `422`: Validation Error

---

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