Scope requirements
Scope requirements
Scope requirements
To use any of the v4 endpoints, your app will need to be authorized to use theautomation scope. In addition, if you need to access sensitive data properties in a workflow, enroll records in a workflow that references sensitive data, or retrieve enrollment and performance data for workflows with sensitive data properties, you’ll need to authorize sensitive data scopes as detailed in the sections below.
Learn more about working with sensitive data.
Retrieving workflows that reference sensitive data
To retrieve enrollment and performance data for existing workflows that reference sensitive data properties, your app will need to request and be granted one of the scopes below, based on the enrolled record type in your workflow:crm.objects.contacts.sensitive.read: view enrollment and performance data for existing contact-based workflows.crm.objects.companies.sensitive.read: view enrollment and performance data for existing company-based workflows.crm.objects.deals.sensitive.read: view enrollment and performance data for existing deal-based workflows.crm.objects.custom.sensitive.read: view enrollment and performance data for workflows based on custom objects an account.
Creating and managing workflows that reference sensitive data
To create or delete workflows that reference sensitive data, or enroll records in an existing workflow, your app will need to request and be granted one of the scopes below, based on the enrolled record type of your workflow:crm.objects.contacts.sensitive.write: create and delete contact-based workflows via the v4 API, as well as enroll contacts in existing workflows that access sensitive data.crm.objects.companies.sensitive.write: create and delete company-based workflows via the v4 API, as well as enroll companies in existing workflows that access sensitive data.crm.objects.deals.sensitive.write: create and delete deal-based workflows via the v4 API, as well as enroll deals in existing workflows that access sensitive data.crm.objects.custom.sensitive.write: create and delete workflows based on custom objects via the v4 API, as well as enroll custom object records in existing workflows that access sensitive data.
Create a workflow
To create a workflow, make aPOST request to /automation/v4/flows and provide a workflow specification in the body of your request.
- Consult the action and enrollment types reference for information on specifying the
actionsin your workflow and configuring theenrollmentCriteria. - For contact-based workflows, set the
typetoCONTACT_FLOW. For all other workflow types (e.g., deal-based, goal-based, etc.), set thetypetoPLATFORM_FLOW.
- When a contact submits a specific form on your website, create a ticket in your account.
- After a 1 day delay, send an automated marketing email to the contact.
POST request will resemble the following:
Retrieve workflows
The sections below outline how to fetch details about specific workflows, or retrieve details for multiple workflows in a single call. When retrieving a workflow When retrieving workflows, you may need the workflow’sflowId to make a request. To retrieve the workflow’s flowId:
- In your HubSpot account, navigate to the workflow editor for the workflow that you’d like to retrieve, then check the URL for the second ID in the URL path.
- Alternatively, make a
GETrequest to/automation/v4/flowsto get all workflows and filter the resulting response by the name of your workflow.

Retrieve a specific workflow by ID
To retrieve data from an existing workflow, make aGET request to /automation/v4/flows/{flowId}, where flowId is the ID of an existing workflow in your account.
For example, if you made a GET request to /automation/v4/flows/12345678 to get the workflow with an ID of 12345678, you can expect the resulting response below.
The response includes the specification for a contact-based workflow with two actions, where contacts are enrolled if they filled out a form on your website. If there are actions with incomplete but required fields in your workflow, you may encounter errors when making this request.
Retrieve workflows in bulk using their IDs
To fetch multiple workflows using their IDs, you can make aPOST request to the /automation/v4/flows/batch/read endpoint. When doing so, you’ll need to provide the following within an inputs array provided in the request body:
- The ID of each workflow as the
flowId. - The
typeasFLOW_ID
12345678 and 87654321:
Retrieve all workflows
To retrieve all workflows in an account, you can make aGET request to /automation/v4/flows. Do note that the response will only include key fields for the workflow, such as id, isEnabled, objectTypeId, and the latest revisionId.
If you want to retrieve a full list of properties for a specific workflow, make a GET request to /automation/v4/flows/{flowId} and provide the specific ID of the workflow as the flowId.
Update a workflow
To update an existing workflow, make a PUT request to/automation/v4/{flowId} using the ID of your workflow you want to update as the flowId, and providing any properties you want to change in the request body.
- You must include the
revisionIdandtypeproperties in your request body. - The
revisionIdmust correspond to the most current revision of your workflow. This can be retrieved by making aGETrequest to/automation/v4/{flowId}. - Any existing data retrieved from the
GETrequest, not included in thePUTrequest, will be omitted from the updated workflow. For example, if an existing action is not included in the newPUTrequest to update the workflow, the action will be removed from the workflow. - If you’re creating a
PUTrequest with data retrieved from an earlierGETrequest, it is recommended to remove theCreatedAt,UpdatedAt, anddataSourcesfields to avoid validation errors.
"18":
Delete a workflow
To delete a workflow, make aDELETE request to /automation/v4/{flowId} using the ID of the workflow you want to delete as the flowId.