---
title: "Workflow"
description: "Workflow"
url: "https://www.contentstack.com/docs/developers/sdks/content-management-sdk/javascript/reference/workflow"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-13"
---

# Workflow

## Workflow

[Workflow](/docs/headless-cms/about-workflow-stages/) is a tool that allows you to streamline the process of content creation and publishing, and lets you manage the content lifecycle of your project smoothly.

## update

The Update Workflow request allows you to add a workflow stage or update the details of the existing stages of a workflow.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).workflow('workflow_uid').fetch()
.then((workflow) => {
 workflow.name = 'My New Workflow'
 workflow.description = 'Workflow description'
 return workflow.update()
})
.then((workflow) => console.log(workflow))
```

## disable

The Disable Workflow request allows you to disable a workflow.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).workflow('workflow_uid')
.disable()
.then((workflow) => console.log(workflow))
```

## enable

The Enable Workflow request allows you to enable a workflow.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).workflow('workflow_uid')
.enable()
.then((workflow) => console.log(workflow))
```

## delete

The Delete Workflow call is used to delete an existing Workflow permanently from your Stack.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).workflow('workflow_uid')
.delete()
.then((response) => console.log(response.notice))
```

## fetch

The fetch workflow retrieves the comprehensive details of a specific Workflow of a stack.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).workflow('workflow_uid')
.fetch()
.then((workflow) => console.log(workflow))
```

## getPublishRules

The get Workflow call is used to get details of an existing Workflow from your Stack.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).workflow()
.contentType('contentType_uid')
.getPublishRules()
.then((collection) => console.log(collection))
```

Enter the action that has been set in the Publishing Rule. Example:publish/unpublish

Enter the code of the locale where your Publishing Rule will be applicable.

Enter the UID of the environment where your Publishing Rule will be applicable.

## create

The Create a Workflow request allows you to create a Workflow.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

const workflow = {
"workflow_stages": [
     {
       "color": "#2196f3",
       "SYS_ACL": {
         "roles": {
           "uids": []
         },
         "users": {
         "uids": [
           "$all"
         ]
       },
       "others": {}
     },
     "next_available_stages": [
       "$all"
     ],
     "allStages": true,
     "allUsers": true,
     "specificStages": false,
     "specificUsers": false,
     "entry_lock": "$none", 
     "name": "Review"
   },
   {
     "color": "#74ba76",
     "SYS_ACL": {
       "roles": {
         "uids": []
       },
       "users": {
         "uids": [
           "$all"
         ]
       },
       "others": {}
     },
     "allStages": true,
     "allUsers": true,
     "specificStages": false,
     "specificUsers": false,
     "next_available_stages": [
         "$all"
       ],
       "entry_lock": "$none",
       "name": "Complete"
     }
   ],
   "admin_users": {
     "users": []
   },
     "name": "Workflow Name",
     "enabled": true,
     "content_types": [
       "$all"
     ]
 }

client.stack({ api_key: 'api_key'}).workflow()
.create({ workflow })
.then((workflow) => console.log(workflow))
```

The workflow details with workflow stages.

## fetchAll

The Get all Workflows request retrieves the details of all the Workflows of a stack.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).workflow()
.fetchAll()
.then((collection) => console.log(collection))
```

The limit parameter will return a specific number of workflow in the output.

The skip parameter will skip a specific number of workflow in the output.

To retrieve the count of workflow.

## publishRule

The Publish rule allow you to create, fetch, delete, update the publish rules.

```
import * as contentstack from '@contentstack/management'
const client = contentstack.client({ authtoken })

client.stack({ api_key: 'api_key'}).workflow().publishRule().fetchAll()
.then((collection) => console.log(collection))

client.stack({ api_key: 'api_key'}).workflow().publishRule('rule_uid').fetch()
.then((publishrule) => console.log(publishrule))
```

Uid for publish rule.

## Workflow | JavaScript Management SDK | Contentstack

Workflow lets you streamline content creation and publishing to manage your project's content lifecycle, in the JavaScript Management SDK.