Publish a workflow version¶
Publishes a draft workflow version to published status, records PublishedAt, and deprecates any other published versions under the same workflow definition within the same transaction. Calling this endpoint does not automatically start a workflow run.
POST https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-apps/{workflow_id}/versions/{version_id}/publish
Before you begin¶
Prepare a personal access token with workflow version publish permission and the target workspace ID.
Obtain the target version
IDfrom Create a workflow version or List workflow versions, verify that itsStatusisdraft, and confirm that the workflow is not managed by an agent automation task.
Request parameters¶
Replace $AI_STUDIO_API_KEY, $WORKSPACE_ID, $WORKFLOW_ID, and $VERSION_ID with actual values.
curl -X POST "https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-apps/$WORKFLOW_ID/versions/$VERSION_ID/publish" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID"
Path parameters
Parameter |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Target workflow ID, obtained from List workflows. |
|
string |
Yes |
Draft version ID to publish ( |
Successful response¶
Returns HTTP 200 and the published workflow version object with Status set to published and PublishedAt set to the publication timestamp. Version object keys use PascalCase on the JSON wire.
{
"code": "OK",
"msg": "OK",
"data": {
"ID": "ver-002",
"WorkspaceID": "ws-001",
"UserID": "user-001",
"WorkflowDefinitionID": "def-001",
"Version": 2,
"WorkflowJSON": "{\"name\":\"daily-import\",\"nodes\":[]}",
"Status": "published",
"CreatedBy": "user-001",
"CreatedAt": "2026-10-14T09:00:00Z",
"PublishedAt": "2026-10-14T09:15:00Z",
"Type": 1,
"InputSchema": "",
"OutputSchema": "",
"ResultMode": 0,
"Description": "Add input field validation",
"RuntimeSpecJSON": ""
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
|
|
string |
Result message; |
|
object |
Published workflow version object. |
|
string |
Workflow version ID. |
|
string |
Workspace ID that owns the version. |
|
string |
User ID of the workflow owner. |
|
string |
Workflow definition ID that owns the version. |
|
integer |
Positive integer version number starting from |
|
string |
Saved workflow definition JSON string. |
|
string |
Version status after publication; |
|
string |
User ID of the actor who created the version. |
|
string |
Version creation time in RFC 3339 format. |
|
string |
Timestamp of this publication in RFC 3339 format. |
|
integer |
Version type code: |
|
string |
Saved input schema JSON string; |
|
string |
Saved output schema JSON string; |
|
integer |
Result mode code: |
|
string |
Version description; |
|
string |
Saved runtime specification JSON string; |
Error response¶
Returns 404 (ErrNotFound) when the workflow or version does not exist, and 409 (ErrWorkflowUpdateManagedByAutomation) when the workflow is managed by an agent automation task. Calling this endpoint on a version whose Status is already published or deprecated fails because only draft versions can be published.
{
"code": "ErrWorkflowUpdateManagedByAutomation",
"msg": "workflow is managed by an automation task; edit the automation task instead"
}
Field |
Type |
Description |
|---|---|---|
|
string |
Error code, such as |
|
string |
Human-readable error message. |