Show examples in:
JavascriptHTTP
Endpoint info
Available examples
Content Management API > Workflow

Update a workflow

Body parameters

namestringOptional

The name of the workflow

Example:"Approval by editors required"
api_keystringOptional

Workflow API key

Example:"approval_by_editors"
stagesOptional

The stages of the workflow

Type:Array<object>
Example:[{ id: "waiting_for_review", name: "Waiting for review", initial: true }]
idstringRequired

ID of the stage

Example:"waiting_for_review"
namestringRequired

Name of the stage

Example:"Waiting for review"
descriptionstring, nullOptional

Description of the stage

Example:"Editor has finished writing and is waiting for approval from a supervisor"
initialbooleanOptional

Whether this is the initial stage or not

Returns

Returns a resource object of type workflow

Examples

import { buildClient } from "@datocms/cma-client-node";
async function run() {
const client = buildClient({ apiToken: process.env.DATOCMS_API_TOKEN });
const workflowId = "uJzC2b6YQg-DW2A5edpQYQ";
const workflow = await client.workflows.update(workflowId, {
id: "uJzC2b6YQg-DW2A5edpQYQ",
});
// Check the 'Returned output' tab for the result ☝️
console.log(workflow);
}
run();
{
id: "uJzC2b6YQg-DW2A5edpQYQ",
name: "Approval by editors required",
stages: [
{ id: "waiting_for_review", name: "Waiting for review", initial: true },
],
api_key: "approval_by_editors",
}