Create Approval Workflows
This tutorial demonstrates how to create an approval workflow in a project. The steps include preparing the workflow payload, creating the workflow, and confirming that the workflow has been created successfully. You can also query a specific workflow or list all workflows available in the project.
Approval workflows control the sequence of steps that files must pass through before they are approved. Each workflow includes at least an Initiator step and an Approver step, and can also include one or more Reviewer steps. The order of steps must always begin with the Initiator and end with the Approver.
Before You Begin
-
Register an app, and select
Forma APIsin theAPI Accessdropdown. -
Acquire a 3-legged or 2-legged OAuth token with
data:readanddata:writescopes for operating approval workflows.- For a 3-legged token, ensure that the user is a project administrator.
- For a 2-legged token, the
x-user-idheader is required. Retrieve the user’s Autodesk ID by calling GET projects/:projectId/users with your 2-legged OAuth token and the user’s email address. Ensure that the user is a project administrator.
-
Find the project ID for the project you want to create an approval workflow in by following the Retrieve a Forma Hub ID and Project ID tutorial. In this example, assume the project ID is
9ba6681e-1952-4d54-aac4-9de6d9858dd4. -
Verify that you have access to the relevant Forma hub, project, and folders.
- If you need to obtain the URNs of folders, follow the Export Files From the Forma Files Tool tutorial to get the URNs you need.
-
If you plan to use
attachedAttributesin your workflow, retrieve the custom attribute definition IDs first. Call GET custom-attribute-definitions using the project ID, and note theidfield from each definition — these are the values you will use inattachedAttributes.
Step 1: Prepare the Workflow Payload
Before creating an approval workflow, you must prepare a JSON-formatted payload that defines the workflow’s steps, options, and any custom attributes you want to attach. Use attachedAttributes to specify the custom attributes and updateAttributesOptions to control how they are applied after the review is complete. This payload will be used in Step 2 when you call POST Workflow.
The steps must follow a specific order: * The Initiator step must come first. * The Approver step must come last. * Any Reviewer steps must be placed between them in the order you want them executed.
The Initiator step is not displayed in the web interface diagram of the workflow, so it is usually not considered a user-operated step. However, it is still required in the payload, as it determines who has permission to create a review.
1-Step Approval Workflow (Initiator + Approver)
The following example shows a minimal approval workflow with only one Initiator step and one user-operated step, the Approver.
3-Step Approval Workflow with Reviewers (Initiator + Reviewer 1 + Reviewer 2 + Approver)
You can also define multiple Reviewer steps. Each Reviewer step is executed in sequence. The next step begins only when reviewers in the current step complete their tasks and the configured conditions are met.
Reviewer steps can be Single or Multiple, depending on the groupReview setting:
- If
groupReview.enabled = false, the step is treated as a Single Reviewer step. - If
groupReview.enabled = true, the step is treated as a Multiple Reviewer step. You can configure rules such as a minimum number of reviewers required.
Notes
- Step order is required — The workflow must start with
INITIATOR, end withAPPROVER, and place anyREVIEWERsteps in between in execution order. - Initiator is required — The
INITIATORstep is not shown in the UI diagram but must be included in the payload to control who can create reviews. - Initiator edit settings —
allowInitiatorToEditremains available for backward compatibility but is deprecated. UseinitiatorEditPermissionsto control what initiators can edit when starting a review. To preserve the legacy behavior of allowing initiators to edit reviewer assignments and step durations, setinitiatorEditPermissionstoREVIEWER_ASSIGNMENTS_AND_DURATION. Additional permissions includeAPPROVERS(edit approver candidates),CLOSED_REVIEW_TITLE(allows renaming closed reviews), andSTART_OWN_REVIEW(allows initiators to start their own reviews). - Approver edit settings — Use
approverEditPermissionsto control what approvers can modify during an active review. SettingAPPROVERSallows approvers to delegate by modifying the approver candidate list for their step. - Attached custom attributes — Use
attachedAttributesto include custom attributes in the workflow definition. UseupdateAttributesOptionsto control how those attributes are applied after the review completes. - Custom attribute IDs — The
idvalues inattachedAttributesmust match project-level custom attribute definitions. Call GET custom-attribute-definitions with the project ID to retrieve valid IDs. - Attribute update prerequisites —
updateAttributesOptionsapply only when the workflow includes a copy action andenableAttachedAttributesistrue.allowApproverToUpdateRejectedFilesapplies only when bothenableAttachedAttributesandupdateSourceAndCopiedFilesaretrue.
Step 2: Create an Approval Workflow
Use the project ID (9ba6681e-1952-4d54-aac4-9de6d9858dd4) and the payload you prepared in Step 1 to call POST workflow, and create a new approval workflow in the project.
The following example shows a 3-step approval workflow (Initiator + Reviewer + Approver).
Request
Response
After the workflow is created, its settings can also be updated in the Reviews section of the web interface.
The id of each step in the response is automatically generated and must be used when calling POST review.
Step 3: Retrieve an Approval Workflow
Use the project ID (9ba6681e-1952-4d54-aac4-9de6d9858dd4) and the workflow ID returned in Step 2 to call GET approval workflow, and retrieve the details of a specific workflow.
Request
Response
Step 4 (optional): List Approval Workflows
Use the project ID (9ba6681e-1952-4d54-aac4-9de6d9858dd4) to call GET workflows. and retrieve all approval workflows available in the project.
Use the limit and offset parameters to paginate the results. The default limit is 50 and the default offset is 0. If the response does not include a nextUrl, you have reached the last page of results.
Request
Response
Notes
- Use the
filter[status]parameter to restrict results (e.g.,ACTIVEorINACTIVE). - Use the
nextUrlfield to retrieve the next page of results when paginating.
Imported from the Autodesk Platform Services documentation: https://aps.autodesk.com/en/docs/acc/v1/tutorials/reviews/reviews-create-workflow.