<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: enroll existing contacts via API in APIs &amp; Integrations</title>
    <link>https://community.hubspot.com/t5/APIs-Integrations/enroll-existing-contacts-via-API/m-p/1139043#M81700</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/651511"&gt;@GR73&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I believe no such parameter is present. But for a workaround, you can create a list, and that should be the trigger criteria of the workflow, make sure only such contacts fall in the list on whom you want the workflow to perform the action.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this will help you out. Please mark it as &lt;STRONG&gt;Solution Accepted and upvote&lt;/STRONG&gt; to help another Community member.&lt;BR /&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 22 Apr 2025 14:03:07 GMT</pubDate>
    <dc:creator>GRajput</dc:creator>
    <dc:date>2025-04-22T14:03:07Z</dc:date>
    <item>
      <title>enroll existing contacts via API</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/enroll-existing-contacts-via-API/m-p/1138938#M81698</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;When creating a workflow via the hubspot interface, after the creation, a dialog pops up and asks me wether i wish to enroll existing contacts.&lt;BR /&gt;However, I couldn't find such an option via the workflow API, no "enrollExistingContacts" flag, or something similar.&lt;BR /&gt;can anyone assist with enrolling existing contacts into new / existing workflow via the API?&amp;nbsp;&lt;BR /&gt;thanks&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 11:32:47 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/enroll-existing-contacts-via-API/m-p/1138938#M81698</guid>
      <dc:creator>GR73</dc:creator>
      <dc:date>2025-04-22T11:32:47Z</dc:date>
    </item>
    <item>
      <title>Re: enroll existing contacts via API</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/enroll-existing-contacts-via-API/m-p/1138967#M81699</link>
      <description>&lt;P&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/651511"&gt;@GR73&lt;/a&gt;&amp;nbsp;,&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt;To enroll existing contacts into workflow via API doesn't have a direct flag, Instead you can manuaaly enroll each contact using a simple API request. Follow these steps&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt;Retrieve your workflow ID in which you want to enroll the contacts into.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt;Get the list of contacts you wish to enroll in the workflow. You can fetch these via the contacts API using the condition you want the contacts to enroll.&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt;Now use the enrollment endpoint to add each contact to the workflow through HubSpot API&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt;POST /automation/v3/workflows/:&lt;STRONG&gt;workflowId&lt;/STRONG&gt;/enrollments/contacts/:&lt;STRONG&gt;contactId&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt;Replace workflowId and contactId with the one you have retrieved from Step 1 and 2&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt;Example code:&amp;nbsp;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt;async function enrollContactInWorkflow(contactId, workflowId, token) { const url = `&lt;A href="https://api.hubspot.com/automation/v3/workflows/${workflowId}/enrollments/contacts/${contactId" target="_blank"&gt;https://api.hubspot.com/automation/v3/workflows/${workflowId}/enrollments/contacts/${contactId&lt;/A&gt;}`; const options = { method: 'POST', headers: { 'Authorization': `Bearer ${token}`, 'Content-Type': 'application/json' } }; const response = await fetch(url, options); if (response.ok) { console.log(`Contact ${contactId} enrolled successfully.`); } else { const errorDetail = await response.json(); console.error('Error enrolling contact:', errorDetail); }}&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt;&lt;SPAN&gt;Make sure your API token has automation-workflows.read and automation-workflows.write permissions.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt;If this helps, feel free to mark it as the solution &lt;/FONT&gt;&lt;span class="lia-unicode-emoji" title=":heavy_check_mark:"&gt;✔️&lt;/span&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt; and give it an upvote &lt;/FONT&gt;&lt;span class="lia-unicode-emoji" title=":thumbs_up:"&gt;👍&lt;/span&gt;&lt;FONT face="trebuchet ms,geneva" size="2"&gt; !&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 12:32:35 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/enroll-existing-contacts-via-API/m-p/1138967#M81699</guid>
      <dc:creator>Jigar_Thakker</dc:creator>
      <dc:date>2025-04-22T12:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: enroll existing contacts via API</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/enroll-existing-contacts-via-API/m-p/1139043#M81700</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/651511"&gt;@GR73&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I believe no such parameter is present. But for a workaround, you can create a list, and that should be the trigger criteria of the workflow, make sure only such contacts fall in the list on whom you want the workflow to perform the action.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I hope this will help you out. Please mark it as &lt;STRONG&gt;Solution Accepted and upvote&lt;/STRONG&gt; to help another Community member.&lt;BR /&gt;Thanks!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Apr 2025 14:03:07 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/enroll-existing-contacts-via-API/m-p/1139043#M81700</guid>
      <dc:creator>GRajput</dc:creator>
      <dc:date>2025-04-22T14:03:07Z</dc:date>
    </item>
    <item>
      <title>Re: enroll existing contacts via API</title>
      <link>https://community.hubspot.com/t5/APIs-Integrations/enroll-existing-contacts-via-API/m-p/1139587#M81717</link>
      <description>&lt;P&gt;I finally made it work, thanks to&amp;nbsp;&lt;a href="https://community.hubspot.com/t5/user/viewprofilepage/user-id/610147"&gt;@Jigar_Thakker&lt;/a&gt;&amp;nbsp;appraoch.&lt;BR /&gt;however, the api provided above is wrong, the correct api is:&lt;BR /&gt;`&lt;A href="https://api.hubapi.com/automation/v2/workflows/${workflowId}/enrollments/contacts/${email" target="_blank"&gt;https://api.hubapi.com/automation/v2/workflows/${workflowId}/enrollments/contacts/${email&lt;/A&gt;}`.&lt;BR /&gt;another signifiact issue is that the workflow ids have been changed in v4, so in order to the call to work, i had to first call a mapping function in order to get the v2 version of the workflow id:&lt;BR /&gt;`curl --request POST \&lt;BR /&gt;--url &lt;A href="https://api.hubapi.com/automation/v4/workflow-id-mappings/batch/read" target="_blank"&gt;https://api.hubapi.com/automation/v4/workflow-id-mappings/batch/read&lt;/A&gt; \&lt;BR /&gt;--header 'authorization: Bearer YOUR_ACCESS_TOKEN' \&lt;BR /&gt;--header 'content-type: application/json' \&lt;BR /&gt;--data '{&lt;BR /&gt;"inputs": {&lt;BR /&gt;"flowMigrationStatuses": "${v4_workflowId}",&lt;BR /&gt;"type": "FLOW_ID"&lt;BR /&gt;}&lt;BR /&gt;}'`&lt;BR /&gt;&lt;BR /&gt;and use the result as an input to enrollment call.&lt;BR /&gt;&lt;BR /&gt;documentation:&lt;BR /&gt;&lt;A href="https://developers.hubspot.com/docs/reference/api/automation/create-manage-workflows/v2" target="_blank" rel="noopener"&gt;https://developers.hubspot.com/docs/reference/api/automation/create-manage-workflows/v2&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;&lt;A href="https://developers.hubspot.com/docs/reference/api/automation/create-manage-workflows#post-%2Fautomation%2Fv4%2Fworkflow-id-mappings%2Fbatch%2Fread" target="_blank"&gt;https://developers.hubspot.com/docs/reference/api/automation/create-manage-workflows#post-%2Fautomation%2Fv4%2Fworkflow-id-mappings%2Fbatch%2Fread&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://developers.hubspot.com/changelog/new-features-for-the-v4-automation-api" target="_blank" rel="noopener"&gt;https://developers.hubspot.com/changelog/new-features-for-the-v4-automation-api&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Apr 2025 11:46:13 GMT</pubDate>
      <guid>https://community.hubspot.com/t5/APIs-Integrations/enroll-existing-contacts-via-API/m-p/1139587#M81717</guid>
      <dc:creator>GR73</dc:creator>
      <dc:date>2025-04-23T11:46:13Z</dc:date>
    </item>
  </channel>
</rss>

