# Create association between custom object and contacts via API

**URL:** <https://community.hubspot.com/t/create-association-between-custom-object-and-contacts-via-api/110943>\
**Category:** APIs & Integrations\
**Tags:** integrations, crm, object\
**Created:** [July 9, 2024, 1:03pm UTC](https://community.hubspot.com/t/create-association-between-custom-object-and-contacts-via-api/110943 "2024-07-09T13:03:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![SLEisig](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@SLEisig](https://community.hubspot.com/u/SLEisig)\
**Post date:** [July 9, 2024, 1:03pm UTC](https://community.hubspot.com/t/create-association-between-custom-object-and-contacts-via-api/110943/1 "2024-07-09T13:03:25Z")

</div>

Hi,

We are trying to associate a contact to a custom object in HubSpot by using Power Automate and Hubspot API. We have set up a private app and Power Automate and tested, that it works.

Our custom object is an Event, the object type id is 2-119772789, an the one we are using in the URI. The specific event id is 5229127388 where we want to associate the contact record id 2803.

We are using the following URI: [https://api.hubapi.com/crm/v3/associations/2-119772789 /Contacts/batch/create](https://api.hubapi.com/crm/v3/associations/2-119772789%20/Contacts/batch/create)

In the body we are having the following raw Json code:

{

“‘Input’”: [

“‘from’”, {

“hs\_object\_id”: “The record ID for the event”

},

“‘to’”, {

“hs\_object\_id”: “The record ID for the contact”

},

“‘types’”, {

“associationTypeId”: “70”

}

]

}

When using a POST command we get the following result, all over status is “201 created”:

{

“status”: “COMPLETE”,

“results”: [],

“startedAt”: “2024-07-09T11:49:51.182Z”,

“completedAt”: “2024-07-09T11:49:51.222Z”

}

Looking into HubSpot the contact above has not been associated with the Event.

Then we tried to changed POST into PUTT, but now we got the status “405 Method Not Allowed”

Anyone that can guide us from here, so we will be able to make the associations within a flow in Power Automate instead of adding each contact to an event manually in HubSpot.

Best regards,

Sanne

---

<div class="post-metadata">

**Author:** ![DianaGomez](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dianagomez/32/48035_2.png) [@DianaGomez](https://community.hubspot.com/u/DianaGomez)\
**Post date:** [July 10, 2024, 9:14am UTC](https://community.hubspot.com/t/create-association-between-custom-object-and-contacts-via-api/110943/2 "2024-07-10T09:14:27Z")

</div>

Hi @SLEisig,

Thank you for contacting the Community!

Allow me to consult a few HubSpot experts for some insights: Hello @TDwebdev, @Jnix284, @Anton - Would you kindly share any recommendations for @SLEisig?

We deeply value your contributions!

Thanks,

Diana

---

<div class="post-metadata">

**Author:** ![SLEisig](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@SLEisig](https://community.hubspot.com/u/SLEisig)\
**Post date:** [July 10, 2024, 2:58pm UTC](https://community.hubspot.com/t/create-association-between-custom-object-and-contacts-via-api/110943/3 "2024-07-10T14:58:10Z")

</div>

Hi @DianaGomez,

Thanks for tagging som HubSpot experts for some insights, hope that someone will be able to share any recommendations.

Br. @SLEisig

---

<div class="post-metadata">

**Author:** ![jnix284](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jnix284/32/29_2.png) [@jnix284](https://community.hubspot.com/u/jnix284)\
**Post date:** [July 20, 2024, 5:20pm UTC](https://community.hubspot.com/t/create-association-between-custom-object-and-contacts-via-api/110943/4 "2024-07-20T17:20:34Z")

</div>

Thanks for the tag @DianaGomez, I’m sorry for the delayed response this was buried in my inbox.

@SLEisig I don’t have the answer to your question, but I have found a lot of success troubleshooting API issues with [Hub Helper Harry](https://chatgpt.com/g/g-S1yvJO3I6-hub-helper-harry), a chatGPT based bot that was built by @nlafakis / [@Nico\_Lafakis](https://community.hubspot.com/t5/user/viewprofilepage/user-id/492710) (not sure which is his current profile)

---

<div class="post-metadata">

**Author:** ![SLEisig](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@SLEisig](https://community.hubspot.com/u/SLEisig)\
**Post date:** [July 30, 2024, 1:50pm UTC](https://community.hubspot.com/t/create-association-between-custom-object-and-contacts-via-api/110943/5 "2024-07-30T13:50:59Z")

</div>

Thank you very much for your suggestion of using Hub Helper Harry, I will try to go that way, hoping to find a solution. I had tried CoPilot, but it wasn’t that helpful.

---

<div class="post-metadata">

**Author:** ![KrystianSulek](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/krystiansulek/32/102241_2.png) [@KrystianSulek](https://community.hubspot.com/u/KrystianSulek)\
**Post date:** [June 4, 2025, 9:01pm UTC](https://community.hubspot.com/t/create-association-between-custom-object-and-contacts-via-api/110943/6 "2025-06-04T21:01:37Z")

</div>

Hi,

Take a look at this post [AI Agents for B2B Revenue Teams](https://easytechpartners.com/academy/how-to-find-association-ids-for-custom-object-relationships-in-hubspot)

We had similar challenges with assosiations too.

Hope it help!

Krystian

---

<div class="post-metadata">

**Author:** ![SLEisig](https://avatars.discourse-cdn.com/v4/letter/s/b487fb/32.png) [@SLEisig](https://community.hubspot.com/u/SLEisig)\
**Post date:** [July 31, 2024, 6:44am UTC](https://community.hubspot.com/t/create-association-between-custom-object-and-contacts-via-api/110943/7 "2024-07-31T06:44:43Z")

</div>

@Jnix284 Again many thanks for your recommendation. I used Hub Helper Harry and got the answer that it was the JSON structure that caused the issue. The corrected JSON body that Hub Helper Harry suggested was working perfectly and I have now been able to to associate a contact to a custom object in HubSpot by using Power Automate and Hubspot API.
