Hi!
I am working on a solution to update the enrollment criteria of many workflows with the API, however when I send the mandatory parameters in the body, plus the new enrollmentCriteria object, like this:
{
"type":"CONTACT_FLOW",
"isEnabled":true,
"revisionId":"45",
"enrollmentCriteria": newEnrollmentCriteria
}
the procedure removes all the data that I haven’t sent in the update request. Basically, the name, description, all the actions etc.
Before the update:
Request details:
Method: PUT
URL:
https://api.hubapi.com/automation/v4/flows/${workflowId}
Headers:
{
"accept": "application/json",
"content-type": "application/json",
"authorization": `Bearer ${accessToken}`,
}
Body:
{
"type": "CONTACT_FLOW",
"isEnabled": true,
"revisionId": "58",
"enrollmentCriteria": {
"shouldReEnroll": false,
"listFilterBranch": {
"filterBranches": [
{
"filterBranches": [],
"filters": [
{
"property": "email",
"operation": {
"operator": "IS_EQUAL_TO",
"includeObjectsWithNoValueSet": false,
"values": [
"test@test.com"
],
"operationType": "MULTISTRING"
},
"filterType": "PROPERTY"
}
],
"filterBranchType": "AND",
"filterBranchOperator": "AND"
}
],
"filters": [],
"filterBranchType": "OR",
"filterBranchOperator": "OR"
},
"unEnrollObjectsNotMeetingCriteria": false,
"reEnrollmentTriggersFilterBranches": [],
"type": "LIST_BASED"
}
}
After the update:
Quoting the documentation from Accounts Dashboard | HubSpot
Based on this description, I would expect API to try to update only the provided details of the workflow, not to remove every detail which is missing from the body.
In an ideal situation, I could get the whole workflow details, change the parts that I want, and send it back in the update, but not all the actions are covered 100% correctly. For example, the “Send email” action in the API response does not indicate which contacts are the targeted ones: the enrolled or the associated ones. So, without being 100% reliable, we can’t use it like that.
I’d appreciate any workaround ideas or a permanent fix from the Hubspot side.
Thank you!


