Show examples in:
Create a new workflow

Body Parameters

id  string  Optional
RFC 4122 UUID of workflow expressed in URL-safe base64 format
name  Required  string  Example: "Approval by editors required"

The name of the workflow

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

The stages of the workflow

api_key  Required  string  Example: "approval_by_editors"

Workflow API key

Returns

Returns a workflow resource object.

Examples

Example Basic example
import { buildClient } from '@datocms/cma-client-node';
async function run() {
const client = buildClient({ apiToken: '<YOUR_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'
});
console.log(workflow);
}
run();