Need Help: Fetching Enrollment Details for a Contact in Workflow Using HubSpot API

Hello HubSpot Community,

I’m trying to fetch enrollment details for a specific contact in a workflow using the HubSpot API, but I’m running into issues and could use some guidance. Here’s a breakdown of my situation:

  • Goal: I need to retrieve enrollment details (e.g., enrolledAt, status, and any related list IDs like enrolledListId or enrolledIlsListId) for contact ID XYZ in the workflow (workflow ID: XYZ).
  • Approach: I’ve been using the /automation/v2/workflows/{workflow_id}/enrollments and /automation/v2/workflows/enrollments/contacts/{contactId} endpoints with a personal access token (XYZ). I’ve also tried the v4 endpoint (/automation/v4/automation-workflows/enrollments) as a fallback.
  • Issue: I consistently get a 404 Client Error: Not Found response, and the scripts I’ve written (using Python with the requests library) fail to return enrollment data. Even when fetching all workflows, no details are retrieved.

Hi @Piyush_ and welcome, we are delighted to have you here!
Thanks for reaching out to the HubSpot Community!
Did you double-check the workflow ID source?
Here is the documentation for reference: “Current enrollment API”.
I’d love to put you in touch with our Top Experts: Hi @evaldas, @GR73, @EmilianoVidela and @MichaelMa do you have suggestions to help @Piyush_, please?
Have a great day and thanks so much for your help!
Bérangère

Hi @Piyush_,

The endpoint “/automation/v2/workflows/{workflow_id}/enrollments” does not actually exist. That is my guess why you are getting a 404.

The closest thing to the above is the Current enrollment endpoint: “/automation/v2/workflows/enrollments/contacts/{vid}” - it returns all the workflows that the contact is currently enrolled in. Just to note - any workflows that have been already completed by the contact will not be returned by this endpoint.

Hope this helps!