# Enroll contact in new workflow - API

**URL:** <https://community.hubspot.com/t/enroll-contact-in-new-workflow-api/50245>\
**Category:** Data Hub\
**Tags:** workflows, contacts\
**Created:** [January 24, 2022, 9:58am UTC](https://community.hubspot.com/t/enroll-contact-in-new-workflow-api/50245 "2022-01-24T09:58:35Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChrisChiha](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/chrischiha/32/90510_2.png) [@ChrisChiha](https://community.hubspot.com/u/ChrisChiha)\
**Post date:** [January 24, 2022, 9:58am UTC](https://community.hubspot.com/t/enroll-contact-in-new-workflow-api/50245/1 "2022-01-24T09:58:35Z")

</div>

Hello,

I previously tried enrolling a contact from my custom code using the enrol API : [https://legacydocs.hubspot.com/docs/methods/workflows/add\_contact](https://legacydocs.hubspot.com/docs/methods/workflows/add_contact) and it worked smoothly !

I went today to test my custom code again, and the request is returning 404 error. resource not found.

`2022-01-24T09:50:50.907Z	ERROR	Unhandled Promise Rejection {"errorType":"Runtime.UnhandledPromiseRejection","errorMessage":"HttpError: HTTP request failed","reason":{"errorType":"HttpError","errorMessage":"HTTP request failed","response":{"statusCode":404,"body":{"status":"error","message":"resource not found",...`

Does this mean there’s a problem with the API itself or any action that should be taken from my end on my code level ?

My code : ( I am just fetching an email from my deal and passing it to the API to enroll in another workflow, it was working fine a week ago)

const hubspot = require(‘@hubspot/api-client’);

exports.main = (event, callback) =\> {

const hubspotClient = new hubspot.Client({

apiKey: process.env.hapikey

});

var customerEmail = event.inputFields[‘customer\_email’]

console.log(customerEmail)

hubspotClient.apiRequest({

method: ‘POST’,

path: `/automation/v2/workflows/166637661/enrollments/contacts/${customerEmail}?hapikey=${process.env.HAPIKEY}`

});

}

Thanks,

---

<div class="post-metadata">

**Author:** ![VMykhailiuk](https://avatars.discourse-cdn.com/v4/letter/v/6bbea6/32.png) [@VMykhailiuk](https://community.hubspot.com/u/VMykhailiuk)\
**Post date:** [October 31, 2024, 2:48pm UTC](https://community.hubspot.com/t/enroll-contact-in-new-workflow-api/50245/2 "2024-10-31T14:48:31Z")

</div>

Hi! I am having same issue right now, have you figured it out?
