Create a workflow

Last updated June 17, 2020

POST /automation/v2/workflows

Method Details

HTTP Methods:

POST

Response Format:

json

Requires Authentication?

Yes

Rate Limited?

Yes

Headers

User-Agent

Products:

Marketing

Create a new workflow in a portal. Workflows are an essential component of the HubSpot marketing product, allowing marketing automation that relies on triggering relevant and timely actions, based on a user's context.

This v2 endpoint is deprecated. Please use the v3 endpoint:
http://developers.hubspot.com/docs/methods/workflows/v3/create_workflow

Required Parameters How to use Description
HubSpot API Key hapikey=X - Used in the request URL The HubSpot API key for the portal that you're making the call for.
Workflow JSON Used in the request body This is JSON that represents the workflow that you're creating.
Optional Parameters How to use Description
None None No optional parameters for this method.

Example URL is here:  https://api.hubapi.com/automation/v2/workflows?hapikey=demo

A good way to see exactly what email IDs and list IDs you want to reference in your JSON as workflow steps would be to create your workflow manually and copy the JSON of these steps. We have documented some of the key parameters below:

Parameter Definition Value
enabled If the workflow is active or not. true/false
allowContactToTriggerMultipleTimes If the same contact can enter the workflow more than once. true/false
name The name of the workflow string
onlyExecOnBizDays A setting indicating whether the workflow can execute on business days only true/false
canEnrollFromSalesforce A setting indicating whether the workflow is available to be seen from the HubSpot embed in Salesforce. true/false
type If this workflow is based on enrollment or revoles around a static or dynamic date DRIP_DELAY, STATIC_ANCHOR or PROPERTY_ANCHOR
staticDateAnchor If the workflow type is STATIC_ANCHOR, define the date mm/dd/yyyy
contactPropertyAnchor If the workflow type is PROPERTY_ANCHOR, define the property property name
nurtureTimeRange Use enabled to set it enabled can be false/true
unenrollmentSetting Used for kickout workflows. If none, use type:"None" - if this workflows can kick contacts out of others, list them after excludedWorkflows type and excludedWorkflows
suppressionSetting Use for suppression lists. Use listIds if you want set any listIds
steps Includes step information See the HubSpot product for possible steps
goalList List ID that the workflow is using for its goal list listIds
listening If when contacts leave the list, they should also leave the workflow. true/false

Your content type that you pass in the header of your request should be 'application/json'.