Restore a historical workflow candidate as a new proposal¶
Restore a compiled historical candidate as a new pending plan. See Common information for objects, variables, and environment boundaries.
POST https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-candidates/restore
Before you call this API¶
Prepare a personal access token with workflow operation privileges for the target workspace. Use conversations, tasks, and artifacts from the same environment. Install jq and set example variables.
Request body¶
curl -X POST "https://api.moi.matrixorigin.cn/v5/workflow/v2/workflow-candidates/restore" \
-H "X-API-Key: $AI_STUDIO_API_KEY" \
-H "X-Workspace-ID: $WORKSPACE_ID" \
-H 'Content-Type: application/json' \
--data-binary "$(jq -n --arg v0 "$WORKFLOW_CONTEXT_ID" --arg v1 "$RESTORE_REQUEST_ID" --arg v2 "$RESTORE_TASK_ID" --arg v3 "$RESTORE_ARTIFACT_ID" '{"context_id":$v0,"request_id":$v1,"candidate_ref":{"task_id":$v2,"artifact_id":$v3}}')"
Select a valid compiled candidate from a completed task in the same conversation; failed source records cannot be restored. The server appends a new artifact and pending proposal under the source task, resets test_status to not_run, and preserves restored_from. task_id may stay unchanged, but artifact_id and proposal_id change; use new returned references afterward. Recovery neither accepts, publishes, nor overwrites saved applications and preserves original target binding. The same request identifier and selection may replay. Always retain both; do not rely on conflicts when reusing an identifier for different artifacts of one task. New proposals expire24 hours after creation.
Fields |
Type |
Required |
Description |
|---|---|---|---|
|
string |
Yes |
Generation conversation ID matching the source task. |
|
string |
Yes |
Stable identifier saved for this recovery; change it when changing source. |
|
object |
Yes |
Complete reference retained from the same history entry or task artifact. |
|
string |
Yes |
Source task ID, not the workflow application ID. |
|
string |
Yes |
Candidate artifact ID within that task. |
Successful response¶
{
"code": "OK",
"msg": "OK",
"data": {
"id": "workflow_restore_b5c5286c71c60c1371946c8568e7f916",
"candidate_ref": {
"task_id": "task-1",
"artifact_id": "workflow_candidate_b5c5286c71c60c1371946c8568e7f916"
},
"candidate": {
"ok": true,
"candidate_id": "workflow_candidate_b5c5286c71c60c1371946c8568e7f916",
"proposal_id": "workflow_restore_b5c5286c71c60c1371946c8568e7f916_proposal",
"summary": "candidate",
"message": "waiting for explicit acceptance",
"workflow": {
"name": "candidate",
"root": "root",
"nets": {
"root": {
"nodes": {
"__end": {
"id": "mowl:end",
"in_connector": {
"type": "simple",
"nodes": [
"__start"
]
}
},
"__start": {
"id": "mowl:start",
"out_connector": {
"type": "simple",
"nodes": [
"__end"
]
}
}
}
}
}
},
"runtime_fields": {
"fields": [
{
"field_id": "source_ref",
"label": "",
"widget": ""
},
{
"field_id": "prompt",
"label": "",
"widget": ""
}
]
},
"catalog_revision": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
"snapshot_digest": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb",
"syntax_version": "workflow-go/v1",
"compiler_version": "workflow-go-compiler/v2",
"source_code": "package workflow\nfunc Build() {}\n\n",
"restored_from": {
"task_id": "task-1",
"artifact_id": "workflow_candidate_beae4775c142fe6e5dccdced956154fe"
},
"test_status": "not_run"
},
"status": "pending",
"created_at": "2026-08-31T01:00:00Z"
}
}
Field |
Type |
Description |
|---|---|---|
|
string |
OK on success. |
|
string |
Response information. |
|
object |
Result of this operation. |
|
string |
New history event ID. |
|
object |
New candidate artifact reference in the source task. |
|
object |
New candidate snapshot. |
|
string |
New pending proposal ID. |
|
object |
Original source task/artifact reference. |
|
string |
not_run on initial recovery; retest before confirmation. |
|
string |
pending initially; replay returns persisted proposal state. |
|
string |
Creation time. |
Error response¶
Handle HTTP status and business fields. History and recovery have dedicated errors; see Errors and environments. Retain identity, source references, and operation identifiers, then check state before proceeding. Do not automatically switch workspace, candidate, or confirmation key.