---
title: "Workflows"
description: "Workflows"
url: "https://www.contentstack.com/docs/developers/sdks/content-management-sdk/python/reference/workflows"
product: "Contentstack"
doc_type: "guide"
audience:
  - developers
  - admins
version: "current"
last_updated: "2026-09-14"
---

# Workflows

## Workflows

[Workflow](/docs/headless-cms/about-workflows) 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.

## create

The create method creates a new workflow in a specific stack.

```
data = {
"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",
           "enabled":true,
           "branches":[
               "main",
               "development"
           ],
           "content_types":[
               "$all"
           ]
       }
   }
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows().create(data).json()
```

Data required to create a new workflow

## create_publish_rule

The create\_publish\_rule method creates a new rule for the workflow in a specific stack.

```
data = {
 "publishing_rule":{
           "workflow":"workflow_uid",
           "actions":[],
           "branches":[
               "main",
               "development"
           ],
           "content_types":[
               "$all"
           ],
           "locales":[
               "en-us"
           ],
           "environment":"environment_uid",
           "approvers":{
               "users":[
                   "user_uids"
               ],
               "roles":[
                   "role_uids"
               ]
           },
           "workflow_stage":"workflow_stage_uid",
           "disable_approver_publishing":false
       }
   }
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows().create_publish_rule(data).json()
```

Data required to create a new publish rule for the workflow

## delete

The delete method removes an existing workflow from a specific stack.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = response = client.stack('api_key').workflows('workflow_uid').delete().json()
```

UID of the workflow

## delete_publish_rule

The delete\_publish\_rule method removes an existing publish rule for the workflow in a specific stack.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows().delete_publish_rule('rule_uid').json()
```

UID of the publishing rule

## disable

The disable method allows you to disable a workflow.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
file_path = "tests/resources/mock_content_types/import_content_types.json"
response = client.stack('api_key').workflows('workflow_uid').disable().json()
```

UID of the workflow

## enable

The enable method allows you to enable a workflow.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows('workflow_uid').export().json()
```

UID of the workflow

## fetch

The fetch method retrieves the details of a single workflow from the stack.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows('workflow_uid').fetch().json()
```

UID of the workflow

## fetch_publish_rule

The fetch\_publish\_rule method retrieves the details of a specific publish rule from the stack.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows().fetch_publish_rule('rule_uid').json()
```

UID of the publishing rule

## fetch_publish_rule_content_type

The fetch\_publish\_rule\_content\_type method retrieves the details of publish rules applied to a specific content type.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows().fetch_publish_rule_content_type('content_type_uid').json()
```

UID of the content type

## fetch_publish_rules

The fetch\_publish\_rules method retrieves the details of all publish rules from the stack.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows().fetch_publish_rules().json()
```

## fetch_tasks

The fetch\_tasks method retrieves the details of all tasks assigned to you.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows().logs().json()
```

## find

The find method retrieves the details of all workflows in the stack.

```
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack("api_key").workflows().find().json()
```

## publish_request_approval

The publish\_request\_approval method allows you to either send a publish request or accept/reject a publish request.

```
from contentstack_management import contentstack
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
result = client.stack('api_key').workflows().publish_request_approval('content_type_uid', 'entry_uid').json()
```

UID of the content type

UID of the entry

## set_workflow_stage

The set\_workflow\_stage method allows you to either set a workflow stage of an entry or update an already existing one.

```
data ={
"workflow": {
           "workflow_stage": {
               "comment": "Workflow Comment",
               "due_date": "Thu Dec 01 2018",
               "notify": false,
               "uid": "workflow_stage_uid",
               "assigned_to": [{
                       "uid": "user_uid", 
                       "name": "Username", 
                       "email": "user_email_id"
                       }],
               "assigned_by_roles": [{
                   "uid": "role_uid",
                   "name": "Role name"
               }]               
           }
       }
   }
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows().set_workflow_stage('content_type_uid', 'entry_uid', data).json()
```

UID of the content type

UID of the entry

The data required to set the workflow stage for a specific entry

## update

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

```
data = {
       "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",
           "enabled":true,
           "branches":[
               "main",
               "development"
           ],
           "content_types":[
               "$all"
           ]
       }
   }
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows("workflow_uid").update(data).json()
```

The data required to update the workflow stage for a specific entry

UID of the workflow

## update_publish_rule

The update\_publish\_rule method allows you to add a publish rule or update the details of an existing publish rule of a workflow.

```
data = {
       "publishing_rule": {
           "workflow": "workflow_uid",
           "actions": [],
           "branches": [
               "main",
               "development"
           ],
           "content_types": ["$all"],
           "locales": ["en-us"],
           "environment": "environment_uid",
           "approvers": {
               "users": ["user_uid"],
               "roles": ["role_uid"]
           },
           "workflow_stage": "workflow_stage_uid",
           "disable_approver_publishing": false
       }
   }
import contentstack_management 
client = contentstack_management.Client(host='host_name')
client.login(email="email_id", password="password")
response = client.stack('api_key').workflows().update_publish_rule('rule_uid', data).json()
```

The data required to update the workflow stage for a specific entry

UID of the rule

## Workflows | Python Management SDK | Contentstack

Workflows lets you streamline content creation and publishing to manage your project's content lifecycle in the Contentstack Python Management SDK.