• Register

Workflow API

The Workflow API allows you to create a new workflow, list tasks and workflows, and cancel workflows.

Create Workflow

This endpoint is used to create a new workflow on a file.

POST/pubapi/v1/workflows

Request Parameters in the Request Body

Parameter Description Required Possible Values
name The name of the workflow Yes A non-empty string
file Group ID of a file for which you want to create the workflow Yes {"groupId": GROUP_ID}
E.g. {"groupId":"4ffd13e7-bb21-4fb8-845b-4b9f0689882c"}
reasonForChange The reason for changing the document, only valid for customers with GxP Workflows No A non-empty string
workflowType The type of workflow. Value TODO can be used for a single-step workflow with a TODO step. Value Approval can be used for a single-step workflow with an APPROVAL step. Value REVIEW_APPROVE is the default and can be used for any workflow. No One of the following: TODO, APPROVAL, REVIEW_APPROVE
steps An array of step definitions Yes See table below for details on each field in a step definition

Step Definition

Parameter Description Required Possible Values
name The name of the step Yes A non-empty string
description The description of the step No A non-empty string
type The type of the step Yes One of the following: TODO, REVIEW, APPROVAL
stepOptions Options for the step Yes See table below for details on each field in a step definition

Step Options Definition

Parameter Description Required Possible Values
assignees An array of assignees for the step Yes One or more user integer IDs, e.g., [1, 27, 422]
minMustComplete The number of assignees who must complete the task for the step to be considered complete No A positive integer less than or equal to the number of assignees. If ommited or set to null, all assignees must complete their tasks for the step to be completed.
dueDate Due date of the step No Date in ISO-8601 format e.g., 2022-02-27T14:00:00Z
signatureRequired Boolean option for APPROVAL steps that controls whether digital signatures are required for users approving the document. Can only be set to true for accounts with GxP Workflows enabled. Yes for APPROVAL steps

No for TODO or REVIEW steps
true or false

Request Examples

POST /pubapi/v1/workflows HTTP/1.1
Host: apidemo.egnyte.com
Authorization: Bearer 68zc95e3xv954u6k3hbnma3q
Content-Type: application/json
{
	"name": "Demo Workflow",
  "workflowType": "REVIEW_APPROVE",
	"file": {
		"groupId": "3d1d09d3-4533-4f90-b561-2d4ecdeba259"
	},
	"steps": [
		{
			"name": "Document Review",
			"type": "REVIEW",
			"description": "Please review this file",
			"stepOptions": {
				"dueDate": "2022-02-24T18:00:00Z",
				"assignees": [
					1, 46
				],
        "minMustComplete": 1
			}
		},
		{
			"name": "Document Approval",
			"type": "APPROVAL",
			"description": "Please approve this file",
			"stepOptions": {
				"dueDate": "2022-03-02T18:00:00Z",
				"assignees": [
					16
				],
                "signatureRequired": false
			}
		}
	]
}

Sample Response

{
	"workflowId": "403eeaaf-6997-47f8-bbb0-6092ce4c5196"
}

Get Workflow Details

This endpoint is used to fetch the details of a workflow

GET/pubapi/v1/workflows/{WORKFLOW_ID}

Request Parameters in the URL

Parameter Description Required Possible Values
WORKFLOW_ID The ID of the workflow you would like the fetch Yes The workflow id

Request Examples

GET /pubapi/v1/workflows/403eeaaf-6997-47f8-bbb0-6092ce4c5196 HTTP/1.1
Host: apidemo.egnyte.com
Authorization: Bearer 68zc95e3xv954u6k3hbnma3q

Sample Response

{
    "id": "0ec5926c-afc5-46bd-aa0e-7540e675d808",
    "name": "Demo Workflow",
    "reasonForChange": null,
    "status": "IN_PROGRESS",
    "workflowCompletionStatus": null,
    "creationDate": "2022-02-23T16:19:14.519Z",
    "completionDate": null,
    "creator": {
        "id": 1,
        "username": "jsmith",
        "firstName": "James",
        "lastName": "Smith",
        "email": "jsmith@example.com"
    },
    "steps": [
        {
            "id": "85627761-07b2-4ec8-9f94-10d9cd39a92a",
            "name": "Document Review",
            "description": "Please review this file",
            "type": "REVIEW",
            "status": "IN_PROGRESS",
            "dueDate": "2022-02-24T18:00:00Z",
            "startDate": "2022-02-23T16:19:14.635Z",
            "completionDate": null,
            "signatureRequired": null,
            "minMustComplete": null,
            "tasks": [
                {
                    "id": "2b4a7375-7131-4f6b-b298-f4bfd59633ae",
                    "type": "REVIEW",
                    "status": "IN_PROGRESS",
                    "dueDate": "2022-02-24T18:00:00Z",
                    "creationDate": "2022-02-23T16:19:14.635Z",
                    "completionDate": null,
                    "assignee": {
                        "id": 17,
                        "username": "grandolph",
                        "firstName": "Greg",
                        "lastName": "Randolph",
                        "email": "grandolph@example.com"
                    }
                },
                {
                    "id": "3c1e7375-7131-4f6b-b298-f4bfd59633a2",
                    "type": "REVIEW",
                    "status": "COMPLETED",
                    "dueDate": "2022-02-24T18:00:00Z",
                    "creationDate": "2022-02-23T16:19:14.635Z",
                    "completionDate": "2022-02-24T16:03:27Z",
                    "assignee": {
                        "id": 22,
                        "username": "pbloom",
                        "firstName": "Petunia",
                        "lastName": "Bloom",
                        "email": "pbloom@example.com"
                    }
                }
            ],
            "comments": [
				{
					"id": "51a317e6-bd48-488c-a190-75962fe83452",
					"message": "Looks good to me!",
					"tags": [
					],
					"timestamp": 1645650964117,
					"author": {
						"status": "ACTIVE",
						"username": "grandolph",
						"email": "grandolph@example.com",
						"firstName": "Greg",
						"lastName": "Grandolph",
						"typeName": "admin",
						"id": 17
					},
					"mentioned": {
					}
				}
			]
        },
        {
            "id": "6157337b-93ec-4658-86de-608642fab34d",
            "name": "Document Approval",
            "description": "Please approve this file",
            "type": "APPROVAL",
            "status": "NOT_STARTED",
            "dueDate": "2022-03-02T18:00:00Z",
            "startDate": "1970-01-01T00:00:00Z",
            "completionDate": null,
            "signatureRequired": false,
            "minMustComplete": null,
            "tasks": [
                {
                    "id": "e4b52ff2-bdb6-48c5-b4ac-dec423a2ccf5",
                    "type": "APPROVAL",
                    "status": "NOT_STARTED",
                    "dueDate": "1970-01-01T00:00:00Z",
                    "creationDate": "1970-01-01T00:00:00Z",
                    "completionDate": null,
                    "assignee": {
                        "id": 6,
                        "username": "erockland",
                        "firstName": "Emily",
                        "lastName": "Rockland",
                        "email": "erockland@example.com"
                    }
                }
            ],
            "comments": [
            ]
        }
    ],
    "file": {
        "groupId": "3d1d09d3-4533-4f90-b561-2d4ecdeba259",
        "entryId": "19efb714-db45-44c5-8e47-f185f0fdd5d9"
    }
}

List Workflows

This endpoint is used to list workflows. When executed as an admin it will list all workflows in a domain. When executed as a non-admin it will execute only the workflows that the current user created.

GET/pubapi/v1/workflows

Request Parameters in the URL

Parameter Description Required Possible Values
assignerId Finds workflows created by a specific user No The integer user id
assigneeId Finds workflows that are assigned to a specific user No The integer user id
groupId Finds workflows created on a specific file No The Group ID of the file
status Finds workflows with a specific status No One of the following workflow status types: NOT_STARTED IN_PROGRESS, BEING_CANCELLED, CANCELLED, SUSPENDED, COMPLETED
completionStatus Finds completed approval workflows with a specific approval status No One of the following approval status types: APPROVED, REJECTED
limit The maximum number of workflows to return in each call. Default is 25. No An integer between 1 and 25
offset A zero-based index which can be used with the limit to paginate the list of tasks. Offset defaults to 0. No Integer greater than or equal to zero and less than the totalCount of workflows.
sortBy The field to sort by. Defaults to DUE_DATE. No One of the following fields: NAME,
CREATION_DATE,
DUE_DATE,
COMPLETION_DATE,
WORKFLOW_STATUS,
WORKFLOW_COMPLETION_STATUS
sortDirection The direction of the sort. Defaults to ASC. No One of the following directions: ASC, DESC

Request Examples

GET /pubapi/v1/workflows?status=IN_PROGRESS&sortBy=CREATION_DATE&sortDirection=DESC HTTP/1.1
Host: apidemo.egnyte.com
Authorization: Bearer 68zc95e3xv954u6k3hbnma3q

Sample Response

{
    "results": [
        {
            "id": "0ec5926c-afc5-46bd-aa0e-7540e675d808",
            "name": "Demo Workflow",
            "description": null,
            "reasonForChange": null,
            "creationDate": "2022-02-23T16:19:14.519Z",
            "dueDate": "2022-03-02T18:00:00Z",
            "completionDate": null,
            "workflowDisplayId": 85,
            "type": "REVIEW_APPROVE",
            "status": "IN_PROGRESS",
            "completionStatus": null,
            "creator": {
                "id": 1,
                "username": "jsmith",
                "firstName": "James",
                "lastName": "Smith",
                "email": "jsmith@example.com"
            },
            "currentStepNum": 1,
            "totalSteps": 2,
            "currentStepProgress": 0,
            "assignees": [
                {
                    "id": 1,
                    "username": "grandolph",
                    "firstName": "Greg",
                    "lastName": "Randolph",
                    "email": "grandolph@example.com"
                }
            ],
            "file": {
                "groupId": "3d1d09d3-4533-4f90-b561-2d4ecdeba259",
                "entryId": "19efb714-db45-44c5-8e47-f185f0fdd5d9"
            }
        }
    ],
    "totalCount": 85
}

List Tasks

This endpoint is used to list the tasks assigned to the current user.

GET/pubapi/v1/workflows/tasks

Request Parameters in the URL

Parameter Description Required Possible Values
status Finds tasks with a specific status No One of the following workflow status types: NOT_STARTED IN_PROGRESS, BEING_CANCELLED, CANCELLED, SUSPENDED, APPROVED, REJECTED, COMPLETED
limit The maximum number of tasks to return in each call. Default is 50. No An integer between 1 and 50
offset A zero-based index which can be used with the limit to paginate the list of tasks. Offset defaults to 0. No Integer greater than or equal to zero and less than the totalCount of tasks.
sortBy The field to sort by. Defaults to DUE_DATE. No One of the following fields: NAME,
DUE_DATE,
STATUS,
TASK_TYPE
sortDirection The direction of the sort. Defaults to ASC. No One of the following directions: ASC, DESC

Request Examples

GET /pubapi/v1/workflows/tasks?status=IN_PROGRESS HTTP/1.1
Host: apidemo.egnyte.com
Authorization: Bearer 68zc95e3xv954u6k3hbnma3q

Sample Response

{
    "results": [
        {
            "id": "37296067-29b3-4ce7-b419-45249a1b3e9e",
            "name": "Review",
            "description": "Please review this policy update",
            "creationDate": "2022-02-22T16:49:27.812Z",
            "dueDate": "2022-02-26T06:59:59.999Z",
            "completionDate": null,
            "status": "IN_PROGRESS",
            "taskType": "REVIEW",
            "workflow": {
                "id": "f1ae9f50-c5fc-45b1-9345-67e98f906d63",
                "name": "Policy Update"
            },
            "assigner": {
                "id": 1,
                "username": "jsmith",
                "firstName": "James",
                "lastName": "Smith",
                "email": "jsmith@example.com"
            },
            "file": {
                "groupId": "3d1d09d3-4533-4f90-b561-2d4ecdeba259",
                "entryId": "19efb714-db45-44c5-8e47-f185f0fdd5d9"
            }
        }
    ],
    "totalCount": 28
}

Cancel Workflow

This endpoint is used to cancel an in progress workflow

POST/pubapi/v1/workflows/{WORKFLOW_ID}/cancel

Request Parameters in the URL

Parameter Description Required Possible Values
WORKFLOW_ID The ID of the workflow you would like to cancel Yes The workflow id

Request Examples

POST /pubapi/v1/workflows/403eeaaf-6997-47f8-bbb0-6092ce4c5196/cancel HTTP/1.1
Host: apidemo.egnyte.com
Authorization: Bearer 68zc95e3xv954u6k3hbnma3q
Content-Type: application/json

Sample Response

This API returns an HTTP 204 status code with no response body on success