Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Workflow

Create a new workflow

Body parameters

id string Optional

RFC 4122 UUID of workflow expressed in URL-safe base64 format

Example: "uJzC2b6YQg-DW2A5edpQYQ"
name string Required

The name of the workflow

Example: "Approval by editors required"
stages Required

The stages of the workflow

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

ID of the stage

Example: "waiting_for_review"
name string Required

Name of the stage

Example: "Waiting for review"
description string, null Optional

Description of the stage

Example: "Editor has finished writing and is waiting for approval from a supervisor"
initial boolean Optional

Whether this is the initial stage or not

api_key string Required

Workflow API key

Example: "approval_by_editors"

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 workflow = await client.workflows.create({
name: "Approval by editors required",
stages: [
{ id: "waiting_for_review", name: "Waiting for review", initial: true },
],
api_key: "approval_by_editors",
});
// 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",
}