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

# Create Draft From Deployed

`POST /v3/workflow-editor/drafts/from-deployed`

## 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/from-deployed`
- Auth: HTTP bearer

Create a new draft by cloning a deployed workflow's YAML.

The draft is linked to the deployed workflow via ``workflow_parent_id``.
If a draft already exists for this parent, it is returned instead of
creating a duplicate.

This is used when the user wants to edit an already-deployed workflow:
the frontend calls this endpoint to get a draft, then opens the editor.

## Headers

- `mentium-workspace-id` string, nullable

## Request body

- CreateDraftFromDeployedRequest: Request to create a draft from an existing deployed workflow.
  - `workflow_id` string, required: ID of the deployed workflow to edit.

## 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)
