Choose your language:
    Create a new workflow
    Parameters
    id  string  Required
    ID of workflow
    name  string  Optional

    The name of the workflow

    stages  Array<object>  Optional

    The stages of the workflow

    Returns
    Returns a workflow object.

    Examples

    Example code:
    const { SiteClient } = require('datocms-client');
    async function run() {
    const client = new SiteClient('YOUR-API-TOKEN');
    const workflow = await client.workflow.create({
    id: 'approval_by_editors',
    name: 'Approval by editors required',
    stages: [
    {
    id: 'waiting_for_review',
    name: 'Waiting for review',
    initial: true
    }
    ]
    });
    console.log(workflow);
    }
    run();
    Returned output:
    > node example.js
    {
    "id": "approval_by_editors",
    "name": "Approval by editors required",
    "stages": [
    {
    "id": "waiting_for_review",
    "name": "Waiting for review",
    "initial": true
    }
    ]
    }