POST
/
automation
/
v4
/
flows
Create a new workflow
curl --request POST \
  --url https://api.hubapi.com/automation/v4/flows \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "type": "CONTACT_FLOW",
  "objectTypeId": "<string>",
  "canEnrollFromSalesforce": true,
  "isEnabled": true,
  "flowType": "WORKFLOW",
  "name": "<string>",
  "description": "<string>",
  "uuid": "<string>",
  "startActionId": "<string>",
  "actions": [
    {
      "staticBranches": [
        {
          "branchValue": "some_value",
          "connection": {}
        }
      ],
      "defaultBranchName": "Other",
      "defaultBranch": {
        "nextActionId": "<string>",
        "edgeType": "<string>"
      },
      "inputValue": "{ \"type\": \"STATIC_VALUE\", \"staticValue\": \"test_value\" }",
      "actionId": "1",
      "type": "STATIC_BRANCH"
    }
  ],
  "enrollmentCriteria": {
    "listFilterBranch": {
      "filterBranchType": "OR",
      "filterBranches": [
        "<any>"
      ],
      "filterBranchOperator": "<string>",
      "filters": [
        "<any>"
      ]
    },
    "reEnrollmentTriggersFilterBranches": [
      {
        "filterBranchType": "OR",
        "filterBranches": [
          "<any>"
        ],
        "filterBranchOperator": "<string>",
        "filters": [
          "<any>"
        ]
      }
    ],
    "unEnrollObjectsNotMeetingCriteria": false,
    "shouldReEnroll": false,
    "type": "\"LIST_BASED\""
  },
  "enrollmentSchedule": {
    "type": "DAILY",
    "timeOfDay": {
      "hour": 123,
      "minute": 123
    }
  },
  "timeWindows": [
    {
      "startTime": {
        "hour": 123,
        "minute": 123
      },
      "endTime": {
        "hour": 123,
        "minute": 123
      },
      "day": "MONDAY"
    }
  ],
  "blockedDates": [
    {
      "month": "JANUARY",
      "year": 123,
      "dayOfMonth": 123
    }
  ],
  "customProperties": {},
  "dataSources": [
    {
      "objectTypeId": "<string>",
      "name": "<string>",
      "associationTypeId": 123,
      "associationCategory": "HUBSPOT_DEFINED",
      "sortBy": {
        "property": "<string>",
        "missing": "<string>",
        "order": "ASC"
      },
      "type": "ASSOCIATION"
    }
  ],
  "suppressionListIds": [
    123
  ],
  "goalFilterBranch": {
    "filterBranchType": "OR",
    "filterBranches": [
      "<any>"
    ],
    "filterBranchOperator": "<string>",
    "filters": [
      "<any>"
    ]
  },
  "eventAnchor": {
    "type": "CONTACT_PROPERTY_ANCHOR",
    "contactProperty": "example_date_property"
  },
  "unEnrollmentSetting": {
    "flowIds": [
      "<string>"
    ],
    "type": "ALL"
  }
}'
{
  "type": "CONTACT_FLOW",
  "id": "<string>",
  "isEnabled": true,
  "flowType": "WORKFLOW",
  "revisionId": "<string>",
  "name": "<string>",
  "description": "<string>",
  "uuid": "<string>",
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "startActionId": "<string>",
  "nextAvailableActionId": "<string>",
  "actions": [
    {
      "staticBranches": [
        {
          "branchValue": "some_value",
          "connection": {}
        }
      ],
      "defaultBranchName": "Other",
      "defaultBranch": {
        "nextActionId": "<string>",
        "edgeType": "<string>"
      },
      "inputValue": "{ \"type\": \"STATIC_VALUE\", \"staticValue\": \"test_value\" }",
      "actionId": "1",
      "type": "STATIC_BRANCH"
    }
  ],
  "enrollmentCriteria": {
    "listFilterBranch": {
      "filterBranchType": "OR",
      "filterBranches": [
        "<any>"
      ],
      "filterBranchOperator": "<string>",
      "filters": [
        "<any>"
      ]
    },
    "reEnrollmentTriggersFilterBranches": [
      {
        "filterBranchType": "OR",
        "filterBranches": [
          "<any>"
        ],
        "filterBranchOperator": "<string>",
        "filters": [
          "<any>"
        ]
      }
    ],
    "unEnrollObjectsNotMeetingCriteria": false,
    "shouldReEnroll": false,
    "type": "\"LIST_BASED\""
  },
  "enrollmentSchedule": {
    "type": "DAILY",
    "timeOfDay": {
      "hour": 123,
      "minute": 123
    }
  },
  "timeWindows": [
    {
      "startTime": {
        "hour": 123,
        "minute": 123
      },
      "endTime": {
        "hour": 123,
        "minute": 123
      },
      "day": "MONDAY"
    }
  ],
  "blockedDates": [
    {
      "month": "JANUARY",
      "year": 123,
      "dayOfMonth": 123
    }
  ],
  "customProperties": {},
  "dataSources": [
    {
      "objectTypeId": "<string>",
      "name": "<string>",
      "associationTypeId": 123,
      "associationCategory": "HUBSPOT_DEFINED",
      "sortBy": {
        "property": "<string>",
        "missing": "<string>",
        "order": "ASC"
      },
      "type": "ASSOCIATION"
    }
  ],
  "crmObjectCreationStatus": "PENDING",
  "suppressionListIds": [
    123
  ],
  "goalFilterBranch": {
    "filterBranchType": "OR",
    "filterBranches": [
      "<any>"
    ],
    "filterBranchOperator": "<string>",
    "filters": [
      "<any>"
    ]
  },
  "canEnrollFromSalesforce": true,
  "eventAnchor": {
    "type": "CONTACT_PROPERTY_ANCHOR",
    "contactProperty": "example_date_property"
  },
  "unEnrollmentSetting": {
    "flowIds": [
      "<string>"
    ],
    "type": "ALL"
  },
  "objectTypeId": "<string>"
}
Supported products
Requires one of the following products or higher.
Marketing HubMarketing HubFree
Sales HubSales HubFree
Service HubService HubFree
Content HubContent HubFree

Required Scopes

This API requires one of the following scopes:
  • automation

Authorizations

Authorization
string
header
required

The access token received from the authorization server in the OAuth 2.0 flow.

Body

application/json

Response

201
application/json

successful operation

The response is of type object.