curl --request PUT \
--url https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID} \
--header 'x-service-key: {YOUR_SERVICE_KEY}' \
--header 'Content-Type: application/json' \
--data '{
"name": "Quarterly Report Processor",
"description": "Summarizes quarterly financial reports",
"activeStatus": "active",
"nodes": { "...": "the complete node map" },
"edges": { "...": "the complete edge map" }
}'
import requests
BASE = "https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID}"
headers = {"x-service-key": "{YOUR_SERVICE_KEY}"}
# Read the current definition, change one thing, send the whole thing back.
current = requests.get(BASE, headers=headers).json()
response = requests.put(
BASE,
headers=headers,
json={
"name": "Quarterly Report Processor (v2)",
"description": current["description"],
"nodes": current["nodes"],
"edges": current["edges"],
"activeStatus": "active",
},
)
print(response.json())
const base = "https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID}";
const headers = { "x-service-key": "{YOUR_SERVICE_KEY}" };
// Read the current definition, change one thing, send the whole thing back.
const current = await (await fetch(base, { headers })).json();
const response = await fetch(base, {
method: "PUT",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
name: "Quarterly Report Processor (v2)",
description: current.description,
nodes: current.nodes,
edges: current.edges,
activeStatus: "active",
}),
});
const data = await response.json();
console.log(data);
{
"workflowVersionId": "{WORKFLOW_VERSION_ID}",
"workflowVersionNumber": 4,
"majorVersion": 2,
"minorVersion": 0,
"versionLabel": "major"
}
Workflows
Update a Workflow
Replace a workflow’s definition and mint a new version
PUT
/
api
/
v1
/
workflow
/
{workflowId}
curl --request PUT \
--url https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID} \
--header 'x-service-key: {YOUR_SERVICE_KEY}' \
--header 'Content-Type: application/json' \
--data '{
"name": "Quarterly Report Processor",
"description": "Summarizes quarterly financial reports",
"activeStatus": "active",
"nodes": { "...": "the complete node map" },
"edges": { "...": "the complete edge map" }
}'
import requests
BASE = "https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID}"
headers = {"x-service-key": "{YOUR_SERVICE_KEY}"}
# Read the current definition, change one thing, send the whole thing back.
current = requests.get(BASE, headers=headers).json()
response = requests.put(
BASE,
headers=headers,
json={
"name": "Quarterly Report Processor (v2)",
"description": current["description"],
"nodes": current["nodes"],
"edges": current["edges"],
"activeStatus": "active",
},
)
print(response.json())
const base = "https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID}";
const headers = { "x-service-key": "{YOUR_SERVICE_KEY}" };
// Read the current definition, change one thing, send the whole thing back.
const current = await (await fetch(base, { headers })).json();
const response = await fetch(base, {
method: "PUT",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
name: "Quarterly Report Processor (v2)",
description: current.description,
nodes: current.nodes,
edges: current.edges,
activeStatus: "active",
}),
});
const data = await response.json();
console.log(data);
{
"workflowVersionId": "{WORKFLOW_VERSION_ID}",
"workflowVersionNumber": 4,
"majorVersion": 2,
"minorVersion": 0,
"versionLabel": "major"
}
Replace the workflow with the definition in the body and mint a new version.
Requires the Workflow: Full permission on the workflow.
The change is recorded as a single API-update entry in the workflow’s version history. Earlier versions are untouched and stay retrievable by version number or ID.
This is a replace, not a merge. Nodes and edges absent from the body are removed from the new version — so send the whole workflow, not just the parts you changed.Fetch the current definition with Get Workflow Details first, modify it, then send it back in full.
Path Parameters
string
required
The ID of the workflow to update
Headers
string
required
Your API authentication key
Body Parameters
string
required
Workflow name
string
Workflow description
object
Workflow nodes keyed by node ID, in the same shape as Create a Workflow. Each map key must equal the
id of the node it holds.Replaces the existing set — a node absent from this map is removed from the new version.A node’s handler_class determines the shape of its process — see Node Process Types. For input_schema and output_schema, see Variable Schemas.object
Workflow edges keyed by edge ID, in the same shape as Create a Workflow. Each map key must equal the
id of the edge it holds, and from_node_id and to_node_id must name nodes present in nodes.Replaces the existing set — an edge absent from this map is removed from the new version.string
Workflow active status. One of
active or inactive.string
Workflow validity status. One of
valid or invalid.Response
string
required
The ID of the version this update created
number
required
The version number this update created
number
Major component of the new version.
null if the workflow is not semantically versioned.number
Minor component of the new version.
null if the workflow is not semantically versioned.string
How the version was classified. One of
major or minor.An API update always classifies as major, because a single call can rewrite the whole workflow.Errors
Bad Request
The workflow definition is malformed.
Unauthorized
Missing, invalid, or expired API key.
Forbidden
No access to this workflow.
Not Found
The workflow does not exist.
curl --request PUT \
--url https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID} \
--header 'x-service-key: {YOUR_SERVICE_KEY}' \
--header 'Content-Type: application/json' \
--data '{
"name": "Quarterly Report Processor",
"description": "Summarizes quarterly financial reports",
"activeStatus": "active",
"nodes": { "...": "the complete node map" },
"edges": { "...": "the complete edge map" }
}'
import requests
BASE = "https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID}"
headers = {"x-service-key": "{YOUR_SERVICE_KEY}"}
# Read the current definition, change one thing, send the whole thing back.
current = requests.get(BASE, headers=headers).json()
response = requests.put(
BASE,
headers=headers,
json={
"name": "Quarterly Report Processor (v2)",
"description": current["description"],
"nodes": current["nodes"],
"edges": current["edges"],
"activeStatus": "active",
},
)
print(response.json())
const base = "https://operator.opus.com/api/v1/workflow/{YOUR_WORKFLOW_ID}";
const headers = { "x-service-key": "{YOUR_SERVICE_KEY}" };
// Read the current definition, change one thing, send the whole thing back.
const current = await (await fetch(base, { headers })).json();
const response = await fetch(base, {
method: "PUT",
headers: { ...headers, "Content-Type": "application/json" },
body: JSON.stringify({
name: "Quarterly Report Processor (v2)",
description: current.description,
nodes: current.nodes,
edges: current.edges,
activeStatus: "active",
}),
});
const data = await response.json();
console.log(data);
{
"workflowVersionId": "{WORKFLOW_VERSION_ID}",
"workflowVersionNumber": 4,
"majorVersion": 2,
"minorVersion": 0,
"versionLabel": "major"
}
Was this page helpful?