---
title: "Update Draft"
method: PATCH
path: "/v3/workflow-editor/drafts/{workflow_id}"
tags: ["workflow-editor"]
---

# Update Draft

`PATCH /v3/workflow-editor/drafts/{workflow_id}`

## 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/{workflow_id}`
- Auth: HTTP bearer

Update a workflow draft.

## Path parameters

- `workflow_id` string, uuid, required

## Headers

- `mentium-workspace-id` string, nullable

## Request body

- WorkflowDraftUpdateRequest: Request to update an existing workflow draft.
  - `name` string, nullable: Draft name
  - `yaml_content` string, nullable: Updated YAML content

## Response `200`

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)
